PlayerWeaponChange
Tip
This event is available on server-side only
This event is called when a player changes weapon.
Parameter | Description |
---|---|
player | The player who changed weapon. |
oldWeapon | The old weapon. See: Weapons |
newWeapon | The new weapon. See: Weapons |
Normal event handler
Alt.OnPlayerWeaponChange += (player, oldWeapon, newWeapon) => {
// ...
}
Attribute event handler
Warning
Attribute event handlers only work in Scripts, or after executing Alt.RegisterEvents on a class instance.
For more info see: Create script
public class MyScript : IScript
{
[ScriptEvent(ScriptEventType.PlayerWeaponChange)]
public void OnPlayerWeaponChange(IPlayer player, uint oldWeapon, uint newWeapon)
{
// ...
}
}