Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function playerGetDamageDayZ(attacker, weapon, bodypart, loss)
- cancelEvent()
- damage = 500
- headshot = false
- if weapon == 37 then
- return
- end
- if getElementData(attacker, "zombie") then
- setElementData(getLocalPlayer(), "blood", getElementData(getLocalPlayer(), "blood") - gameplayVariables.zombiedamage)
- --[[local aleatory = math.random(1,
- if aleatory == 4 then
- setElementData(getLocalPlayer(), "infection", true)
- end]]
- local number = math.random(1,20)
- if number == 6 then
- setElementData(getLocalPlayer(),"infection",true)
- end
- local number = math.random(1, 7)
- if number == 4 then
- setElementData(getLocalPlayer(), "bleeding", getElementData(getLocalPlayer(), "bleeding") + math.floor(loss * 10))
- end
- end
- if weapon == 49 then
- if loss > 30 then
- setElementData(getLocalPlayer(), "brokenbone", true)
- setPedControlState("jump", true)
- setElementData(getLocalPlayer(), "blood", getElementData(getLocalPlayer(), "blood") - math.floor(loss * 10))
- end
- setElementData(getLocalPlayer(), "blood", getElementData(getLocalPlayer(), "blood") - math.floor(loss * 5))
- elseif weapon == 63 or weapon == 51 or weapon == 19 then
- setElementData(getLocalPlayer(), "blood", 0)
- if getElementData(getLocalPlayer(), "blood") <= 0 and not getElementData(getLocalPlayer(), "isDead") == true then
- triggerServerEvent("kilLDayZPlayer", getLocalPlayer(), attacker, headshot)
- end
- elseif weapon and weapon > 1 and attacker and getElementType(attacker) == "player" then
- do
- local number = math.random(1, 8)
- if number >= 6 or number <= 8 then
- setElementData(getLocalPlayer(), "bleeding", getElementData(getLocalPlayer(), "bleeding") + math.floor(loss * 10))
- end
- local number = math.random(1, 7)
- if number == 2 then
- setElementData(getLocalPlayer(), "pain", true)
- end
- damage = getWeaponDamage(weapon)
- if bodypart == 9 then
- damage = damage * 1.5
- headshot = true
- end
- if bodypart == 7 or bodypart == 8 then
- setElementData(getLocalPlayer(), "brokenbone", true)
- end
- playRandomHitSound()
- setElementData(getLocalPlayer(), "blood", getElementData(getLocalPlayer(), "blood") - math.random(damage * 0.75, damage * 1.25))
- if not getElementData(getLocalPlayer(), "bandit") then
- setElementData(attacker, "humanity", getElementData(attacker, "humanity") - math.random(40, 200))
- if 0 > getElementData(attacker, "humanity") then
- setElementData(attacker, "bandit", true)
- end
- else
- setElementData(attacker, "humanity", getElementData(attacker, "humanity") + math.random(40, 200))
- if getElementData(attacker, "humanity") > 5000 then
- setElementData(attacker, "humanity", 5000)
- end
- if getElementData(attacker, "humanity") > 2000 then
- setElementData(attacker, "bandit", false)
- end
- end
- if getElementData(getLocalPlayer(), "blood") <= 0 and not getElementData(getLocalPlayer(), "isDead") then
- triggerServerEvent("kilLDayZPlayer", getLocalPlayer(), attacker, headshot, getWeaponNameFromID(weapon))
- setElementData(getLocalPlayer(), "isDead", true)
- end
- end
- elseif weapon == 54 or weapon == 63 or weapon == 49 or weapon == 51 then
- setElementData(getLocalPlayer(), "blood", getElementData(getLocalPlayer(), "blood") - math.random(100, 1000))
- local number = math.random(1, 5)
- if loss > 30 then
- setElementData(getLocalPlayer(), "brokenbone", true)
- setPedControlState("jump", true)
- end
- if loss >= 100 then
- setElementData(getLocalPlayer(), "blood", 49)
- setElementData(getLocalPlayer(), "bleeding", 50)
- end
- local number = math.random(1, 11)
- if number == 3 then
- setElementData(getLocalPlayer(), "pain", true)
- end
- if getElementData(getLocalPlayer(), "blood") <= 0 and not getElementData(getLocalPlayer(), "isDead") == true then
- triggerServerEvent("kilLDayZPlayer", getLocalPlayer(), attacker, headshot, getWeaponNameFromID(weapon))
- setElementData(getLocalPlayer(), "isDead", true)
- end
- end
- end
- addEventHandler("onClientPlayerDamage", getLocalPlayer(), playerGetDamageDayZ)
- function pedGetDamageDayZ(attacker, weapon, bodypart, loss)
- cancelEvent()
- if attacker and attacker == getLocalPlayer() then
- damage = 500
- if weapon == 37 then
- return
- end
- if weapon == 63 or weapon == 51 or weapon == 19 then
- setElementData(source, "blood", 0)
- if 0 >= getElementData(source, "blood") then
- triggerServerEvent("onZombieGetsKilled", source, attacker)
- end
- elseif weapon and weapon > 1 and attacker and getElementType(attacker) == "player" then
- damage = getWeaponDamage(weapon)
- if bodypart == 9 then
- damage = damage * 1.5
- headshot = true
- end
- setElementData(source, "blood", getElementData(source, "blood") - math.random(damage * 0.75, damage * 1.25))
- if 0 >= getElementData(source, "blood") then
- triggerServerEvent("onZombieGetsKilled", source, attacker, headshot)
- end
- end
- end
- end
- addEventHandler("onClientPedDamage", getRootElement(), pedGetDamageDayZ)
Advertisement
Add Comment
Please, Sign In to add comment