TakeWeapon

From Multi Theft Auto: Wiki
Revision as of 16:16, 4 December 2006 by EAi (talk | contribs) (→‎Example)
Jump to navigation Jump to search

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.

player = getPlayerFromID ( 1 )
if ( takeWeapon ( player, 28 ) )
  outputChatBox ( "Weapon 28 removed from ", getPlayerName ( player ), "." )
end

See Also