fork download
  1. --
  2. -- Author: Ab-47; State: INCOMPLETE.
  3. -- Additional Notes; N/A; Rights: All Rights Reserved by Developers and Ab-47.
  4. -- Project: DAWabus/client.lua consisting of 2 file(s).
  5. -- Side Notes: N/A
  6. --
  7.  
  8. local screenWidth, screenHeight = guiGetScreenSize()
  9. local license = {}
  10. local skin_selected = {}
  11. local declined = {}
  12. local rank = {}
  13.  
  14. skins = {
  15. {217, "Rookie"},
  16. {211, "Semi-Pro"},
  17. }
  18.  
  19. bus = {
  20. button = {},
  21. window = {},
  22. gridlist = {},
  23. label = {},
  24. column = {}
  25. }
  26.  
  27. function create_bus_window()
  28. windowWidth, windowHeight = 316, 479
  29. windowX, windowY = (screenWidth / 1.15) - (windowWidth / 2), (screenHeight / 1.6) - (windowHeight / 2)
  30. bus.window[1] = guiCreateWindow(windowX, windowY, windowWidth, windowHeight, "Dawn - Bus Driver Application", false)
  31. guiWindowSetSizable(bus.window[1], false)
  32. guiSetAlpha(bus.window[1], 1.00)
  33. guiSetVisible(bus.window[1], false)
  34.  
  35. bus.button[1] = guiCreateButton(273, 25, 34, 34, "X", false, bus.window[1])
  36. bus.button[3] = guiCreateButton(233, 25, 34, 34, ":)", false, bus.window[1])
  37. bus.button[4] = guiCreateButton(10, 280, 97, 33, "Choose", false, bus.window[1])
  38. bus.button[5] = guiCreateButton(116, 280, 97, 33, "Proceed", false, bus.window[1])
  39.  
  40. bus.label[1] = guiCreateLabel(30, 26, 193, 33, "Dawn - Bus Driver Job", false, bus.window[1])
  41. bus.label[2] = guiCreateLabel(11, 76, 296, 31, "Do you have a license? If yes then proceed.", false, bus.window[1])
  42. bus.label[3] = guiCreateLabel(10, 107, 193, 33, "Step 1 - Skin Selection", false, bus.window[1])
  43. bus.label[5] = guiCreateLabel(10, 346, 296, 31, "Status: Unconfirmed", false, bus.window[1])
  44. bus.label[6] = guiCreateLabel(10, 313, 148, 38, "Step 2 - Confirmation", false, bus.window[1])
  45. bus.label[8] = guiCreateLabel(15, 411, 281, 42, "Click the smiley at the top right to take the job\nselect the X to cancel your application.", false, bus.window[1])
  46. bus.label[9] = guiCreateLabel(10, 373, 148, 38, "Step 3 - Decision", false, bus.window[1])
  47.  
  48. bus.gridlist[1] = guiCreateGridList(9, 142, 298, 130, false, bus.window[1])
  49.  
  50. bus.column[1] = guiGridListAddColumn(bus.gridlist[1], "ID", 0.3)
  51. bus.column[2] = guiGridListAddColumn(bus.gridlist[1], "Name", 0.3)
  52. bus.column[3] = guiGridListAddColumn(bus.gridlist[1], "Rank", 0.3)
  53.  
  54. guiSetProperty(bus.button[1], "NormalTextColour", "FFAAAAAA")
  55. guiSetProperty(bus.button[3], "NormalTextColour", "FFAAAAAA")
  56. guiSetProperty(bus.button[4], "NormalTextColour", "FFAAAAAA")
  57. guiSetProperty(bus.button[5], "NormalTextColour", "FFAAAAAA")
  58.  
  59. guiSetFont(bus.label[1], "clear-normal")
  60. guiSetFont(bus.label[3], "default-bold-small")
  61. guiSetFont(bus.label[6], "default-bold-small")
  62. guiSetFont(bus.label[9], "default-bold-small")
  63.  
  64. guiLabelSetColor(bus.label[1], 245, 232, 9)
  65. guiLabelSetColor(bus.label[3], 245, 232, 9)
  66. guiLabelSetColor(bus.label[6], 245, 232, 9)
  67. guiLabelSetColor(bus.label[9], 245, 232, 9)
  68.  
  69. guiLabelSetVerticalAlign(bus.label[1], "center")
  70. guiLabelSetVerticalAlign(bus.label[3], "center")
  71. guiLabelSetVerticalAlign(bus.label[5], "center")
  72. guiLabelSetVerticalAlign(bus.label[6], "center")
  73. guiLabelSetVerticalAlign(bus.label[8], "center")
  74. guiLabelSetVerticalAlign(bus.label[9], "center")
  75.  
  76. guiLabelSetHorizontalAlign(bus.label[8], "center", false)
  77. guiLabelSetHorizontalAlign(bus.label[2], "center", false)
  78. guiLabelSetHorizontalAlign(bus.label[5], "center", false)
  79.  
  80. addEventHandler("onClientGUIClick", bus.button[1], function() if(source==bus.button[1])then guiSetVisible(bus.window[1], false) outputChatBox("You have cancelled your application, better luck next time!", 255, 0, 0) declined[localPlayer] = false setElementModel(localPlayer, model) reset_gui_data() showCursor(false)end end)
  81. addEventHandler("onClientGUIClick", bus.button[3], function() if(source==bus.button[3])then proceed_to_app() end end)
  82. addEventHandler("onClientGUIClick", bus.button[4], function() if(source==bus.button[4])then proceed_to_skin_selection() end end)
  83. addEventHandler("onClientGUIClick", bus.button[5], function() if(source==bus.button[5])then proceed_to_confirmation() end end)
  84. addEventHandler("onClientGUIClick", bus.gridlist[1], viewTheSkin, false)
  85. end
  86. addEventHandler("onClientResourceStart", root, create_bus_window)
  87.  
  88. function proceed_to_skin_selection()
  89. local skin = getElementModel(localPlayer)
  90. if (declined[localPlayer]) then outputChatBox("You've already been declined, come back later please!", 255, 0, 0) return end
  91. for index, s in pairs(skins) do
  92. if (skin ~= s) then
  93. if (skin == 0 or skin == model and not noSkin) then
  94. setElementModel(localPlayer, model)
  95. outputChatBox("You must select a skin from the list!", 255, 0, 0)
  96. return
  97. end
  98. end
  99. end
  100. outputChatBox("Skin successfully chosen, please select 'Proceed' to continue your application.", 0, 255, 0)
  101. skin_selected[localPlayer] = true
  102. end
  103.  
  104. function proceed_to_confirmation()
  105. if (not skin_selected[localPlayer]) then
  106. outputChatBox("You must choose a skin to proceed to confirmation!", 255, 0, 0)
  107. elseif ( license[localPlayer]) then
  108. outputChatBox("You do not have an eligible license at the moment, come back when you've got one!", 255, 0, 0)
  109. guiSetText(bus.label[5], "Status: License unidentified, application rejected.")
  110. guiLabelSetColor(bus.label[5], 255, 0, 0)
  111. setTimer(function() guiLabelSetColor(bus.label[8], 255, 0, 0) end, 1000, 1)
  112. declined[localPlayer] = true
  113. else
  114. outputChatBox("Step 2 success, continue to step 3 to finish your application.", 0, 255, 0)
  115. guiSetText(bus.label[5], "Status: License approved, okay to proceed.")
  116. guiLabelSetColor(bus.label[5], 0, 255, 0)
  117. setTimer(function() guiLabelSetColor(bus.label[8], 0, 255, 0) end, 1000, 1)
  118. end
  119. end
  120.  
  121. function reset_gui_data()
  122. guiSetText(bus.label[5], "Status: Unidentified")
  123. guiLabelSetColor(bus.label[5], 255, 255, 255)
  124. guiLabelSetColor(bus.label[8], 255, 255, 255)
  125. end
  126.  
  127. function busApplicationHandle(string)
  128. if (string == "open") then
  129. guiSetVisible(bus.window[1], true)
  130. showCursor(not isCursorShowing(), true)
  131. model = getElementModel(localPlayer)
  132. guiGridListClear(bus.gridlist[1])
  133. if (not skins) then
  134. guiSetVisible(bus.gridlist[1], false)
  135. noSkin = true
  136. return
  137. else
  138. guiSetVisible(bus.gridlist[1], true)
  139. noSkin = nil
  140. end
  141. for index, skin in pairs(skins) do
  142. local row = guiGridListAddRow(bus.gridlist[1])
  143. guiGridListSetItemText(bus.gridlist[1], row, bus.column[1], skin[1], false, true)
  144. guiGridListSetItemText(bus.gridlist[1], row, bus.column[2], "Bus Driver", false, true)
  145. guiGridListSetItemText(bus.gridlist[1], row, bus.column[3], skin[2], false, true)
  146. end
  147. elseif (string == "close") then
  148. if (not guiGetVisible(bus.window[1])) then return end
  149. rank[localPlayer] = nil
  150. guiSetVisible(bus.window[1], false)
  151. showCursor(false)
  152. end
  153. end
  154. addEvent("DAWabus.bring_up_application", true)
  155. addEventHandler("DAWabus.bring_up_application", root, busApplicationHandle)
  156.  
  157. function proceed_to_app()
  158. if (declined[localPlayer]) then return end
  159. local skin = getElementModel(localPlayer)
  160. for index, s in pairs(skins) do
  161. if (skin ~= s) then
  162. if (skin == 0 or skin == model and not noSkin) then
  163. setElementModel(localPlayer, model)
  164. outputChatBox("An error has occurred, please re-enter the application centre.", 255, 0, 0)
  165. return
  166. end
  167. end
  168. end
  169. if (getElementModel(localPlayer) == 217) then
  170. rank[localPlayer] = "Rookie"
  171. elseif (getElementModel(localPlayer) == 211) then
  172. rank[localPlayer] = "Semi-Pro"
  173. end
  174. guiSetVisible(bus.window[1], false)
  175. reset_gui_data()
  176. showCursor(false)
  177. setElementModel(localPlayer, model)
  178. if (noSkin) then
  179. skin = false
  180. end
  181. outputChatBox("We've accepted you to the team, you are now employed as a bus driver "..tostring(rank[localPlayer]), 0, 255, 0)
  182. triggerServerEvent("DAWabus.acceptedJob", root, localPlayer, skin)
  183. rank[localPlayer] = nil
  184. end
  185.  
  186. function viewTheSkin()
  187. if (guiGridListGetSelectedItem(bus.gridlist[1]) == -1) then return end
  188. local row = guiGridListGetSelectedItem(source)
  189. local skin = guiGridListGetItemText(bus.gridlist[1], row, bus.column[1])
  190. setElementModel(localPlayer, skin or 0)
  191. end
  192.  
  193. -- Job Application Finished
  194. -- Beneath will be the actual bus driving code.
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:1: error: class, interface, or enum expected
--
^
Main.java:2: error: class, interface, or enum expected
-- Author: Ab-47; State: INCOMPLETE.
^
Main.java:2: error: class, interface, or enum expected
-- Author: Ab-47; State: INCOMPLETE.
   ^
Main.java:2: error: class, interface, or enum expected
-- Author: Ab-47; State: INCOMPLETE.
                  ^
Main.java:3: error: class, interface, or enum expected
-- Additional Notes; N/A; Rights: All Rights Reserved by Developers and Ab-47.
                     ^
Main.java:3: error: class, interface, or enum expected
-- Additional Notes; N/A; Rights: All Rights Reserved by Developers and Ab-47.
                          ^
Main.java:181: error: illegal '.'
	outputChatBox("We've accepted you to the team, you are now employed as a bus driver "..tostring(rank[localPlayer]), 0, 255, 0)
	                                                                                      ^
7 errors
stdout
Standard output is empty