Guest User

Untitled

a guest
Dec 23rd, 2017
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.25 KB | None | 0 0
  1. function playerGetDamageDayZ(attacker, weapon, bodypart, loss)
  2. cancelEvent()
  3. damage = 500
  4. headshot = false
  5. if weapon == 37 then
  6. return
  7. end
  8. if getElementData(attacker, "zombie") then
  9. setElementData(getLocalPlayer(), "blood", getElementData(getLocalPlayer(), "blood") - gameplayVariables.zombiedamage)
  10. --[[local aleatory = math.random(1,
  11. if aleatory == 4 then
  12. setElementData(getLocalPlayer(), "infection", true)
  13. end]]
  14. local number = math.random(1,20)
  15. if number == 6 then
  16. setElementData(getLocalPlayer(),"infection",true)
  17. end
  18. local number = math.random(1, 7)
  19. if number == 4 then
  20. setElementData(getLocalPlayer(), "bleeding", getElementData(getLocalPlayer(), "bleeding") + math.floor(loss * 10))
  21. end
  22. end
  23. if weapon == 49 then
  24. if loss > 30 then
  25. setElementData(getLocalPlayer(), "brokenbone", true)
  26. setPedControlState("jump", true)
  27. setElementData(getLocalPlayer(), "blood", getElementData(getLocalPlayer(), "blood") - math.floor(loss * 10))
  28. end
  29. setElementData(getLocalPlayer(), "blood", getElementData(getLocalPlayer(), "blood") - math.floor(loss * 5))
  30. elseif weapon == 63 or weapon == 51 or weapon == 19 then
  31. setElementData(getLocalPlayer(), "blood", 0)
  32. if getElementData(getLocalPlayer(), "blood") <= 0 and not getElementData(getLocalPlayer(), "isDead") == true then
  33. triggerServerEvent("kilLDayZPlayer", getLocalPlayer(), attacker, headshot)
  34. end
  35. elseif weapon and weapon > 1 and attacker and getElementType(attacker) == "player" then
  36. do
  37. local number = math.random(1, 8)
  38. if number >= 6 or number <= 8 then
  39. setElementData(getLocalPlayer(), "bleeding", getElementData(getLocalPlayer(), "bleeding") + math.floor(loss * 10))
  40. end
  41. local number = math.random(1, 7)
  42. if number == 2 then
  43. setElementData(getLocalPlayer(), "pain", true)
  44. end
  45. damage = getWeaponDamage(weapon)
  46. if bodypart == 9 then
  47. damage = damage * 1.5
  48. headshot = true
  49. end
  50. if bodypart == 7 or bodypart == 8 then
  51. setElementData(getLocalPlayer(), "brokenbone", true)
  52. end
  53. playRandomHitSound()
  54. setElementData(getLocalPlayer(), "blood", getElementData(getLocalPlayer(), "blood") - math.random(damage * 0.75, damage * 1.25))
  55. if not getElementData(getLocalPlayer(), "bandit") then
  56. setElementData(attacker, "humanity", getElementData(attacker, "humanity") - math.random(40, 200))
  57. if 0 > getElementData(attacker, "humanity") then
  58. setElementData(attacker, "bandit", true)
  59. end
  60. else
  61. setElementData(attacker, "humanity", getElementData(attacker, "humanity") + math.random(40, 200))
  62. if getElementData(attacker, "humanity") > 5000 then
  63. setElementData(attacker, "humanity", 5000)
  64. end
  65. if getElementData(attacker, "humanity") > 2000 then
  66. setElementData(attacker, "bandit", false)
  67. end
  68. end
  69. if getElementData(getLocalPlayer(), "blood") <= 0 and not getElementData(getLocalPlayer(), "isDead") then
  70. triggerServerEvent("kilLDayZPlayer", getLocalPlayer(), attacker, headshot, getWeaponNameFromID(weapon))
  71. setElementData(getLocalPlayer(), "isDead", true)
  72. end
  73. end
  74. elseif weapon == 54 or weapon == 63 or weapon == 49 or weapon == 51 then
  75. setElementData(getLocalPlayer(), "blood", getElementData(getLocalPlayer(), "blood") - math.random(100, 1000))
  76. local number = math.random(1, 5)
  77. if loss > 30 then
  78. setElementData(getLocalPlayer(), "brokenbone", true)
  79. setPedControlState("jump", true)
  80. end
  81. if loss >= 100 then
  82. setElementData(getLocalPlayer(), "blood", 49)
  83. setElementData(getLocalPlayer(), "bleeding", 50)
  84. end
  85. local number = math.random(1, 11)
  86. if number == 3 then
  87. setElementData(getLocalPlayer(), "pain", true)
  88. end
  89. if getElementData(getLocalPlayer(), "blood") <= 0 and not getElementData(getLocalPlayer(), "isDead") == true then
  90. triggerServerEvent("kilLDayZPlayer", getLocalPlayer(), attacker, headshot, getWeaponNameFromID(weapon))
  91. setElementData(getLocalPlayer(), "isDead", true)
  92. end
  93. end
  94. end
  95. addEventHandler("onClientPlayerDamage", getLocalPlayer(), playerGetDamageDayZ)
  96. function pedGetDamageDayZ(attacker, weapon, bodypart, loss)
  97. cancelEvent()
  98. if attacker and attacker == getLocalPlayer() then
  99. damage = 500
  100. if weapon == 37 then
  101. return
  102. end
  103. if weapon == 63 or weapon == 51 or weapon == 19 then
  104. setElementData(source, "blood", 0)
  105. if 0 >= getElementData(source, "blood") then
  106. triggerServerEvent("onZombieGetsKilled", source, attacker)
  107. end
  108. elseif weapon and weapon > 1 and attacker and getElementType(attacker) == "player" then
  109. damage = getWeaponDamage(weapon)
  110. if bodypart == 9 then
  111. damage = damage * 1.5
  112. headshot = true
  113. end
  114. setElementData(source, "blood", getElementData(source, "blood") - math.random(damage * 0.75, damage * 1.25))
  115. if 0 >= getElementData(source, "blood") then
  116. triggerServerEvent("onZombieGetsKilled", source, attacker, headshot)
  117. end
  118. end
  119. end
  120. end
  121. addEventHandler("onClientPedDamage", getRootElement(), pedGetDamageDayZ)
Advertisement
Add Comment
Please, Sign In to add comment