RU/takeWeaponAmmo: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
Enterprise (talk | contribs)
New page: {{Server function}} 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 ( play...
 
Enterprise (talk | contribs)
No edit summary
Line 1: Line 1:
{{Server function}}
{{Server function}}
{{Translate}}
takeWeaponAmmo takes a specified amount of ammo from a certain player, for a specified weapon (if they already have it).
takeWeaponAmmo takes a specified amount of ammo from a certain player, for a specified weapon (if they already have it).


Line 20: Line 21:
==See Also==
==See Also==
{{RU/Weapon functions}}
{{RU/Weapon functions}}
[[en:takeWeaponAmmo]]

Revision as of 10:53, 10 July 2009

This page requires local translation. If page will remain not translated in reasonable period of time it would be deleted.
After translating the page completely, please remove the ‎{{translate}}‎ tag from the page.

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 - устанавливает свойство указанного типа оружия