Guest User

Untitled

a guest
Jan 12th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. function deathCheck(attacker, attackerweapon, bodypart, loss)
  2. local pHealth = getElementHealth(source)
  3.  
  4. if (pHealth <=15) and (pHealth >= 5) then
  5. outputChatBox("*You're near death and will be completely lifeless soon, Type /acceptdeath or wait for Medics!", source, 255, 0, 0, false)
  6. setPedAnimation(source, "ped", "KO_shot_stom", 3000, false, false, false)
  7. setTimer(setPedAnimation, 3000, 1, source, "ped", "KO_shot_stom", -1, false, false, false)
  8. addCommandHandler("acceptdeath", killHim)
  9. setElementData(source, "injured", true)
  10. end
  11. if (bodypart == 9 ) then
  12. killPed(source)
  13. end
  14. end
  15. addEventHandler("onPlayerDamage", getRootElement(), deathCheck)
  16.  
  17. function killHim(source)
  18. killPed(source)
  19. removeCommandHandler("acceptdeath")
  20. end
  21.  
  22. function checkHp()
  23. local players = getElementsByType("player")
  24. for theKey,thePlayer in ipairs(players) do
  25. if (getElementData(thePlayer, "injured") == true ) and (getElementHealth(thePlayer >= 20) then
  26. setElementData(thePlayer, "injured", false)
  27. end
  28. end
  29. end
  30. setTimer(checkHp, 1000, 0)
Add Comment
Please, Sign In to add comment