Squirrel/Server/Events/Player/onPlayerWeaponChange
From Liberty Unleashed Wiki
(Difference between revisions)
(New page: __NOTOC__ This is called when a player switches their weapon. == Syntax == <code>function onPlayerWeaponChange( player, oldWeapon, newWeapon )</code> == Parameters == * '''player''' - ...) |
(→Parameters) |
||
Line 9: | Line 9: | ||
* '''player''' - The player pointer | * '''player''' - The player pointer | ||
− | * '''oldWeapon''' - ID of weapon player was wielding before the detected change | + | * '''oldWeapon''' - ID of the weapon a player was wielding before the detected change |
− | * '''newWeapon''' - ID of the weapon player is holding after the detected change | + | * '''newWeapon''' - ID of the weapon a player is holding after the detected change |
== Example == | == Example == |
Revision as of 09:48, 9 January 2010
This is called when a player switches their weapon.
Syntax
function onPlayerWeaponChange( player, oldWeapon, newWeapon )
Parameters
- player - The player pointer
- oldWeapon - ID of the weapon a player was wielding before the detected change
- newWeapon - ID of the weapon a player is holding after the detected change
Example
This example will block a player from firing their weapon if they switch to a minigun in a server without minigun pickups/commands
function onPlayerWeaponChange( player, oldwep, newwep ) { if ( newwep == 33 ) Message( "Weapon sync has been disabled for:[ " + player.Name + " ] Reason:[ Minigun Cheats ]") && player.IsWeaponSyncBlocked = false; }
Notes
The functions Message and player.Name were used in in this example. More info about them can be found in the corresponding pages.
Related Events
- onPlayerAction
- onPlayerArmourChange
- onPlayerCashChange
- onPlayerChat
- onPlayerCommand
- onPlayerConnect
- onPlayerDeath
- onPlayerFall
- onPlayerHealthChange
- onPlayerIslandChange
- onPlayerJoin
- onPlayerKeyStateChange
- onPlayerKill
- onPlayerPart
- onPlayerScoreChange
- onPlayerSkinChange
- onPlayerSpawn
- onPlayerUpdate
- onPlayerTeamChange
- onPlayerUseDetonator
- onPlayerVirtualWorldChange
- onPlayerWeaponChange