Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SERVERSIDE:
- addEventHandler("onPlayerSpawn", root,
- function()
- setElementData(source, "hp", 100)
- end
- )
- function setElementHealthEx(element, health, attacker, weapon, bodypart)
- if getElementType(element) == "ped" then
- setElementData(element, "hp", health)
- if hp <= 0 then
- killPed(element, attacker, weapon, bodypart, false)
- end
- else setElementHealth(element, health)
- end
- function killPedEx(ped, attacker, weapon, bodypart, stealth)
- killPed(ped, attacker, weapon, bodypart, stealth)
- end
- addEvent("killPedEx", true)
- addEventHandler("killPedEx", root, killPedEx)
- CLIENTSIDE:
- function setElementHealthEx(element, health, attacker, weapon, bodypart)
- if getElementType(element) == "ped" then
- setElementData(element, "hp", health)
- if hp <= 0 then
- triggerServerEvent("killPedEx", root, element, attacker, weapon, bodypart, false)
- end
- else setElementHealth(element, health)
- end
- function damageFunc(attacker, weapon, bodypart, loss)
- cancelEvent()
- setElementData(source, "hp", getElementHealth(source) - loss)
- setElementHealthEx(source, getElementHealth(source) - loss, attacker, weapon, bodypart)
- end
- addEventHandler("onClientPlayerDamage", localPlayer, damageFunc)
- addEventHandler("onClientPedDamage", root, damageFunc)
Advertisement
Add Comment
Please, Sign In to add comment