PL/takeWeapon: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{PL/Server function}}
{{PL/Server function}}
This function removes a specified weapon or ammo from a certain player's inventory.
Ta funkcja usuwa wybraną broń i (jeśli podana) amunicję z ekwipunku wskazanego gracza.


==Syntax==
==Składnia==
<syntaxhighlight lang="lua">bool takeWeapon ( player thePlayer, int weaponId [, int ammo ] )</syntaxhighlight>
<syntaxhighlight lang="lua">bool takeWeapon ( player thePlayer, int weaponId [, int ammo ] )</syntaxhighlight>


===Required Arguments===
===Wymagane argumenty===
*'''thePlayer''': A player object referencing the specified player.
*'''thePlayer''': wskazany [[player|gracz]]
*'''weaponId''': An integer that refers to a [[weapon]] that you wish to remove.
*'''weaponId''': [[weapon|ID broni]], które chcesz usunąć z ekwipunku


===Optional Arguments===
===Dodatkowe argumenty===
*'''ammo''': If used, this amount of ammo will be taken instead and the weapon will not be removed.
*'''ammo''': If used, this amount of ammo will be taken instead and the weapon will not be removed.


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


==Example==
==Przykład==
This example removes teargas from player.
This example removes teargas from player.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
Line 25: Line 25:
)</syntaxhighlight>
)</syntaxhighlight>


==See Also==
==Zobacz również==
{{Weapon functions}}
{{Weapon functions}}
[[en:takeWeapon]]
[[en:takeWeapon]]
[[ru:takeWeapon]]
[[ru:takeWeapon]]

Revision as of 17:49, 13 September 2018

Ta funkcja usuwa wybraną broń i (jeśli podana) amunicję z ekwipunku wskazanego gracza.

Składnia

bool takeWeapon ( player thePlayer, int weaponId [, int ammo ] )

Wymagane argumenty

  • thePlayer: wskazany gracz
  • weaponId: ID broni, które chcesz usunąć z ekwipunku

Dodatkowe argumenty

  • ammo: If used, this amount of ammo will be taken instead and the weapon will not be removed.

Wynik

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

Przykład

This example removes teargas from player.

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

Zobacz również