Перейти к содержанию

OnPlayerWeaponSwitch

Материал из RAGE MP Wiki Archive
Версия от 05:48, 9 мая 2023; imported>Xabi
(разн.) ← Предыдущая версия | Текущая версия (разн.) | Следующая версия → (разн.)

This event is triggered when a player changes weapon.


<syntaxhighlight lang="csharp"> [ServerEvent(Event.PlayerWeaponSwitch)] </syntaxhighlight>

Parameters

  • player: parameter input should be in Player type
  • oldWeapon: parameter input should be in WeaponHash type
  • newWeapon: parameter input should be in WeaponHash type

Example

<syntaxhighlight lang="csharp"> [ServerEvent(Event.PlayerWeaponSwitch)] public void OnPlayerWeaponSwitch(Player player, WeaponHash oldWeapon, WeaponHash newWeapon) { player.SendChatMessage($"You have swapped from {oldWeapon} to {newWeapon}."); } </syntaxhighlight>