TakeWeapon: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
mNo edit summary |
||
Line 15: | Line 15: | ||
==Example== | ==Example== | ||
This example removes weapon 28 from player ID 1. If successful, it displays a message in the chat box. | This example removes weapon 28 from player ID 1. If successful, it displays a message in the chat box. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
if ( takeWeapon ( | thePlayer = getPlayerFromID ( 1 ) | ||
outputChatBox ( "Weapon 28 removed from " .. | if ( takeWeapon ( thePlayer, 28 ) ) | ||
outputChatBox ( "Weapon 28 removed from " .. getClientName ( thePlayer ) .. "." ) | |||
end</syntaxhighlight> | end</syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Weapon functions}} | {{Weapon functions}} |
Revision as of 18:42, 21 August 2007
This function removes a specified weapon from a certain player's inventory.
Syntax
bool takeWeapon ( player thePlayer, int weaponId )
Required Arguments
- thePlayer: A player object referencing the specified player.
- weaponId: An integer that refers to a weapon that you wish to remove.
Returns
Returns a true if the weapon was removed successfully, false otherwise.
Example
This example removes weapon 28 from player ID 1. If successful, it displays a message in the chat box.
thePlayer = getPlayerFromID ( 1 ) if ( takeWeapon ( thePlayer, 28 ) ) outputChatBox ( "Weapon 28 removed from " .. getClientName ( thePlayer ) .. "." ) end
See Also
- getWeaponProperty
- getPickupWeapon
- getOriginalWeaponProperty
- getSlotFromWeapon
- getWeaponIDFromName
- getWeaponNameFromID
- setWeaponAmmo
- setWeaponProperty