TakeWeapon: Difference between revisions
Jump to navigation
Jump to search
AlexsSteel (talk | contribs) m (→Example) |
AlexsSteel (talk | contribs) mNo edit summary |
||
Line 23: | Line 23: | ||
takeWeapon( thePlayer, 17 ) | takeWeapon( thePlayer, 17 ) | ||
end | end | ||
)/ | )[/lua]</syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Weapon functions}} | {{Weapon functions}} | ||
[[ru:takeWeapon]] | [[ru:takeWeapon]] |
Revision as of 17:14, 18 January 2014
This function removes a specified weapon or ammo from a certain player's inventory.
Syntax
bool takeWeapon ( player thePlayer, int weaponId [, int ammo ] )
Required Arguments
- thePlayer: A player object referencing the specified player.
- weaponId: An integer that refers to a weapon that you wish to remove.
Optional Arguments
- ammo: If used, this amount of ammo will be taken instead and the weapon will not be removed.
Returns
Returns a true if the weapon/ammo was removed successfully, false otherwise.
Example
This example removes weapon 28 from player.
addCommandHandler( 'rtear', function( thePlayer ) takeWeapon( thePlayer, 17 ) end )[/lua]