Lua:
Citizen.CreateThread(function()
while true do
Citizen.Wait(2)
local pelaaja = PlayerPedId()
if DoesEntityExist(pelaaja) then
if not IsEntityDead(pelaaja) then
local _, hitbox = GetPedLastDamageBone(pelaaja)
if hitbox == 31086 then
if HasEntityBeenDamagedByWeapon(pelaaja, GetHashKey("WEAPON_COMBATPISTOL"), 0) then
SetEntityHealth(pelaaja, 0)
ClearEntityLastWeaponDamage(pelaaja)
ClearPedLastWeaponDamage(pelaaja)
ClearEntityLastDamageEntity(pelaaja)
ClearPedLastDamageBone(pelaaja)
elseif HasEntityBeenDamagedByWeapon(pelaaja, GetHashKey("WEAPON_PISTOL"), 0) then
SetEntityHealth(pelaaja, 0)
ClearEntityLastWeaponDamage(pelaaja)
ClearPedLastWeaponDamage(pelaaja)
ClearEntityLastDamageEntity(pelaaja)
ClearPedLastDamageBone(pelaaja)
end
else
Wait(100)
end
else
Wait(30000)
end
end
end
end)