RU/giveWeapon: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
Line 3: Line 3:
giveWeapon gives a specified weapon to a certain player or ped. There is an optional argument to specify ammunition. For example, a melee weapon doesn't need an ammo argument.
giveWeapon gives a specified weapon to a certain player or ped. There is an optional argument to specify ammunition. For example, a melee weapon doesn't need an ammo argument.


С помощью этой функции можно выдать оружие игроку, педу.
==Синтаксис==  
==Синтаксис==  
<syntaxhighlight lang="lua">bool giveWeapon ( player thePlayer, int weapon [, int ammo=30, bool setAsCurrent=false ] )</syntaxhighlight>  
<syntaxhighlight lang="lua">bool giveWeapon ( player thePlayer, int weapon [, int ammo=30, bool setAsCurrent=false ] )</syntaxhighlight>  

Revision as of 02:04, 4 September 2011

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.

giveWeapon gives a specified weapon to a certain player or ped. There is an optional argument to specify ammunition. For example, a melee weapon doesn't need an ammo argument.

С помощью этой функции можно выдать оружие игроку, педу.

Синтаксис

bool giveWeapon ( player thePlayer, int weapon [, int ammo=30, bool setAsCurrent=false ] )

Обязательные аргументы

Выборочные аргументы

  • ammo: Колличество патронов которое будет даваться к оружию. Для оружий, которые не требуют боеприпасов, такие, как ближний бой, патронов будет 1.
  • setAsCurrent: Логическое значение будет ли оружие в руках после выдачи

Возврат

Возвращёет true Если оружие успешно выдано, false если иначе.

Пример

В этом примере при спавне игрока ему выдаётся M4

function giveWeaponsOnSpawn ( theSpawnpont, theTeam )
    giveWeapon ( source, 31, 200 ) -- Дадим M4 с 200 патронами
end
addEventHandler ( "onPlayerSpawn", getRootElement(), giveWeaponsOnSpawn )