Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
914
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. function SendDistressSignal()
  2.  
  3. local alreadyDead = false
  4. local playerPed = GetPlayerPed(-1)
  5. local coords = GetEntityCoords(playerPed)
  6. local PlayerCoords = { x = PedPosition.x, y = PedPosition.y, z = PedPosition.z }
  7.  
  8. while true do
  9. Citizen.Wait(50)
  10. if HasEntityClearLosToEntityInFront(player, ped) then
  11. ESX.ShowNotification(_U('distress_sent'))
  12. TriggerServerEvent('esx_addons_gcphone:startCall', 'ambulance', _U('distress_message'), PlayerCoords, {
  13. PlayerCoords = { x = PedPosition.x, y = PedPosition.y, z = PedPosition.z },
  14.  
  15. })
  16.  
  17. break
  18. end
  19. end
  20.  
  21. Citizen.CreateThread(function()
  22. while true do
  23. Citizen.Wait(50)
  24. if IsEntityDead(playerPed) and not alreadyDead then
  25. SendDistressSignal()
  26. alreadyDead = true
  27.  
  28. elseif not IsEntityDead(playerPed) then
  29. alreadyDead = false
  30.  
  31. end
  32. end
  33. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement