Advertisement
Guest User

Untitled

a guest
Sep 5th, 2018
407
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. local hintIsShowed = false
  2. local hasAlreadyEnteredMarker = false
  3. local isInMarker = false
  4. local isInPublicMarker = false
  5.  
  6. AddEventHandler('esx_jobs:publicTeleports', function(position)
  7. SetEntityCoords(GetPlayerPed(-1), position.x, position.y, position.z)
  8. end)
  9.  
  10.  
  11. -- Show top left hint
  12. Citizen.CreateThread(function()
  13. while true do
  14. Wait(0)
  15. if hintIsShowed == true then
  16. SetTextComponentFormat("STRING")
  17. AddTextComponentString(hintToDisplay)
  18. DisplayHelpTextFromStringLabel(0, 0, 1, -1)
  19. end
  20. end
  21. end)
  22.  
  23. -- Display public markers
  24. Citizen.CreateThread(function()
  25. while true do
  26. Wait(0)
  27. local coords = GetEntityCoords(GetPlayerPed(-1))
  28. for k,v in pairs(Config.PublicZones) do
  29. if(v.Marker ~= -1 and GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.DrawDistance) then
  30. DrawMarker(v.Marker, v.Pos.x, v.Pos.y, v.Pos.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, v.Size.x, v.Size.y, v.Size.z, v.Color.r, v.Color.g, v.Color.b, 100, false, true, 2, false, false, false, false)
  31. end
  32. end
  33. end
  34. end)
  35.  
  36. -- Activate public marker
  37. Citizen.CreateThread(function()
  38. while true do
  39. Wait(0)
  40. local coords = GetEntityCoords(GetPlayerPed(-1))
  41. local position = nil
  42. local zone = nil
  43.  
  44.  
  45. if IsControlJustReleased(0, 38) and isInPublicMarker then
  46. TriggerEvent('esx_jobs:publicTeleports', position)
  47. end
  48.  
  49. for k,v in pairs(Config.PublicZones) do
  50. if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < v.Size.x) then
  51. isInPublicMarker = true
  52. position = v.Teleport
  53. zone = v
  54. break
  55. else
  56. isInPublicMarker = false
  57. end
  58. end
  59.  
  60. -- hide or show top left zone hints
  61. if isInPublicMarker then
  62. hintToDisplay = zone.Hint
  63. hintIsShowed = true
  64. else
  65. if not isInMarker then
  66. hintToDisplay = "No Hint to Display!"
  67. hintIsShowed = false
  68. end
  69. end
  70. end
  71. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement