RU/takeWeaponAmmo: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Blanked the page)
m (Reverted edits by Bonzo (talk) to last revision by Strix)
 
Line 1: Line 1:
__NOTOC__
{{RU/Server function}}
{{Translate|ru}}
takeWeaponAmmo takes a specified amount of ammo from a certain player, for a specified weapon (if they already have it).


==Syntax==
<syntaxhighlight lang="lua">takeWeaponAmmo ( player thePlayer, int weapon, int ammo )</syntaxhighlight>
===Required Arguments===
*'''thePlayer:''' A [[player]] object referencing the specified player 
*'''weapon:''' A whole number integer that refers to a [[weapon]] ID.
*'''ammo:''' A whole number integer serving as the ammo amount for the given weapon
==Example==
This example will give players an M4 weapon with 200 ammo followed by taking 5 ammo when they spawn.
<syntaxhighlight lang="lua">function onSpawnpointUse ( thePlayer )
    giveWeapon ( thePlayer, 31, 200 )    -- Gives the M4 weapon with 200 ammo to any player when they use a spawnpoint
    takeWeaponAmmo ( thePlayer, 31, 5 )  -- Takes 5 ammo from the player's M4
end
addEventHandler ( "onSpawnpointUse", getRootElement(), onSpawnpointUse )</syntaxhighlight>
==See Also==
{{RU/Weapon functions}}
[[en:takeWeaponAmmo]]

Latest revision as of 03:05, 1 April 2016

Warning.png

Статью необходимо перевести на русский язык. Если страница не будет переведена в разумные сроки, она будет удалена.

takeWeaponAmmo takes a specified amount of ammo from a certain player, for a specified weapon (if they already have it).

Syntax

takeWeaponAmmo ( player thePlayer, int weapon, int ammo )

Required Arguments

  • thePlayer: A player object referencing the specified player
  • weapon: A whole number integer that refers to a weapon ID.
  • ammo: A whole number integer serving as the ammo amount for the given weapon

Example

This example will give players an M4 weapon with 200 ammo followed by taking 5 ammo when they spawn.

function onSpawnpointUse ( thePlayer )
    giveWeapon ( thePlayer, 31, 200 )    -- Gives the M4 weapon with 200 ammo to any player when they use a spawnpoint
    takeWeaponAmmo ( thePlayer, 31, 5 )  -- Takes 5 ammo from the player's M4
end
addEventHandler ( "onSpawnpointUse", getRootElement(), onSpawnpointUse )

See Also

Серверные функции

  • giveWeapon - дает указанное оружие игроку или пешеходу
  • takeAllWeapons - удаляет всё оружие с указанного игрока или пешехода
  • takeWeapon - удаляет указанное оружие или боеприпасы с игрока или пешехода
ДО ВЕРСИИ 1.3.1 :
  • takeWeaponAmmo - удаляет определённое кол-во боеприпасов у игрока для указанного оружия
  • giveWeaponAmmo - даёт определённое кол-во боеприпасов игроку для указанного оружия

Клиентские функции

Общие функции

  • getOriginalWeaponProperty - получает исходное свойство указанного типа оружия
  • getPickupWeapon - получает ID оружия из указанного пикапа
  • getSlotFromWeapon - получает слот к которому принадлежит оружие
  • getWeaponIDFromName - получает ID оружия из его названия
  • getWeaponNameFromID - получает название оружия или причину смерти из его ID
  • getWeaponProperty - получает свойство указанного оружия
  • setWeaponAmmo - устанавливает определенное кол-во боеприпасов для указанного оружия
  • setWeaponProperty - устанавливает свойство указанного типа оружия