Advertisement
Guest User

Untitled

a guest
Jan 27th, 2017
1,463
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.33 KB | None | 0 0
  1. -- CONFIG --
  2. local showCompass = true
  3. -- CODE --
  4.  
  5. local lastStreet = nil
  6.  
  7. Citizen.CreateThread(function()
  8.     while true do
  9.         Citizen.Wait(1)
  10.        
  11.         x, y, z = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
  12.         lastStreet = GetStreetNameAtCoord(x, y, z)
  13.         lastStreetName = GetStreetNameFromHashKey(lastStreet)
  14.  
  15.         SetTextFont(0)
  16.         SetTextProportional(1)
  17.         SetTextScale(0.0, 0.55)
  18.         SetTextColour(255, 255, 255, 255)
  19.         SetTextDropshadow(0, 0, 0, 0, 255)
  20.         SetTextEdge(1, 0, 0, 0, 255)
  21.         SetTextDropShadow()
  22.         SetTextOutline()
  23.         SetTextEntry("STRING")
  24.  
  25.         if showCompass then
  26.             compass = getCardinalDirectionFromHeading(GetEntityHeading(GetPlayerPed(-1)))
  27.             lastStreetName = lastStreetName .. " | " .. compass
  28.         end
  29.  
  30.         AddTextComponentString(lastStreetName)
  31.         DrawText(0.015, 0.75)
  32.     end
  33. end)
  34.  
  35. -- Thanks @marxy
  36. function getCardinalDirectionFromHeading(heading)
  37.     if ((heading >= 0 and heading < 45) or (heading >= 315 and heading < 360)) then
  38.         return "North"
  39.     elseif (heading >= 45 and heading < 135) then
  40.         return "East"
  41.     elseif (heading >=135 and heading < 225) then
  42.         return "South"
  43.     elseif (heading >= 225 and heading < 315) then
  44.         return "West"
  45.     end
  46. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement