TakeWeapon: Difference between revisions
Jump to navigation
Jump to search
AlexsSteel (talk | contribs) |
m (→See Also) |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server | {{Server function}} | ||
This function removes a specified weapon or ammo from a certain player's inventory. | This function removes a specified weapon or ammo from a certain player's inventory. | ||
Line 17: | Line 17: | ||
==Example== | ==Example== | ||
This example removes | This example removes teargas from player. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
addCommandHandler( 'rtear', | addCommandHandler( 'rtear', | ||
Line 26: | Line 26: | ||
==See Also== | ==See Also== | ||
{{Weapon functions}} | {{Weapon functions|server}} | ||
[[pl:takeWeapon]] | |||
[[ru:takeWeapon]] | [[ru:takeWeapon]] |
Latest revision as of 22:39, 6 September 2024
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 teargas from player.
addCommandHandler( 'rtear', function( thePlayer ) takeWeapon( thePlayer, 17 ) end )