Advertisement
Guest User

client.lua

a guest
Sep 20th, 2019
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. local ESX = nil
  2.  
  3. Citizen.CreateThread(function()
  4. while ESX == nil do
  5. TriggerEvent('esx:getSharedObject', function(obj)
  6. ESX = obj
  7. end)
  8.  
  9. Citizen.Wait(0)
  10. end
  11. end)
  12.  
  13. RegisterCommand("tpm", function(source)
  14. TeleportToWaypoint()
  15. end)
  16.  
  17. TeleportToWaypoint = function()
  18. ESX.TriggerServerCallback("esx_marker:fetchUserRank", function(playerRank)
  19. if playerRank == "admin" or playerRank == "superadmin" or playerRank == "mod" or playerRank == "owner" then
  20. local WaypointHandle = GetFirstBlipInfoId(8)
  21.  
  22. if DoesBlipExist(WaypointHandle) then
  23. local waypointCoords = GetBlipInfoIdCoord(WaypointHandle)
  24.  
  25. for height = 1, 1000 do
  26. SetPedCoordsKeepVehicle(PlayerPedId(), waypointCoords["x"], waypointCoords["y"], height + 0.0)
  27.  
  28. local foundGround, zPos = GetGroundZFor_3dCoord(waypointCoords["x"], waypointCoords["y"], height + 0.0)
  29.  
  30. if foundGround then
  31. SetPedCoordsKeepVehicle(PlayerPedId(), waypointCoords["x"], waypointCoords["y"], height + 0.0)
  32.  
  33. break
  34. end
  35.  
  36. Citizen.Wait(5)
  37. end
  38. exports['mythic_notify']:DoHudText('success', 'Teleported')
  39. -- ESX.ShowNotification("Teleported.")
  40. else
  41. exports['mythic_notify']:DoHudText('inform', 'Please place your waypoint.')
  42. -- ESX.ShowNotification("Please place your waypoint.")
  43. end
  44. else
  45. exports['mythic_notify']:DoLongHudText('error', 'You do not have rights to do this.')
  46. --ESX.ShowNotification("You do not have rights to do this.")
  47. end
  48. end)
  49. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement