takeWeapon | Multi Theft Auto: Wiki Skip to content

takeWeapon

Client-side
Server-side
Shared

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


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.
  • ammo: If used, this amount of ammo will be taken instead and the weapon will not be removed.

Returns

  • bool: value

Returns a true if the weapon/ammo was removed successfully, false otherwise.

Code Examples

shared

This example removes teargas from player.

addCommandHandler( 'rtear',
function( thePlayer )
takeWeapon( thePlayer, 17 )
end
)