Guest User

killplayerc.lua

a guest
Feb 5th, 2017
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.20 KB | None | 0 0
  1. function damaged(shooter, weapon, bodypart, loss)
  2.   if (weapon == 34 or weapon == 33) and (bodypart == 9 or bodypart == 3 or bodypart == 4) then
  3.     isInKillcam = getElementData(shooter, "killcam.isinkillcam")
  4.     if not isInKillcam then
  5.       setElementData(shooter, "killcam.isinkillcam", true)
  6.       reciever = source
  7.       health = getElementHealth(source)
  8.       setElementHealth(source, health + loss)
  9.       shx, shy, shz = getElementPosition(shooter)
  10.       hitx, hity, hitz = getElementPosition(source)
  11.       vx, vy, vz = getElementVelocity(reciever)
  12.       if vx ~= 0 or vy ~= 0 or vz ~= 0 then
  13.         moving = true
  14.       else
  15.         moving = false
  16.       end
  17.       triggerClientEvent(shooter, "onSniperHeadshot", root, shx, shy, shz, hitx, hity, hitz, bodypart, moving, reciever, weapon)
  18.       triggerClientEvent(source, "onRecieveSniperHeadshot", root, shx, shy, shz, hitx, hity, hitz)
  19.     end
  20.   end
  21. end
  22. addEventHandler("onPlayerDamage", root, damaged)
  23. function killreciever(shooter, reciever, weapon)
  24.   setElementData(shooter, "killcam.isinkillcam", false)
  25.   killPed(reciever, shooter, weapon, 9)
  26. end
  27. addEvent("onKillCamFinish", true)
  28. addEventHandler("onKillCamFinish", root, killreciever)
Add Comment
Please, Sign In to add comment