PL/takeWeapon: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ {{PL/Server function}} This function removes a specified weapon or ammo from a certain player's inventory. ==Syntax== <syntaxhighlight lang="lua">bool takeWeapon (...")
 
No edit summary
Line 26: Line 26:


==See Also==
==See Also==
{{PL/Weapon functions}}
{{Weapon functions}}
[[pl:takeWeapon]]
[[en:takeWeapon]]
[[ru:takeWeapon]]
[[ru:takeWeapon]]

Revision as of 17:45, 13 September 2018

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
)

See Also