Advertisement
lowheartrate

oof

May 21st, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 9.93 KB | None | 0 0
  1. function drawTxt(x,y ,width,height,scale, text, r,g,b,a)
  2.     SetTextFont(4)
  3.     SetTextProportional(0)
  4.     SetTextScale(scale, scale)
  5.     SetTextColour(r, g, b, a)
  6.     SetTextDropShadow(0, 0, 0, 0,255)
  7.     SetTextEdge(1, 0, 0, 0, 255)
  8.     SetTextDropShadow()
  9.     SetTextOutline()
  10.     SetTextEntry("STRING")
  11.     AddTextComponentString(text)
  12.     DrawText(x - width/2, y - height/2 + 0.005)
  13. end
  14.  
  15. function drawTxt2(x,y ,width,height,scale, text, r,g,b,a)
  16.     SetTextFont(6)
  17.     SetTextProportional(0)
  18.     SetTextScale(scale, scale)
  19.     SetTextColour(r, g, b, a)
  20.     SetTextDropShadow(0, 0, 0, 0,255)
  21.     SetTextEdge(1, 0, 0, 0, 255)
  22.     SetTextDropShadow()
  23.     SetTextOutline()
  24.     SetTextEntry("STRING")
  25.     AddTextComponentString(text)
  26.     DrawText(x - width/2, y - height/2 + 0.005)
  27. end
  28.  
  29. RegisterNetEvent('normalDisplay')
  30. AddEventHandler('normalDisplay', function()
  31.     if GetStreetNameFromHashKey(var1) and GetNameOfZone(pos.x, pos.y, pos.z) then
  32.         if GetStreetNameFromHashKey(var1) then
  33.             if direction == 'N' then
  34.                     drawTxt(Config.x-0.335, Config.y+0.66, 1.0,1.5,1.4, " | ", Config.border_r, Config.border_g, Config.border_b, Config.border_a)
  35.                     drawTxt(Config.x-0.306, Config.y+0.66, 1.0,1.5,1.4, " | ", Config.border_r, Config.border_g, Config.border_b, Config.border_a)
  36.                     drawTxt(Config.x-0.315, Config.y+0.42, 1.0,1.0,1.0, direction, Config.dir_r, Config.dir_g, Config.dir_b, Config.dir_a)
  37.                 if GetStreetNameFromHashKey(var2) == "" then
  38.                     drawTxt2(Config.x-0.285, Config.y+0.45, 1.0,1.0,0.45, current_zone, Config.town_r, Config.town_g, Config.town_b, Config.town_a)
  39.                 else
  40.                     drawTxt2(Config.x-0.285, Config.y+0.45, 1.0,1.0,0.45, GetStreetNameFromHashKey(var2) .. ", " .. GetLabelText(GetNameOfZone(pos.x, pos.y, pos.z)), Config.str_around_r, Config.str_around_g, Config.Config.str_around_b, Config.str_around_a)
  41.                 end
  42.                     drawTxt2(Config.x-0.285, Config.y+0.42, 1.0,1.0,0.55, GetStreetNameFromHashKey(var1), Config.curr_street_r, Config.curr_street_g, Config.curr_street_b, Config.curr_street_a)
  43.             elseif direction == 'NE' then
  44.                     drawTxt(Config.x-0.335, Config.y+0.66, 1.0,1.5,1.4, " | ", Config.border_r, Config.border_g, Config.border_b, Config.border_a)
  45.                     drawTxt(Config.x-0.298, Config.y+0.66, 1.0,1.5,1.4, " | ", Config.border_r, Config.border_g, Config.border_b, Config.border_a)
  46.                     drawTxt(Config.x-0.315, Config.y+0.42, 1.0,1.0,1.0, direction, Config.dir_r, Config.dir_g, Config.dir_b, Config.dir_a)
  47.                 if GetStreetNameFromHashKey(var2) == "" then
  48.                     drawTxt2(Config.x-0.277, Config.y+0.45, 1.0,1.0,0.45, current_zone, Config.town_r, Config.town_g, Config.town_b, Config.town_a)
  49.                 else
  50.                     drawTxt2(Config.x-0.277, Config.y+0.45, 1.0,1.0,0.45, GetStreetNameFromHashKey(var2) .. ", " .. GetLabelText(GetNameOfZone(pos.x, pos.y, pos.z)), Config.str_around_r, Config.str_around_g, Config.Config.str_around_b, Config.str_around_a)
  51.                 end
  52.                 drawTxt2(Config.x-0.277, Config.y+0.42, 1.0,1.0,0.55, GetStreetNameFromHashKey(var1),Config.curr_street_r, Config.curr_street_g, Config.curr_street_b, Config.curr_street_a)
  53.             elseif direction == 'E' then
  54.                     drawTxt(Config.x-0.335, Config.y+0.66, 1.0,1.5,1.4, " | ", Config.border_r, Config.border_g, Config.border_b, Config.border_a)
  55.                     drawTxt(Config.x-0.309, Config.y+0.66, 1.0,1.5,1.4, " | ", Config.border_r, Config.border_g, Config.border_b, Config.border_a)
  56.                     drawTxt(Config.x-0.315, Config.y+0.42, 1.0,1.0,1.0, direction, Config.dir_r, Config.dir_g, Config.dir_b, Config.dir_a)
  57.                 if GetStreetNameFromHashKey(var2) == "" then
  58.                     drawTxt2(Config.x-0.288, Config.y+0.45, 1.0,1.0,0.45, current_zone, Config.town_r, Config.town_g, Config.town_b, Config.town_a)
  59.                 else
  60.                     drawTxt2(Config.x-0.288, Config.y+0.45, 1.0,1.0,0.45, GetStreetNameFromHashKey(var2) .. ", " .. GetLabelText(GetNameOfZone(pos.x, pos.y, pos.z)), Config.str_around_r, Config.str_around_g, Config.Config.str_around_b, Config.str_around_a)
  61.                 end
  62.                 drawTxt2(Config.x-0.288, Config.y+0.42, 1.0,1.0,0.55, GetStreetNameFromHashKey(var1), Config.curr_street_r, Config.curr_street_g, Config.curr_street_b, Config.curr_street_a)
  63.             elseif direction == 'SE' then
  64.                     drawTxt(Config.x-0.335, Config.y+0.66, 1.0,1.5,1.4, " | ", Config.border_r, Config.border_g, Config.border_b, Config.border_a)
  65.                     drawTxt(Config.x-0.298, Config.y+0.66, 1.0,1.5,1.4, " | ", Config.border_r, Config.border_g, Config.border_b, Config.border_a)
  66.                     drawTxt(Config.x-0.315, Config.y+0.42, 1.0,1.0,1.0, direction, Config.dir_r, Config.dir_g, Config.dir_b, Config.dir_a)
  67.                 if GetStreetNameFromHashKey(var2) == "" then
  68.                     drawTxt2(Config.x-0.275, Config.y+0.45, 1.0,1.0,0.45, current_zone, Config.town_r, Config.town_g, Config.town_b, Config.town_a)
  69.                 else
  70.                     drawTxt2(Config.x-0.275, Config.y+0.45, 1.0,1.0,0.45, GetStreetNameFromHashKey(var2) .. ", " .. GetLabelText(GetNameOfZone(pos.x, pos.y, pos.z)), Config.str_around_r, Config.str_around_g, Config.Config.str_around_b, Config.str_around_a)
  71.                 end
  72.                     drawTxt2(Config.x-0.275, Config.y+0.42, 1.0,1.0,0.55, GetStreetNameFromHashKey(var1), Config.curr_street_r, Config.curr_street_g, Config.curr_street_b, Config.curr_street_a)
  73.             elseif direction == 'S' then
  74.                     drawTxt(Config.x-0.335, Config.y+0.66, 1.0,1.5,1.4, " | ", Config.border_r, Config.border_g, Config.border_b, Config.border_a)
  75.                     drawTxt(Config.x-0.307, Config.y+0.66, 1.0,1.5,1.4, " | ", Config.border_r, Config.border_g, Config.border_b, Config.border_a)
  76.                     drawTxt(Config.x-0.315, Config.y+0.42, 1.0,1.0,1.0, direction, Config.dir_r, Config.dir_g, Config.dir_b, Config.dir_a)
  77.                 if GetStreetNameFromHashKey(var2) == "" then
  78.                     drawTxt2(Config.x-0.285, Config.y+0.45, 1.0,1.0,0.45, current_zone, Config.town_r, Config.town_g, Config.town_b, Config.town_a)
  79.                 else
  80.                     drawTxt2(Config.x-0.285, Config.y+0.45, 1.0,1.0,0.45, GetStreetNameFromHashKey(var2) .. ", " .. GetLabelText(GetNameOfZone(pos.x, pos.y, pos.z)), Config.str_around_r, Config.str_around_g, Config.Config.str_around_b, Config.str_around_a)
  81.                 end
  82.                     drawTxt2(Config.x-0.285, Config.y+0.42, 1.0,1.0,0.55, GetStreetNameFromHashKey(var1), Config.curr_street_r, Config.curr_street_g, Config.curr_street_b, Config.curr_street_a)
  83.             elseif direction == 'SW' then
  84.                     drawTxt(Config.x-0.335, Config.y+0.66, 1.0,1.5,1.4, " | ", Config.border_r, Config.border_g, Config.border_b, Config.border_a)
  85.                     drawTxt(Config.x-0.292, Config.y+0.66, 1.0,1.5,1.4, " | ", Config.border_r, Config.border_g, Config.border_b, Config.border_a)
  86.                     drawTxt(Config.x-0.315, Config.y+0.42, 1.0,1.0,1.0, direction, Config.dir_r, Config.dir_g, Config.dir_b, Config.dir_a)
  87.                 if GetStreetNameFromHashKey(var2) == "" then
  88.                     drawTxt2(Config.x-0.270, Config.y+0.45, 1.0,1.0,0.45, current_zone, Config.town_r, Config.town_g, Config.town_b, Config.town_a)
  89.                 else
  90.                     drawTxt2(Config.x-0.270, Config.y+0.45, 1.0,1.0,0.45, GetStreetNameFromHashKey(var2) .. ", " .. GetLabelText(GetNameOfZone(pos.x, pos.y, pos.z)), Config.str_around_r, Config.str_around_g, Config.Config.str_around_b, Config.str_around_a)
  91.                 end
  92.                     drawTxt2(Config.x-0.270, Config.y+0.42, 1.0,1.0,0.55, GetStreetNameFromHashKey(var1), Config.curr_street_r, Config.curr_street_g, Config.curr_street_b, Config.curr_street_a)
  93.             elseif direction == 'W' then
  94.                     drawTxt(Config.x-0.335, Config.y+0.66, 1.0,1.5,1.4, " | ", Config.border_r, Config.border_g, Config.border_b, Config.border_a)
  95.                     drawTxt(Config.x-0.303, Config.y+0.66, 1.0,1.5,1.4, " | ", Config.border_r, Config.border_g, Config.border_b, Config.border_a)
  96.                     drawTxt(Config.x-0.315, Config.y+0.42, 1.0,1.0,1.0, direction, Config.dir_r, Config.dir_g, Config.dir_b, Config.dir_a)
  97.                 if GetStreetNameFromHashKey(var2) == "" then
  98.                     drawTxt2(Config.x-0.280, Config.y+0.45, 1.0,1.0,0.45, current_zone, Config.town_r, Config.town_g, Config.town_b, Config.town_a)
  99.                 else
  100.                     drawTxt2(Config.x-0.280, Config.y+0.45, 1.0,1.0,0.45, GetStreetNameFromHashKey(var2) .. ", " .. GetLabelText(GetNameOfZone(pos.x, pos.y, pos.z)), Config.str_around_r, Config.str_around_g, Config.Config.str_around_b, Config.str_around_a)
  101.                 end
  102.                     drawTxt2(Config.x-0.280, Config.y+0.42, 1.0,1.0,0.55, GetStreetNameFromHashKey(var1), Config.curr_street_r, Config.curr_street_g, Config.curr_street_b, Config.curr_street_a)
  103.  
  104. elseif direction == 'NW' then
  105.     drawTxt(Config.x-0.335, Config.y+0.66,1.0, 1.5, 1.4, " | ", Config.border_r, Config.border_g, Config.border_b, Config.border_a)
  106.     drawTxt(Config.Config.x-0.290, Config.y+0.66,1.0, 1.5, 1.4, " | ", Config.border_r, Config.border_g, Config.border_b, Config.border_a)
  107.     drawTxt(Config.Config.x-0.315, Config.y+0.42, 1.0,1.0,1.0, direction, Config.dir_r, Config.dir_g, Config.dir_b, Config.dir_a)
  108.    
  109.    
  110.     if GetStreetNameFromHashKey(var2) == "" then
  111.         drawTxt2(Config.x-0.266, Config.y+0.45, 1.0,1.0,0.45, current_zone, Config.town_r, Config.town_g, Config.town_b, Config.town_a)
  112.     else
  113.         drawTxt2(Config.x-0.266, Config.y+0.45, 1.0,1.0,0.45, GetStreetNameFromHashKey(var2) .. ", " .. GetLabelText(GetNameOfZone(pos.x, pos.y, pos.z)), Config.str_around_r, Config.str_around_g, Config.Config.str_around_b, Config.str_around_a)
  114.     end
  115.    
  116.     drawTxt2(Config.x-0.266, Config.y+0.42, 1.0,1.0,0.55, GetStreetNameFromHashKey(var1), Config.curr_street_r, Config.curr_street_g, Config.curr_street_b, Config.curr_street_a)
  117. end
  118.         end
  119.     end
  120. end)
  121.  
  122. directions = { [0] = 'N', [45] = 'NW', [90] = 'W', [135] = 'SW', [180] = 'S', [225] = 'SE', [270] = 'E', [315] = 'NE', [360] = 'N', }
  123.  
  124. if Config.Display == 'normal' then
  125.     Citizen.CreateThread(function()
  126.         while true do
  127.             Citizen.Wait(10)
  128.             pos = GetEntityCoords(PlayerPedId())
  129.             var1, var2 = GetStreetNameAtCoord(pos.x, pos.y, pos.z, Citizen.ResultAsInteger(), Citizen.ResultAsInteger())
  130.             current_zone = GetLabelText(GetNameOfZone(pos.x, pos.y, pos.z))
  131.             for k,v in pairs(directions)do
  132.                 direction = GetEntityHeading(PlayerPedId())
  133.                 if(math.abs(direction - k) < 22.5)then
  134.                     direction = v
  135.                     break
  136.                 end
  137.             end
  138.         end
  139.     end)
  140.     Citizen.CreateThread(function()
  141.         while true do
  142.             Citizen.Wait(1)
  143.             TriggerEvent('normalDisplay')
  144.         end
  145.     end)
  146.    
  147. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement