TakeWeapon: Difference between revisions
Jump to navigation
Jump to search
Enterprise (talk | contribs) No edit summary |
m (→Example) |
||
Line 18: | Line 18: | ||
thePlayer = getPlayerFromID ( 1 ) | thePlayer = getPlayerFromID ( 1 ) | ||
if ( takeWeapon ( thePlayer, 28 ) ) | if ( takeWeapon ( thePlayer, 28 ) ) | ||
outputChatBox ( "Weapon 28 removed from " .. | outputChatBox ( "Weapon 28 removed from " .. getPlayerName ( thePlayer ) .. "." ) | ||
end</syntaxhighlight> | end</syntaxhighlight> | ||
Revision as of 12:15, 27 August 2009
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 " .. getPlayerName ( thePlayer ) .. "." ) end