عل العموم جرب .
function checkArmor ( )
value = false
if getPedArmor ( localPlayer ) >= 15 then
value = true
triggerServerEvent ( 'getArmor' , localPlayer , getPedArmor ( localPlayer ) - 15 )
elseif getPedArmor ( localPlayer ) < 15 then
triggerServerEvent ( 'getArmor' , localPlayer , 0 )
value = true
elseif getPedArmor ( localPlayer ) == 0 then
value = false
end
return value
end
function zombieattack ( attacker, weapon, bodypart )
if (attacker) then
if getElementType ( attacker ) == "ped" then
if (getElementData (attacker, "zombie") == true) then
local playerHealth = getElementHealth ( getLocalPlayer() )
if ( checkArmor == false ) then return end
if playerHealth > 15 then
setElementHealth ( source, playerHealth - 15 )
else
triggerServerEvent ("playereaten", source, source, attacker, weapon, bodypart )
end
end
end
end
end
addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), zombieattack )