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

OnPlayerWeaponSwitch

Материал из RAGE MP Wiki Archive

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>