Advertisement
Guest User

Untitled

a guest
May 20th, 2017
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 17.76 KB | None | 0 0
  1. -- v0.3
  2. -- misspellings  fixed
  3. -- Blip fixed
  4. -- added testingmission
  5. -- better button selection (slower)
  6. local Keys = {
  7.     ["ESC"] = 322, ["F1"] = 288, ["F2"] = 289, ["F3"] = 170, ["F5"] = 166, ["F6"] = 167, ["F7"] = 168, ["F8"] = 169, ["F9"] = 56, ["F10"] = 57,
  8.     ["~"] = 243, ["1"] = 157, ["2"] = 158, ["3"] = 160, ["4"] = 164, ["5"] = 165, ["6"] = 159, ["7"] = 161, ["8"] = 162, ["9"] = 163, ["-"] = 84, ["="] = 83, ["BACKSPACE"] = 177,
  9.     ["TAB"] = 37, ["Q"] = 44, ["W"] = 32, ["E"] = 38, ["R"] = 45, ["T"] = 245, ["Y"] = 246, ["U"] = 303, ["P"] = 199, ["["] = 39, ["]"] = 40, ["ENTER"] = 18,
  10.     ["CAPS"] = 137, ["A"] = 34, ["S"] = 8, ["D"] = 9, ["F"] = 23, ["G"] = 47, ["H"] = 74, ["K"] = 311, ["L"] = 182,
  11.     ["LEFTSHIFT"] = 21, ["Z"] = 20, ["X"] = 73, ["C"] = 26, ["V"] = 0, ["B"] = 29, ["N"] = 249, ["M"] = 244, [","] = 82, ["."] = 81,
  12.     ["LEFTCTRL"] = 36, ["LEFTALT"] = 19, ["SPACE"] = 22, ["RIGHTCTRL"] = 70,
  13.     ["HOME"] = 213, ["PAGEUP"] = 10, ["PAGEDOWN"] = 11, ["DELETE"] = 178,
  14.     ["LEFT"] = 174, ["RIGHT"] = 175, ["TOP"] = 27, ["DOWN"] = 173,
  15.     ["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118
  16. }
  17.  
  18. --use this for debugging
  19. function Chat(t)
  20.     TriggerEvent("chatMessage", 'TRUCKER', { 0, 255, 255}, "" .. tostring(t))
  21. end
  22.  
  23. --locations
  24. --arrays
  25. local TruckingCompany = {}
  26. TruckingCompany[0] = {["x"] = -7.100,["y"] = -0.300, ["z"] = 73.077}
  27. local TruckingTrailer = {}
  28. TruckingTrailer[0] = {["x"] = 39.822, ["y"] = 25.884, ["z"] = 72.00}
  29.  
  30. local Truck = {"HAULER", "PACKER", "PHANTOM"}
  31. local Trailer = {"TANKER", "TRAILERS", "TRAILERS2", "TRAILERLOGS"}
  32.  
  33. local MissionData = {
  34.     [0] = {1212.4463, 2667.4351, 38.79, 5000}, --x,y,z,money
  35.     [1] = {2574.5144, 328.5554, 108.45, 6000},
  36.     [2] = {-2565.0894, 2345.8904, 33.06, 8000},
  37.     [3] = {1706.7966, 4943.9897, 42.16, 10000},
  38.     [4] = {196.5617, 6631.0967, 31.53, 12000},
  39. }
  40. local MISSION = {}
  41. MISSION.start = false
  42. MISSION.tailer = false
  43. MISSION.truck = false
  44.  
  45. MISSION.hashTruck = 0
  46. MISSION.hashTrailer = 0
  47.  
  48. local currentMission = -1
  49.  
  50. local playerCoords
  51. local playerPed
  52.  
  53. local GUI = {}
  54. GUI.loaded          = false
  55. GUI.showStartText   = false
  56. GUI.showMenu        = false
  57. GUI.selected        = {}
  58. GUI.menu            = -1 --current menu
  59.  
  60. GUI.title           = {}
  61. GUI.titleCount      = 0
  62.  
  63. GUI.desc            = {}
  64. GUI.descCount       = 0
  65.  
  66. GUI.button          = {}
  67. GUI.buttonCount     = 0
  68.  
  69. GUI.time            = 0
  70.  
  71. --text for mission
  72. local text1 = false
  73. local text2 = false
  74.  
  75. --blips
  76. local BLIP = {}
  77.  
  78. BLIP.company = 0
  79.  
  80. BLIP.trailer = {}
  81. BLIP.trailer.i = 0
  82.  
  83. BLIP.destination = {}
  84. BLIP.destination.i = 0
  85.  
  86. --focus button color
  87. local r = 0
  88. local g= 128
  89. local b = 192
  90. local alpha = 200
  91.  
  92. function clear()    
  93.     MISSION.start = false
  94.     SetBlipRoute(BLIP.destination[BLIP.destination.i], false)
  95.     SetEntityAsNoLongerNeeded(BLIP.destination[BLIP.destination.i])
  96.    
  97.     if ( DoesEntityExist(MISSION.trailer) ) then
  98.          SetEntityAsNoLongerNeeded(MISSION.trailer)
  99.     end
  100.     if ( DoesEntityExist(MISSION.truck) ) then
  101.          SetEntityAsNoLongerNeeded(MISSION.truck)
  102.          SetVehicleDoorsLocked(MISSION.truck, 2)
  103.          SetVehicleUndriveable(MISSION.truck, true)
  104.     end
  105.     Citizen.InvokeNative(0xEA386986E786A54F, Citizen.PointerValueIntInitialized(MISSION.trailer))
  106.     Citizen.InvokeNative(0xEA386986E786A54F, Citizen.PointerValueIntInitialized(MISSION.truck))
  107.  
  108.     MISSION.trailer = 0
  109.     MISSION.truck = 0
  110.     MISSION.hashTruck = 0
  111.     MISSION.hashTrailer = 0
  112.     currentMission = -1
  113. end
  114.  
  115. local initload = false
  116. Citizen.CreateThread(function()
  117.     while true do
  118.        Wait(0)
  119.        playerPed = GetPlayerPed(-1)
  120.        playerCoords = GetEntityCoords(playerPed, 0)
  121.         if (not initload) then
  122.             init()
  123.             initload = true
  124.         end
  125.         tick()
  126.     end
  127.    
  128. end)
  129.  
  130. function init()
  131.     BLIP.company = AddBlipForCoord(TruckingCompany[0]["x"], TruckingCompany[0]["y"], TruckingCompany[0]["z"])
  132.     SetBlipSprite(BLIP.company, 67)
  133.     SetBlipDisplay(BLIP.company, 4)
  134.     SetBlipScale(BLIP.company, 0.8)
  135.     Citizen.Trace("Trucker Woke up")
  136.    -- GUI.loaded = true
  137. end
  138.  
  139. --Draw Text / Menus
  140. function tick()
  141.    
  142.     --debugging stange things
  143.     if ( type(BLIP.trailer[BLIP.trailer.i]) == "boolean" ) then
  144.         --Citizen.Trace("-FAIL!-")
  145.     elseif( BLIP.trailer[BLIP.trailer.i] == nil ) then
  146.         --Citizen.Trace("-nil-")
  147.     else
  148.        BLIP.trailer[BLIP.trailer.i] = BLIP.trailer[BLIP.trailer.i]
  149.        BLIP.destination[BLIP.destination.i] = BLIP.destination[BLIP.destination.i]
  150.     end
  151.    
  152.    
  153.     --Show menu, when player is near
  154.     if( MISSION.start == false) then
  155.     if( GetDistanceBetweenCoords( playerCoords, TruckingCompany[0]["x"], TruckingCompany[0]["y"], TruckingCompany[0]["z"] ) < 10) then
  156.             if(GUI.showStartText == false) then
  157.                 GUI.drawStartText()
  158.             end
  159.                 --key controlling
  160.                 if(IsControlPressed(1, Keys["N+"]) and GUI.showMenu == false) then
  161.                     --clear()
  162.                     GUI.showMenu = true
  163.                     GUI.menu = 0
  164.                 end
  165.                 if(IsControlPressed(1, Keys["N-"]) and GUI.showMenu == true) then
  166.                     GUI.showMenu = false
  167.                 end
  168.             else
  169.                 GUI.showStartText = false
  170.         end --if GetDistanceBetweenCoords ...
  171.  
  172.         --menu
  173.         if( GUI.loaded == false ) then
  174.             GUI.init()
  175.         end
  176.  
  177.         if( GUI.showMenu == true and GUI.menu ~= -1) then
  178.             if( GUI.time == 0) then
  179.                 GUI.time = GetGameTimer()
  180.             end
  181.             if( (GetGameTimer() - GUI.time) > 10) then
  182.                 GUI.updateSelectionMenu(GUI.menu)
  183.                 GUI.time = 0
  184.             end
  185.             GUI.renderMenu(GUI.menu)
  186.         end --if GUI.loaded == false
  187.     elseif( MISSION.start == true ) then
  188.        
  189.         MISSION.markerUpdate(IsEntityAttached(MISSION.trailer))
  190.         if( IsEntityAttached(MISSION.trailer) and text1 == false) then
  191.             TriggerEvent("mt:missiontext", "Drive to the marked ~g~destination~w~.", 10000)
  192.             text1 = true
  193.         elseif( not IsEntityAttached(MISSION.trailer) and text2 == false ) then
  194.             TriggerEvent("mt:missiontext", "Get your ~o~trailer~w~.", 15000)
  195.             text2 = true
  196.         end
  197.         Wait(2000)
  198.         local trailerCoords = GetEntityCoords(MISSION.trailer, 0)
  199.         if ( GetDistanceBetweenCoords(currentMission[1], currentMission[2], currentMission[3], trailerCoords ) < 25 and  not IsEntityAttached(MISSION.trailer)) then
  200.             TriggerEvent("mt:missiontext", "You earned $"..currentMission[4], 5000)
  201.             MISSION.removeMarker()
  202.             TriggerServerEvent('truckerJob:success',currentMission[4])
  203.             clear()
  204.         elseif ( GetDistanceBetweenCoords(currentMission[1], currentMission[2], currentMission[3], trailerCoords ) < 25 and IsEntityAttached(MISSION.trailer) ) then
  205.             TriggerEvent("mt:missiontext", "You have arrived. Press ~r~H~w~ to detach the trailer", 15000)
  206.         end
  207.        
  208.         if ( IsEntityDead(MISSION.trailer) or IsEntityDead(MISSION.truck) ) then
  209.             MISSION.removeMarker()
  210.             clear()
  211.         end
  212.     end --if MISSION.start == false
  213. end
  214.  
  215.  
  216.  
  217. ---------------------------------------
  218. ---------------------------------------
  219. ---------------------------------------
  220. ----------------MISSON-----------------
  221. ---------------------------------------  
  222. ---------------------------------------  
  223. ---------------------------------------
  224. function GUI.optionMisson(trailerN)
  225.    
  226.     --select trailer
  227.     MISSION.hashTrailer = GetHashKey(Trailer[trailerN + 1])
  228.     RequestModel(MISSION.hashTrailer)
  229.    
  230.     while not HasModelLoaded(MISSION.hashTrailer) do
  231.         Wait(1)
  232.     end
  233.    
  234.     --select random truck
  235.     local randomTruck = GetRandomIntInRange(1, #Truck)
  236.    
  237.     MISSION.hashTruck = GetHashKey(Truck[randomTruck])
  238.     RequestModel(MISSION.hashTruck)
  239.    
  240.     while not HasModelLoaded(MISSION.hashTruck) do
  241.         Wait(1)
  242.     end
  243. end
  244.  
  245. function GUI.mission(missionN)
  246.     --currently one destination per ride
  247.     BLIP.trailer.i = BLIP.trailer.i + 1
  248.     BLIP.destination.i = BLIP.destination.i + 1
  249.     currentMission = MissionData[missionN]
  250.     GUI.showMenu = false
  251.     --mission start
  252.     MISSION.start = true
  253.     MISSION.spawnTrailer()
  254.     MISSION.spawnTruck()    
  255. end
  256.  
  257. function MISSION.spawnTruck()
  258.    
  259.     MISSION.truck = CreateVehicle(MISSION.hashTruck, 12.1995, -1.174761, 73.000, 0.0, true, false)
  260.     SetVehicleOnGroundProperly(MISSION.trailer)
  261.     SetVehicleNumberPlateText(MISSION.truck, "M15510")
  262.     SetVehRadioStation(MISSION.truck, "OFF")
  263.     SetPedIntoVehicle(playerPed, MISSION.truck, -1)
  264.     SetVehicleEngineOn(MISSION.truck, true, false, false)
  265.    
  266.     --important
  267.     --SetEntityAsMissionEntity(MISSION.truck, true, true);
  268. end
  269.  
  270. function MISSION.spawnTrailer()
  271.     MISSION.trailer = CreateVehicle(MISSION.hashTrailer, TruckingTrailer[0]["x"], TruckingTrailer[0]["y"], TruckingTrailer[0]["z"], 0.0, true, false)
  272.     SetVehicleOnGroundProperly(MISSION.trailer)
  273.    
  274.     --setMarker on trailer
  275.     MISSION.trailerMarker()
  276. end
  277.  
  278. local oneTime = false
  279.  
  280. function MISSION.trailerMarker()
  281.     --BLIP.trailer.i = BLIP.trailer.i + 1 this happens in GUI.mission()
  282.     BLIP.trailer[BLIP.trailer.i] = AddBlipForEntity(MISSION.trailer)
  283.     SetBlipSprite(BLIP.trailer[BLIP.trailer.i], 1)
  284.     SetBlipColour(BLIP.trailer[BLIP.trailer.i], 17)
  285.     SetBlipRoute(BLIP.trailer[BLIP.trailer.i], false)
  286.     Wait(50)
  287. end
  288.  
  289. function MISSION.markerUpdate(trailerAttached)
  290.     if( not BLIP.destination[BLIP.destination.i] and trailerAttached) then
  291.        -- BLIP.destination.i = BLIP.destination.i + 1 this happens in GUI.mission()
  292.         BLIP.destination[BLIP.destination.i]  = AddBlipForCoord(currentMission[1], currentMission[2], currentMission[3])
  293.         SetBlipSprite(BLIP.destination[BLIP.destination.i], 1)
  294.         SetBlipColour(BLIP.destination[BLIP.destination.i], 2)
  295.         SetBlipRoute(BLIP.destination[BLIP.destination.i], true)
  296.     end
  297.     if( trailerAttached ) then
  298.         SetBlipSprite(BLIP.trailer[BLIP.trailer.i], 2) --invisible
  299.     elseif ( not trailerAttached and BLIP.trailer[BLIP.trailer.i]) then
  300.         SetBlipSprite(BLIP.trailer[BLIP.trailer.i], 1) --visible
  301.         SetBlipColour(BLIP.trailer[BLIP.trailer.i], 17)
  302.     end
  303.     Wait(50)
  304. end
  305.  
  306. function MISSION.removeMarker()
  307.     SetBlipSprite(BLIP.destination[BLIP.destination.i], 2)--invisible
  308.     SetBlipSprite(BLIP.trailer[BLIP.trailer.i], 2) --invisible
  309. end
  310.  
  311. function MISSION.getMoney()
  312.    TriggerEvent("es:addedMoney", currentMission[4])
  313.     TriggerEvent("truckerJob:getMoney", currentMission[4])
  314. end
  315. ---------------------------------------
  316. ---------------------------------------
  317. ---------------------------------------
  318. -----------------MENU------------------
  319. ---------------------------------------  
  320. ---------------------------------------  
  321. ---------------------------------------
  322. function GUI.drawStartText()
  323.     TriggerEvent("mt:missiontext", "Press ~r~Numpad+~w~ to open the menu.", 500)
  324.     --GUI.showStartText = true
  325. end
  326.  
  327. function GUI.renderMenu(menu)
  328.     GUI.renderTitle()
  329.     GUI.renderDesc()
  330.     GUI.renderButtons(menu)
  331. end
  332.  
  333. function GUI.init()
  334.     GUI.loaded = true
  335.     GUI.addTitle("", 0.425, 0.19, 0.45, 0.07 )
  336.     GUI.addDesc("Pick a Trailer.", 0.575, 0.375, 0.15, 0.30 )
  337.  
  338.     --menu, title, function, position
  339.     GUI.addButton(0, "RON trailer", GUI.optionMisson, 0.35, 0.25, 0.3, 0.05 )
  340.     GUI.addButton(0, "Container trailer", GUI.optionMisson, 0.35, 0.30, 0.3, 0.05 )
  341.     GUI.addButton(0, "Articulated trailer", GUI.optionMisson, 0.35, 0.35, 0.3, 0.05 )
  342.     GUI.addButton(0, "Wood trailer", GUI.optionMisson, 0.35, 0.40, 0.3, 0.05 )
  343.     GUI.addButton(0, "Exit Menu", GUI.exit, 0.35, 0.50, 0.3, 0.05 )
  344.    
  345.     GUI.buttonCount = 0
  346.    
  347.     GUI.addButton(1, "Mission 1 [ 5.000 ]", GUI.mission, 0.35, 0.25, 0.3, 0.05)
  348.     GUI.addButton(1, "Mission 2 [ 6.000 ]", GUI.mission, 0.35, 0.30, 0.3, 0.05)
  349.     GUI.addButton(1, "Mission 3 [ 8.000 ]", GUI.mission, 0.35, 0.35, 0.3, 0.05)
  350.     GUI.addButton(1, "Mission 4 [ 10.000 ]", GUI.mission, 0.35, 0.40, 0.3, 0.05)
  351.     GUI.addButton(1, "Mission 5 [ 12.000 ]", GUI.mission, 0.35, 0.45, 0.3, 0.05)
  352.     GUI.addButton(0, " ", GUI.null, 0.35, 0.45, 0.3, 0.05)
  353.     GUI.addButton(1, "Exit Menu", GUI.exit, 0.35, 0.55, 0.3, 0.05)
  354. end
  355.  
  356. --Render stuff
  357. function GUI.renderTitle()
  358.     for id, settings in pairs(GUI.title) do
  359.         local screen_w = 0
  360.         local screen_h = 0
  361.         screen_w, screen_h = GetScreenResolution(0,0)
  362.         boxColor = {0,0,0,255}
  363.         SetTextFont(0)
  364.         SetTextScale(0.0, 0.40)
  365.         SetTextColour(255, 255, 255, 255)
  366.         SetTextCentre(true)
  367.         SetTextDropshadow(0, 0, 0, 0, 0)
  368.         SetTextEdge(0, 0, 0, 0, 0)
  369.         SetTextEntry("STRING")
  370.         AddTextComponentString(settings["name"])
  371.         DrawText((settings["xpos"] + 0.001), (settings["ypos"] - 0.015))
  372.         --AddTextComponentString(settings["name"])
  373.         GUI.renderBox(
  374.             settings["xpos"], settings["ypos"], settings["xscale"], settings["yscale"],
  375.             boxColor[1], boxColor[2], boxColor[3], boxColor[4]
  376.         )
  377.     end
  378. end
  379.  
  380. function GUI.renderDesc()
  381.         for id, settings in pairs(GUI.desc) do
  382.         local screen_w = 0
  383.         local screen_h = 0
  384.         screen_w, screen_h =  GetScreenResolution(0, 0)
  385.         boxColor = {0,0,0,240}
  386.         SetTextFont(0)
  387.         SetTextScale(0.0, 0.37)
  388.         SetTextColour(255, 255, 255, 255)
  389.         SetTextDropShadow(0, 0, 0, 0, 0)
  390.         SetTextEdge(0, 0, 0, 0, 0)
  391.         SetTextEntry("STRING")
  392.         AddTextComponentString(settings["name"] .. "\n" .."\n" .."Navigate with" .. "\n" .. "arrows." .. "\n" .. "ENTER to Select".. "\n" .."Hold H to Detach" .. "\n" .. "Trailer")
  393.         DrawText((settings["xpos"] - 0.06), (settings["ypos"] - 0.13))
  394.         AddTextComponentString(settings["name"])
  395.         GUI.renderBox(
  396.             settings["xpos"], settings["ypos"], settings["xscale"], settings["yscale"],
  397.             boxColor[1], boxColor[2], boxColor[3], boxColor[4]
  398.         )
  399.         end
  400. end
  401.  
  402. function GUI.renderButtons(menu)
  403.     for id, settings in pairs(GUI.button[menu]) do
  404.         local screen_w = 0
  405.         local screen_h = 0
  406.         screen_w, screen_h =  GetScreenResolution(0, 0)
  407.         boxColor = {0,0,0,100}
  408.         if(settings["active"]) then
  409.             boxColor = {r,g,b,alpha}
  410.         end
  411.         SetTextFont(0)
  412.         SetTextScale(0.0, 0.35)
  413.         SetTextColour(255, 255, 255, 255)
  414.         SetTextCentre(true)
  415.         SetTextDropShadow(0, 0, 0, 0, 0)
  416.         SetTextEdge(0, 0, 0, 0, 0)
  417.         SetTextEntry("STRING")
  418.         AddTextComponentString(settings["name"])
  419.         DrawText((settings["xpos"] + 0.001), (settings["ypos"] - 0.015))
  420.         --AddTextComponentString(settings["name"])
  421.         GUI.renderBox(
  422.             settings["xpos"], settings["ypos"], settings["xscale"],
  423.             settings["yscale"], boxColor[1], boxColor[2], boxColor[3], boxColor[4]
  424.         )
  425.      end    
  426. end
  427.  
  428. function GUI.renderBox(xpos, ypos, xscale, yscale, color1, color2, color3, color4)
  429.     DrawRect(xpos, ypos, xscale, yscale, color1, color2, color3, color4);
  430. end
  431.  
  432. --adding stuff
  433. function GUI.addTitle(name, xpos, ypos, xscale, yscale)
  434.     GUI.title[GUI.titleCount] = {}
  435.     GUI.title[GUI.titleCount]["name"] = name
  436.     GUI.title[GUI.titleCount]["xpos"] = xpos
  437.     GUI.title[GUI.titleCount]["ypos"] = ypos    
  438.     GUI.title[GUI.titleCount]["xscale"] = xscale
  439.     GUI.title[GUI.titleCount]["yscale"] = yscale
  440. end
  441.  
  442. function GUI.addDesc(name, xpos, ypos, xscale, yscale)
  443.     GUI.desc[GUI.descCount] = {}
  444.     GUI.desc[GUI.descCount]["name"] = name
  445.     GUI.desc[GUI.descCount]["xpos"] = xpos
  446.     GUI.desc[GUI.descCount]["ypos"] = ypos  
  447.     GUI.desc[GUI.descCount]["xscale"] = xscale
  448.     GUI.desc[GUI.descCount]["yscale"] = yscale
  449. end
  450.  
  451. function GUI.addButton(menu, name, func, xpos, ypos, xscale, yscale)
  452.     if(not GUI.button[menu]) then
  453.         GUI.button[menu] = {}
  454.         GUI.selected[menu] = 0
  455.     end
  456.     GUI.button[menu][GUI.buttonCount] = {}
  457.     GUI.button[menu][GUI.buttonCount]["name"] = name
  458.     GUI.button[menu][GUI.buttonCount]["func"] = func
  459.     GUI.button[menu][GUI.buttonCount]["xpos"] = xpos
  460.     GUI.button[menu][GUI.buttonCount]["ypos"] = ypos    
  461.     GUI.button[menu][GUI.buttonCount]["xscale"] = xscale
  462.     GUI.button[menu][GUI.buttonCount]["yscale"] = yscale
  463.     GUI.button[menu][GUI.buttonCount]["active"] = 0
  464.     GUI.buttonCount = GUI.buttonCount + 1
  465. end
  466.  
  467. function GUI.null()
  468. end
  469.  
  470. function GUI.exit()
  471.     GUI.showMenu = false
  472.     print("Exit menu")
  473. end
  474.  
  475. --update stuff
  476. function GUI.updateSelectionMenu(menu)
  477.     if( IsControlPressed(0, Keys["DOWN"]) ) then
  478.         if( GUI.selected[menu] < #GUI.button[menu] ) then
  479.             GUI.selected[menu] = GUI.selected[menu] + 1
  480.         end
  481.     elseif( IsControlPressed(0, Keys["TOP"]) ) then
  482.         if( GUI.selected[menu] > 0 ) then
  483.             GUI.selected[menu] = GUI.selected[menu] - 1
  484.         end
  485.     elseif( IsControlPressed(0, Keys["ENTER"]) ) then
  486.         if( type(GUI.button[menu][GUI.selected[menu]]["func"]) == "function" ) then
  487.             --remember variable GUI.selected[menu]
  488.            
  489.             --call mission functions
  490.             GUI.button[menu][GUI.selected[menu]]["func"](GUI.selected[menu])
  491.            
  492.             GUI.menu = 1
  493.             GUI.selected[menu] = 0
  494.             if( not GUI.menu ) then
  495.                 GUI.menu = -1
  496.             end
  497.             Wait(100)
  498.            
  499.             --GUI.button[menu][GUI.selected[menu]]["func"](GUI.selected[menu])
  500.         else
  501.             Citizen.Trace("\n Failes to call function! - Selected Menu: "..GUI.selected[menu].." \n")
  502.         end
  503.         GUI.time = 0
  504.     end
  505.     local i = 0
  506.     for id, settings in ipairs(GUI.button[menu]) do
  507.         GUI.button[menu][i]["active"] = false
  508.         if( i == GUI.selected[menu] ) then
  509.             GUI.button[menu][i]["active"] = true
  510.         end
  511.         i = i + 1
  512.     end
  513. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement