TakeAllWeapons: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
(22 intermediate revisions by 11 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
==Description==
{{Server function}}
This function removes every weapons from a specified player, rendering him unarmed. It returns a boolean value (true or false) depending on whether the function passed or failed.
This function removes every weapons from a specified [[ped]], rendering it unarmed.
{{Note|Weapons are removed when a ped dies by default. This means that it is only appropriate to use this function while a ped is alive.}}


==Syntax==
==Syntax==
bool [[TakeAllWeapons]] ( [[player]] player )
<syntaxhighlight lang="lua">bool takeAllWeapons ( ped thePed )</syntaxhighlight>


===Required Arguments===
===Required Arguments===
*'''[[player]]''': A [[player]] object referencing the specified player
*'''thePed''': A [[ped]] element referencing the specified ped
 
===Returns===
Returns ''true'' if the function succeeded, ''false'' otherwise.


==Example==
==Example==
player = [[getPlayerFromID]] ( 1 )
This example removes all weapons from every player
  [[TakeAllWeapons]] ( player )  
<syntaxhighlight lang="lua">
  [[serverChat]] ( "All weapons removed from ", [[getPlayerName]] ( player ), "." )
takeAllWeapons ( root ) --remove all the weapons
outputChatBox ( "Weapons are not permitted!" ) --tell the players why they lost their weapons</syntaxhighlight>
 
==See Also==
{{Weapon functions}}
[[ru:takeAllWeapons]]
[[pl:takeAllWeapons]]

Latest revision as of 07:09, 4 November 2020

This function removes every weapons from a specified ped, rendering it unarmed.

[[{{{image}}}|link=|]] Note: Weapons are removed when a ped dies by default. This means that it is only appropriate to use this function while a ped is alive.

Syntax

bool takeAllWeapons ( ped thePed )

Required Arguments

  • thePed: A ped element referencing the specified ped

Returns

Returns true if the function succeeded, false otherwise.

Example

This example removes all weapons from every player

takeAllWeapons ( root )  --remove all the weapons
outputChatBox ( "Weapons are not permitted!" ) --tell the players why they lost their weapons

See Also