Синтакс
bool killPed ( ped thePed, [ ped theKiller = nil, int weapon=255, int bodyPart=255, bool stealth ] )
Обязательные аргументы
thePed: Ped, которого вы хототе убить.
Необязательные аргументы
theKiller: Пед-убийца
weapon: ID оружия, из которого был убит пед. (не влияет, как он умирает)
bodyPart: ID части тела, в которую был выстрел в педа. (не влияет, как он умирает)
3: Torso
4: Ass
5: Left Arm
6: Right Arm
7: Left Leg
8: Right leg
9: Head
4: Ass
5: Left Arm
6: Right Arm
7: Left Leg
8: Right leg
9: Head
stealth: Логическое значение, устанавливающее был ли пед убит скрытно.
Возвращения Возвращает true если пед убит, false если пед не убит или указан несуществующий пед.
Пример
Пример 1: Этот простой пример добавляют команду kill, что бы убить себя.
function commitSuicide ( sourcePlayer )
-- kill the player and make him responsible for it
killPed ( sourcePlayer, sourcePlayer )
end
-- attach our handler to the "kill" command
addCommandHandler ( "kill", commitSuicide )
-- kill the player and make him responsible for it
killPed ( sourcePlayer, sourcePlayer )
end
-- attach our handler to the "kill" command
addCommandHandler ( "kill", commitSuicide )
Пример 2: Этот пример даёт 1 единицу урона, если игрок убит выстрелом в голову.
function headshotKill ( attacker, attackerweapon, bodypart, loss )
if bodypart == 9 then --if the bodypart is the head
--kill the player, emulating the correct killer, weapon and bodypart.
killPed ( source, attacker, attackerweapon, bodypart )
end
end
addEventHandler ( "onPlayerDamage", getRootElement(), headshotKill )
if bodypart == 9 then --if the bodypart is the head
--kill the player, emulating the correct killer, weapon and bodypart.
killPed ( source, attacker, attackerweapon, bodypart )
end
end
addEventHandler ( "onPlayerDamage", getRootElement(), headshotKill )