Advertisement
Guest User

Untitled

a guest
Nov 25th, 2016
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.91 KB | None | 0 0
  1. ui_timetosave = 5000 -- Time to save after a setting gets changed, get's reset if another setting gets saved in the same time, see saveTime() --
  2.  
  3. Exp_Funct = { -- Exported functions
  4. ["trafficsensor"] = {
  5. res = "race_traffic_sensor",
  6. ["true"] = 'exports["race_traffic_sensor"].showTrafficSensor()',
  7. ["false"] = 'exports["race_traffic_sensor"].hideTrafficSensor()'},
  8.  
  9. ["checkpointdelay"] = {
  10. res = "race_delay_indicator",
  11. ["true"] = 'exports["race_delay_indicator"].showCPDelays()',
  12. ["false"] = 'exports["race_delay_indicator"].hideCPDelays()'},
  13.  
  14. ["chatbubbles"] = {
  15. res = "chaticon",
  16. ["true"] = 'exports["chaticon"].showChaticon()',
  17. ["false"] = 'exports["chaticon"].hideChaticon()'},
  18.  
  19. ["floatingmessages"] = {
  20. res = "messages",
  21. ["true"] = 'exports["messages"].showFloatMessages()',
  22. ["false"] ='exports["messages"].hideFloatMessages()'},
  23.  
  24. ["timeleft"] = {
  25. ["true"] = 'timeleft_on()',
  26. ["false"] = 'timeleft_off()'},
  27.  
  28. ["fpscounter"] = {
  29. res = "fpstabandonscreen",
  30. ["true"] = 'exports["fpstabandonscreen"].e_showFPS()',
  31. ["false"] = 'exports["fpstabandonscreen"].e_hideFPS()'},
  32.  
  33. ["customnametags"] = {
  34. ["true"] = 'CustomNameTags_on',
  35. ["false"] = 'CustomNameTags_off'},
  36.  
  37. ["speed-o-metermode"] = {
  38. res = "digitalspeedometer",
  39. [1] = 'exports["digitalspeedometer"].setKMH()',
  40. [2] = 'exports["digitalspeedometer"].setMPH()',
  41. [3] = 'exports["digitalspeedometer"].setNone()'},
  42.  
  43. ["hudmode"] = {
  44. res = "racesphud",
  45. [1] = 'exports["racesphud"].e_showNewhud()',
  46. [2] = 'exports["racesphud"].e_showSPhud()',
  47. [3] = 'exports["racesphud"].e_showOldhud()'},
  48.  
  49. ["speclist"] = {
  50. res = "spectatorslist",
  51. ["true"] = 'exports["spectatorslist"].specliston()',
  52. ["false"] = 'exports["spectatorslist"].speclistoff()'},
  53.  
  54. ["zonename"] = {
  55. res = "showarea",
  56. ["true"] = 'exports["showarea"].zoneon()',
  57. ["false"] = 'exports["showarea"].zoneoff()'},
  58.  
  59. ["coins"] = {
  60. res = "scoringsystem",
  61. ["true"] = 'exports["scoringsystem"].showcoins()',
  62. ["false"] = 'exports["scoringsystem"].hidecoins()'},
  63.  
  64. ["gear"] = {
  65. res = "gearsdisplay",
  66. ["true"] = 'exports["gearsdisplay"].gearon()',
  67. ["false"] = 'exports["gearsdisplay"].gearoff()'},
  68.  
  69. ["clockdate"] = {
  70. res = "realtimeanddate",
  71. ["true"] = 'exports["realtimeanddate"].showtimedate()',
  72. ["false"] = 'exports["realtimeanddate"].hidetimedate()'},
  73.  
  74. ["players"] = {
  75. res = "onlineplayers",
  76. ["true"] = 'exports["onlineplayers"].showplayers()',
  77. ["false"] = 'exports["onlineplayers"].hideplayers()'},
  78.  
  79. ["playerpos"] = {
  80. res = "playerposition",
  81. ["true"] = 'exports["playerposition"].showpos()',
  82. ["false"] = 'exports["playerposition"].hidepos()'},
  83.  
  84. ["nextmap"] = {
  85. res = "nextmap",
  86. ["true"] = 'exports["nextmap"].shownextmap()',
  87. ["false"] = 'exports["nextmap"].hidenextmap()'},
  88.  
  89. ["siteinfo"] = {
  90. res = "siteinfo",
  91. ["true"] = 'exports["siteinfo"].showinfo()',
  92. ["false"] = 'exports["siteinfo"].hideinfo()'},
  93.  
  94. ["top1bar"] = {
  95. res = "race_toptimes",
  96. ["true"] = 'exports["race_toptimes"].showtopbar()',
  97. ["false"] = 'exports["race_toptimes"].hidetopbar()'},
  98.  
  99. ["classicprogressbar"] = {
  100. res = "raceprogressbar",
  101. ["true"] = 'exports["raceprogressbar"].onswitch()',
  102. ["false"] = 'exports["raceprogressbar"].offswitch()'},
  103.  
  104. ["modernprogressbar"] = {
  105. res = "race",
  106. ["true"] = 'exports["race"].shownewbar()',
  107. ["false"] = 'exports["race"].hidenewbar()'},
  108.  
  109. ["gtavradar"] = {
  110. res = "gtavradar",
  111. ["true"] = 'exports["gtavradar"].radaron()',
  112. ["false"] = 'exports["gtavradar"].radaroff()'},
  113.  
  114. }
  115.  
  116. -- Reapply settings when one of these resources (re)starts
  117. local UI_reApplyTimer = false
  118. -- Add resource name here when used
  119. local resetResource = {"race_sphud","speed-o-meter","fpstabandonscreen","race_sphud","messages","gus","race_delay_indicator","mapratings","race_traffic_sensor","race_rank","race"}
  120. addEventHandler("onClientResourceStart",root,
  121. function(res)
  122. local resName = getResourceName(res)
  123. for _,rn in ipairs(resetResource) do
  124. if rn == resName then
  125. -- Timer system so no settings spam
  126. if isTimer(UI_reApplyTimer) then killTimer(UI_reApplyTimer) end
  127. UI_reApplyTimer = setTimer(function() updateUIgui() executeHUDSettings() end,5000,1)
  128. break
  129. end
  130. end
  131. end
  132. )
  133.  
  134.  
  135. UI = { -- Default settings--
  136. ["trafficsensor"] = true ,
  137. ["checkpointdelay"] = true ,
  138. ["chatbubbles"] = true ,
  139. ["floatingmessages"] = true ,
  140. ["fpscounter"] = true ,
  141. ["customnametags"] = true ,
  142. ["speed-o-metermode"] = 1 ,
  143. ["hudmode"] = 1 ,
  144. ["timeleft"] = true ,
  145. ["speclist"] = true ,
  146. ["zonename"] = true ,
  147. ["coins"] = true ,
  148. ["gear"] = true ,
  149. ["clockdate"] = true ,
  150. ["players"] = true ,
  151. ["playerpos"] = true ,
  152. ["nextmap"] = true ,
  153. ["siteinfo"] = true ,
  154. ["top1bar"] = true ,
  155. ["classicprogressbar"] = true ,
  156. ["modernprogressbar"] = true ,
  157. ["gtavradar"] = true ,
  158. }
  159.  
  160. -- speed-o-metermode: 1 = "km/h", 2="mph", 3="none"
  161. -- hudmode: 1 = new HUD, 2 = sphud, 3 = old hud
  162.  
  163.  
  164. function ui_ClickHandler()
  165. if source == GUIEditor.button[5] then
  166. exports["vehiclelights"].startGui()
  167.  
  168. elseif source == GUIEditor.button[6] then
  169. exports["carcolorpicker"].openColorPicker()
  170.  
  171. elseif source == GUIEditor.button[7] then
  172. exports["paintjobs"].startGui()
  173.  
  174. elseif source == GUIEditor.button[8] then
  175. exports["neon"].hideGui()
  176.  
  177. elseif source == GUIEditor.button[9] then
  178. exports["skins"].sendOpenRequestForServer()
  179.  
  180. elseif source == GUIEditor.button[10] then
  181. exports["raceprogressbar"].toggleGui()
  182.  
  183. elseif source == GUIEditor.button[11] then
  184. exports["raceplayerstatsgui"].toggleStatsWindow()
  185.  
  186. -- Toggle Traffic Sensor
  187. elseif source == GUIEditor.checkbox[7] then
  188. saveTime()
  189. if guiCheckBoxGetSelected( source ) then
  190. exports["race_traffic_sensor"].showTrafficSensor()
  191.  
  192. UI["trafficsensor"] = true
  193. else
  194. exports["race_traffic_sensor"].hideTrafficSensor()
  195.  
  196. UI["trafficsensor"] = false
  197. end
  198.  
  199. -- Toggle CP Delays
  200. elseif source == GUIEditor.checkbox[10] then
  201. saveTime()
  202. if guiCheckBoxGetSelected( source ) then
  203. exports["race_delay_indicator"].showCPDelays()
  204.  
  205. UI["checkpointdelay"] = true
  206. else
  207. exports["race_delay_indicator"].hideCPDelays()
  208.  
  209. UI["checkpointdelay"] = false
  210. end
  211.  
  212. -- Toggle Float messages
  213. elseif source == GUIEditor.checkbox[12] then
  214. saveTime()
  215. if guiCheckBoxGetSelected( source ) then
  216. exports["messages"].showFloatMessages()
  217.  
  218. UI["floatingmessages"] = true
  219. else
  220. exports["messages"].hideFloatMessages()
  221.  
  222. UI["floatingmessages"] = false
  223. end
  224.  
  225. -- Toggle Custom NameTags
  226. elseif source == customNameTagsCheckBox then
  227. saveTime()
  228. if guiCheckBoxGetSelected( source ) then
  229. triggerEvent("toggleNameTags",root,true)
  230.  
  231. UI["customnametags"] = true
  232. else
  233. triggerEvent("toggleNameTags",root,false)
  234.  
  235. UI["customnametags"] = false
  236. end
  237.  
  238. -- Toggle SpecList
  239. elseif source == GUIEditor.checkbox[99] then
  240. saveTime()
  241. if guiCheckBoxGetSelected( source ) then
  242. exports["spectatorslist"].specliston()
  243.  
  244. UI["speclist"] = true
  245. else
  246. exports["spectatorslist"].speclistoff()
  247.  
  248. UI["speclist"] = false
  249. end
  250.  
  251. -- Toggle Zone Info
  252. elseif source == GUIEditor.checkbox[98] then
  253. saveTime()
  254. if guiCheckBoxGetSelected( source ) then
  255. exports["showarea"].zoneon()
  256.  
  257. UI["zonename"] = true
  258. else
  259. exports["showarea"].zoneoff()
  260.  
  261. UI["zonename"] = false
  262. end
  263.  
  264. -- Toggle KnightCoins Window
  265. elseif source == GUIEditor.checkbox[97] then
  266. saveTime()
  267. if guiCheckBoxGetSelected( source ) then
  268. exports["scoringsystem"].showcoins()
  269.  
  270. UI["coins"] = true
  271. else
  272. exports["scoringsystem"].hidecoins()
  273.  
  274. UI["coins"] = false
  275. end
  276.  
  277. -- Toggle Current Gear Display
  278. elseif source == GUIEditor.checkbox[96] then
  279. saveTime()
  280. if guiCheckBoxGetSelected( source ) then
  281. exports["gearsdisplay"].gearon()
  282.  
  283. UI["gear"] = true
  284. else
  285. exports["gearsdisplay"].gearoff()
  286.  
  287. UI["gear"] = false
  288. end
  289.  
  290. -- Toggle Clock/Date Display
  291. elseif source == GUIEditor.checkbox[95] then
  292. saveTime()
  293. if guiCheckBoxGetSelected( source ) then
  294. exports["realtimeanddate"].showtimedate()
  295.  
  296. UI["clockdate"] = true
  297. else
  298. exports["realtimeanddate"].hidetimedate()
  299.  
  300. UI["clockdate"] = false
  301. end
  302.  
  303. -- Toggle Player Count Display
  304. elseif source == GUIEditor.checkbox[94] then
  305. saveTime()
  306. if guiCheckBoxGetSelected( source ) then
  307. exports["onlineplayers"].showplayers()
  308.  
  309. UI["players"] = true
  310. else
  311. exports["onlineplayers"].hideplayers()
  312.  
  313. UI["players"] = false
  314. end
  315.  
  316. -- Toggle FPS & Ping Display
  317. elseif source == GUIEditor.checkbox[15] then
  318. saveTime()
  319. if guiCheckBoxGetSelected( source ) then
  320. exports["fpstabandonscreen"].e_showFPS()
  321.  
  322. UI["fpscounter"] = true
  323. else
  324. exports["fpstabandonscreen"].e_hideFPS()
  325.  
  326. UI["fpscounter"] = false
  327. end
  328.  
  329. -- Toggle Player Position Box
  330. elseif source == GUIEditor.checkbox[93] then
  331. saveTime()
  332. if guiCheckBoxGetSelected( source ) then
  333. exports["playerposition"].showpos()
  334.  
  335. UI["playerpos"] = true
  336. else
  337. exports["playerposition"].hidepos()
  338.  
  339. UI["playerpos"] = false
  340. end
  341.  
  342. -- Toggle Next Map Window
  343. elseif source == GUIEditor.checkbox[92] then
  344. saveTime()
  345. if guiCheckBoxGetSelected( source ) then
  346. exports["nextmap"].shownextmap()
  347.  
  348. UI["nextmap"] = true
  349. else
  350. exports["nextmap"].hidenextmap()
  351.  
  352. UI["nextmap"] = false
  353. end
  354.  
  355. -- Toggle Site/IRC Info
  356. elseif source == GUIEditor.checkbox[91] then
  357. saveTime()
  358. if guiCheckBoxGetSelected( source ) then
  359. exports["siteinfo"].showinfo()
  360.  
  361. UI["siteinfo"] = true
  362. else
  363. exports["siteinfo"].hideinfo()
  364.  
  365. UI["siteinfo"] = false
  366. end
  367.  
  368. -- Toggle Top1 Bar
  369. elseif source == GUIEditor.checkbox[90] then
  370. saveTime()
  371. if guiCheckBoxGetSelected( source ) then
  372. exports["race_toptimes"].showtopbar()
  373.  
  374. UI["top1bar"] = true
  375. else
  376. exports["race_toptimes"].hidetopbar()
  377.  
  378. UI["top1bar"] = false
  379. end
  380.  
  381. -- Toggle Classic Progressbar
  382. elseif source == GUIEditor.checkbox[89] then
  383. saveTime()
  384. if guiCheckBoxGetSelected( source ) then
  385. exports["raceprogressbar"].onswitch()
  386.  
  387. UI["classicprogressbar"] = true
  388. else
  389. exports["raceprogressbar"].offswitch()
  390.  
  391. UI["classicprogressbar"] = false
  392. end
  393.  
  394. -- Toggle Modern Progressbar
  395. elseif source == GUIEditor.checkbox[88] then
  396. saveTime()
  397. if guiCheckBoxGetSelected( source ) then
  398. exports["race"].shownewbar()
  399.  
  400. UI["modernprogressbar"] = true
  401. else
  402. exports["race"].hidenewbar()
  403.  
  404. UI["modernprogressbar"] = false
  405. end
  406.  
  407. -- Toggle GTA V Radar
  408. elseif source == GUIEditor.checkbox[87] then
  409. saveTime()
  410. if guiCheckBoxGetSelected( source ) then
  411. exports["gtavradar"].radaron()
  412.  
  413. UI["gtavradar"] = true
  414. else
  415. exports["gtavradar"].radaroff()
  416.  
  417. UI["gtavradar"] = false
  418. end
  419.  
  420. end
  421. end
  422. addEventHandler("onClientGUIClick", resourceRoot, ui_ClickHandler)
  423.  
  424.  
  425. function ui_ComboBoxHandler(comboBox)
  426. if comboBox == GUIEditor.combobox[1] then
  427. saveTime()
  428. local theID = guiComboBoxGetSelected( comboBox )
  429. local theText = guiComboBoxGetItemText( comboBox, theID )
  430.  
  431. if theText == "New" then
  432. if isTimer(HudOverrideTimer) then
  433. killTimer(HudOverrideTimer)
  434. end
  435. setTimer( sphudOverride, 2000, 1)
  436.  
  437. exports["racesphud"].e_showNewhud()
  438. UI["hudmode"] = 1
  439.  
  440.  
  441. elseif theText == "SP" then
  442. if isTimer(HudOverrideTimer) then
  443. killTimer(HudOverrideTimer)
  444. end
  445. setTimer( sphudOverride, 2000, 1)
  446.  
  447. exports["racesphud"].e_showSPhud()
  448. UI["hudmode"] = 2
  449.  
  450.  
  451. elseif theText == "Old" then
  452. if isTimer(HudOverrideTimer) then
  453. killTimer(HudOverrideTimer)
  454. end
  455. setTimer( sphudOverride, 2000, 1)
  456.  
  457. exports["racesphud"].e_showOldhud()
  458. UI["hudmode"] = 3
  459.  
  460. end
  461. -- Speed - o - meter mode combobox
  462. elseif comboBox == GUIEditor.combobox[2] then
  463. saveTime()
  464. local theID = guiComboBoxGetSelected( comboBox )
  465. local theText = guiComboBoxGetItemText( comboBox, theID )
  466.  
  467. if theText == "KM/h" then
  468. exports["digitalspeedometer"].setKMH()
  469. UI["speed-o-metermode"] = 1
  470.  
  471.  
  472. elseif theText == "MPh" then
  473. exports["digitalspeedometer"].setMPH()
  474. UI["speed-o-metermode"] = 2
  475.  
  476. elseif theText == "None" then
  477. exports["digitalspeedometer"].setNone()
  478. UI["speed-o-metermode"] = 3
  479.  
  480. end
  481.  
  482. end
  483. end
  484. addEventHandler("onClientGUIComboBoxAccepted", resourceRoot, ui_ComboBoxHandler)
  485.  
  486.  
  487.  
  488.  
  489.  
  490. function sphudOverride() -- sphud overrides toggleGCInfo and enableFPS
  491. for f, u in pairs(Exp_Funct) do
  492. if UI[f] then
  493. if Exp_Funct[f]["true"] then
  494.  
  495. local executeFunction = loadstring(Exp_Funct[f]["true"])
  496. executeFunction()
  497.  
  498. -- elseif tostring(f) == "speed-o-metermode" then --set speed-o-meter mode
  499. -- local theNumber = UI[f]
  500. -- local executeFunction = loadstring(Exp_Funct[f][theNumber])
  501. -- executeFunction()
  502. -- outputChatBox("Set Speedometer to "..tostring(theNumber))
  503.  
  504. end
  505. end
  506. end
  507.  
  508. end
  509.  
  510.  
  511.  
  512.  
  513.  
  514. function saveTime()
  515. if isTimer( theSaveTimer ) then
  516. killTimer( theSaveTimer )
  517. end
  518. theSaveTimer = setTimer(saveUISettings, ui_timetosave, 1)
  519. end
  520.  
  521. function saveUISettings()
  522. UIxml = xmlLoadFile( "/settings/uisettings.xml" )
  523.  
  524. for f, u in pairs(UI) do
  525. local theChild = xmlFindChild( UIxml, f, 0 )
  526. if not theChild then
  527. local theNewChild = xmlCreateChild( UIxml, tostring(f) )
  528. xmlNodeSetValue( theNewChild, tostring(u) )
  529. else
  530. local theValue = xmlNodeSetValue( theChild, tostring(u) )
  531. end
  532. end
  533. outputChatBox("Your Preferences Were Saved")
  534.  
  535. xmlSaveFile( UIxml )
  536. xmlUnloadFile( UIxml )
  537.  
  538. end
  539.  
  540.  
  541.  
  542. function loadUISettings()
  543. UIxml = xmlLoadFile( "/settings/uisettings.xml" )
  544. if not UIxml then
  545. UIxml = xmlCreateFile( "/settings/uisettings.xml", "settings" )
  546.  
  547. for f, u in pairs(UI) do
  548. local theChild = xmlCreateChild( UIxml, f )
  549. xmlNodeSetValue( theChild, tostring(u) )
  550. end
  551. end
  552.  
  553. for f, u in pairs(UI) do -- load settings to UI table
  554. local theChild = xmlFindChild( UIxml, f, 0 )
  555. local theValue = xmlNodeGetValue( theChild )
  556.  
  557. if isBoolean(theValue) then
  558. UI[f] = toBoolean(theValue)
  559. else
  560. UI[f] = tonumber(theValue)
  561. end
  562. end
  563.  
  564.  
  565.  
  566. xmlSaveFile( UIxml )
  567. xmlUnloadFile( UIxml )
  568. updateUIgui()
  569. executeHUDSettings()
  570. end
  571. addEventHandler("onClientResourceStart", resourceRoot, loadUISettings)
  572.  
  573. function executeHUDSettings()
  574. local precheck = "if not (getResourceFromName(Exp_Funct['hudmode'].res) and getResourceState(getResourceFromName(Exp_Funct['hudmode'].res))=='running') then return outputDebugString('settings: hudmode not running', 2) end; "
  575. local executeHud = loadstring(precheck .. Exp_Funct["hudmode"][tonumber(UI["hudmode"])])
  576. setTimer(executeHud,2000,1)
  577. setTimer(executeUISettings, 3000, 1)
  578. end
  579.  
  580. function executeUISettings()
  581. for f, u in pairs(UI) do
  582. local precheck = string.format("if Exp_Funct['%s'].res and getResourceFromName(Exp_Funct['%s'].res) and getResourceState(getResourceFromName(Exp_Funct['%s'].res))~='running' then return end; ", f, f, f)
  583. if f == "speed-o-metermode" then -- exception for number based setting
  584. if Exp_Funct[f].res and getResourceFromName(Exp_Funct[f].res) and getResourceState(getResourceFromName(Exp_Funct[f].res))~='running' then
  585. -- outputDebugString('settings: ' .. f .. ' res not running', 2)
  586. else
  587. local executeFunction = loadstring(precheck .. Exp_Funct["speed-o-metermode"][tonumber(UI["speed-o-metermode"])])
  588. executeFunction()
  589. end
  590. elseif f ~= "hudmode" and f ~= "customnametags" then
  591. if Exp_Funct[f].res and not (getResourceFromName(Exp_Funct[f].res) and getResourceState(getResourceFromName(Exp_Funct[f].res))=='running') then
  592. -- outputDebugString('settings: ' .. f .. ' res not running', 2)
  593. else
  594. local executeSetting = loadstring(Exp_Funct[f][tostring(UI[f])])
  595. executeSetting()
  596. end
  597.  
  598. elseif f == "customnametags" then
  599. triggerEvent("toggleNameTags",root,toBoolean(u))
  600. end
  601. end
  602. end
  603.  
  604.  
  605. function updateUIgui() -- Updates the GUI to the settings that loaded --
  606. for f, u in pairs(UI) do
  607.  
  608. if f == "rankboard" then
  609. if u then
  610. guiCheckBoxSetSelected( GUIEditor.checkbox[5], true )
  611. else
  612. guiCheckBoxSetSelected( GUIEditor.checkbox[5], false )
  613. end
  614. elseif f == "trafficsensor" then
  615. if u then
  616. guiCheckBoxSetSelected( GUIEditor.checkbox[7], true )
  617. else
  618. guiCheckBoxSetSelected( GUIEditor.checkbox[7], false )
  619. end
  620.  
  621. elseif f == "checkpointdelay" then
  622. if u then
  623. guiCheckBoxSetSelected( GUIEditor.checkbox[10], true )
  624. else
  625. guiCheckBoxSetSelected( GUIEditor.checkbox[10], false )
  626. end
  627.  
  628. elseif f == "chatbubbles" then
  629. if u then
  630. guiCheckBoxSetSelected( GUIEditor.checkbox[11], true )
  631. else
  632. guiCheckBoxSetSelected( GUIEditor.checkbox[11], false )
  633. end
  634.  
  635. elseif f == "floatingmessages" then
  636. if u then
  637. guiCheckBoxSetSelected( GUIEditor.checkbox[12], true )
  638. else
  639. guiCheckBoxSetSelected( GUIEditor.checkbox[12], false )
  640. end
  641.  
  642. elseif f == "fpscounter" then
  643. if u then
  644. guiCheckBoxSetSelected( GUIEditor.checkbox[15], true )
  645. else
  646. guiCheckBoxSetSelected( GUIEditor.checkbox[15], false )
  647. end
  648.  
  649. elseif f == "customnametags" then
  650. if toBoolean(u) then
  651. guiCheckBoxSetSelected(customNameTagsCheckBox,true)
  652. else
  653. guiCheckBoxSetSelected(customNameTagsCheckBox,false)
  654. end
  655.  
  656. elseif f == "speed-o-metermode" then
  657. guiComboBoxSetSelected( GUIEditor.combobox[2], tonumber(u)-1 )
  658.  
  659. elseif f == "hudmode" then
  660. guiComboBoxSetSelected( GUIEditor.combobox[1], tonumber(u)-1 )
  661.  
  662. elseif f == "speclist" then
  663. if u then
  664. guiCheckBoxSetSelected( GUIEditor.checkbox[99], true )
  665. else
  666. guiCheckBoxSetSelected( GUIEditor.checkbox[99], false )
  667. end
  668.  
  669. elseif f == "zonename" then
  670. if u then
  671. guiCheckBoxSetSelected( GUIEditor.checkbox[98], true )
  672. else
  673. guiCheckBoxSetSelected( GUIEditor.checkbox[98], false )
  674. end
  675.  
  676. elseif f == "coins" then
  677. if u then
  678. guiCheckBoxSetSelected( GUIEditor.checkbox[97], true )
  679. else
  680. guiCheckBoxSetSelected( GUIEditor.checkbox[97], false )
  681. end
  682.  
  683. elseif f == "gear" then
  684. if u then
  685. guiCheckBoxSetSelected( GUIEditor.checkbox[96], true )
  686. else
  687. guiCheckBoxSetSelected( GUIEditor.checkbox[96], false )
  688. end
  689.  
  690. elseif f == "clockdate" then
  691. if u then
  692. guiCheckBoxSetSelected( GUIEditor.checkbox[95], true )
  693. else
  694. guiCheckBoxSetSelected( GUIEditor.checkbox[95], false )
  695. end
  696.  
  697. elseif f == "players" then
  698. if u then
  699. guiCheckBoxSetSelected( GUIEditor.checkbox[94], true )
  700. else
  701. guiCheckBoxSetSelected( GUIEditor.checkbox[94], false )
  702. end
  703.  
  704. elseif f == "playerpos" then
  705. if u then
  706. guiCheckBoxSetSelected( GUIEditor.checkbox[93], true )
  707. else
  708. guiCheckBoxSetSelected( GUIEditor.checkbox[93], false )
  709. end
  710.  
  711. elseif f == "nextmap" then
  712. if u then
  713. guiCheckBoxSetSelected( GUIEditor.checkbox[92], true )
  714. else
  715. guiCheckBoxSetSelected( GUIEditor.checkbox[92], false )
  716. end
  717.  
  718. elseif f == "siteinfo" then
  719. if u then
  720. guiCheckBoxSetSelected( GUIEditor.checkbox[91], true )
  721. else
  722. guiCheckBoxSetSelected( GUIEditor.checkbox[91], false )
  723. end
  724.  
  725. elseif f == "top1bar" then
  726. if u then
  727. guiCheckBoxSetSelected( GUIEditor.checkbox[90], true )
  728. else
  729. guiCheckBoxSetSelected( GUIEditor.checkbox[90], false )
  730. end
  731.  
  732. elseif f == "classicprogressbar" then
  733. if u then
  734. guiCheckBoxSetSelected( GUIEditor.checkbox[89], true )
  735. else
  736. guiCheckBoxSetSelected( GUIEditor.checkbox[89], false )
  737. end
  738.  
  739. elseif f == "modernprogressbar" then
  740. if u then
  741. guiCheckBoxSetSelected( GUIEditor.checkbox[88], true )
  742. else
  743. guiCheckBoxSetSelected( GUIEditor.checkbox[88], false )
  744. end
  745. elseif f == "gtavradar" then
  746. if u then
  747. guiCheckBoxSetSelected( GUIEditor.checkbox[87], true )
  748. else
  749. guiCheckBoxSetSelected( GUIEditor.checkbox[87], false )
  750. end
  751.  
  752.  
  753. end
  754. end
  755. end
  756.  
  757. addEvent('onClientMapStarting')
  758. function setTimeLeftonMapStart()
  759. if UI["timeleft"] then
  760. setTimer(function()
  761. timeleft_on()
  762. end,2000,1)
  763. end
  764. end
  765. addEventHandler("onClientMapStarting", root, setTimeLeftonMapStart)
  766.  
  767.  
  768. function timeleft_on()
  769. triggerEvent('onClientCall_race', getResourceRootElement( getResourceFromName('race')), 'showGUIComponents', 'timeleft', 'timeleftbg')
  770. end
  771.  
  772. function timeleft_off()
  773. triggerEvent('onClientCall_race', getResourceRootElement( getResourceFromName('race')), 'hideGUIComponents', 'timeleft', 'timeleftbg')
  774. end
  775.  
  776.  
  777.  
  778.  
  779. -- util --
  780. function toBoolean(str)
  781. if str == "true" then return true end
  782. if str == "false" then return false end
  783. if str == true then return true end
  784. if str == false then return false end
  785. end
  786.  
  787. function isBoolean(str)
  788. if str == nil then return false end
  789. if str == "false" then return true end
  790. if str == "true" then return true end
  791. if str == false then return true end
  792. if str == true then return true end
  793. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement