Squirrel/Server/Events/Player/onPlayerWeaponChange

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(New page: __NOTOC__ This is called when a player switches their weapon. == Syntax == <code>function onPlayerWeaponChange( player, oldWeapon, newWeapon )</code> == Parameters == * '''player''' - ...)

Revision as of 09:48, 9 January 2010

This is called when a player switches their weapon.

Syntax

  1. function onPlayerWeaponChange( player, oldWeapon, newWeapon )

Parameters

  • player - The player pointer
  • oldWeapon - ID of weapon player was wielding before the detected change
  • newWeapon - ID of the weapon 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

  1.  
  2. function onPlayerWeaponChange( player, oldwep, newwep )
  3. {
  4. if ( newwep == 33 ) Message( "Weapon sync has been disabled for:[ " + player.Name + " ] Reason:[ Minigun Cheats ]") && player.IsWeaponSyncBlocked = false;
  5. }
  6.  

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

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox