Advertisement
Guest User

/revive script

a guest
Apr 6th, 2018
1,780
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. Client
  2. local skins = {
  3. -- Police --
  4. "s_m_y_cop_01",
  5. "s_f_y_cop_01",
  6. -- Highway --
  7. "s_m_y_hwaycop_01",
  8. -- Sheriff --
  9. "s_m_y_sheriff_01",
  10. "s_f_y_sheriff_01",
  11. -- Ranger --
  12. "s_m_y_ranger_01",
  13. "s_f_y_ranger_01",
  14. }
  15.  
  16.  
  17. RegisterNetEvent("revive")
  18. AddEventHandler("revive", function()
  19. if CheckSkin(GetPlayerPed(-1)) then
  20. CancelEvent()
  21. local plyCoords = GetEntityCoords(GetPlayerPed(-1), true)
  22. ResurrectPed(GetPlayerPed(-1))
  23. SetEntityHealth(GetPlayerPed(-1), 200)
  24. ClearPedTasksImmediately(GetPlayerPed(-1))
  25. SetEntityCoords(GetPlayerPed(-1), plyCoords.x, plyCoords.y, plyCoords.z + 1.0, 0, 0, 0, 0)
  26. end)
  27.  
  28. function CheckSkin(ped)
  29. for i = 1, #skins do
  30. if GetHashKey(skins[i]) == GetEntityModel(ped) then
  31. return true
  32. end
  33. end
  34. return false
  35. end
  36.  
  37.  
  38.  
  39. Server
  40. if cm[1] == "/revive" then
  41. CancelEvent()
  42. if tablelength(cm) > 1 then
  43. local tPID = tonumber(cm[2])
  44. TriggerClientEvent("revive", tPID)
  45. end
  46. end
  47. end)
  48.  
  49. function stringsplit(self, delimiter)
  50. local a = self:Split(delimiter)
  51. local t = {}
  52.  
  53. for i = 0, #a - 1 do
  54. table.insert(t, a[i])
  55. end
  56.  
  57. return t
  58. end
  59.  
  60. function tablelength(T)
  61. local count = 0
  62. for _ in pairs(T) do count = count + 1 end
  63. return count
  64. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement