Guest User

Untitled

a guest
May 8th, 2017
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.05 KB | None | 0 0
  1.  
  2.  
  3. local function ShowUserCreationScreen ( )
  4. local Models = {};
  5. for k, v in pairs(MODEL_AVAILABLE["m"]) do table.insert(Models, {SEX_MALE, LocalPlayer():GetModelPath("m", k, 1), "m_" .. k .. "_01"}); end
  6. for k, v in pairs(MODEL_AVAILABLE["f"]) do table.insert(Models, {SEX_FEMALE, LocalPlayer():GetModelPath("f", k, 1), "f_" .. k .. "_01"}); end
  7. local curModelReference = 1;
  8.  
  9. local W, H = 400, 185
  10.  
  11. AccountCreationScreen = vgui.Create("DFrame")
  12. AccountCreationScreen:SetPos(ScrW() * .5 - W * .5, ScrH() * .5 - H * .5)
  13. AccountCreationScreen:SetSize(W, H)
  14. AccountCreationScreen:SetTitle("Character Creation")
  15. AccountCreationScreen:SetVisible(true)
  16. AccountCreationScreen:SetDraggable(false)
  17. AccountCreationScreen:ShowCloseButton(false)
  18. AccountCreationScreen:MakePopup()
  19. AccountCreationScreen:SetAlpha(GAMEMODE.GetGUIAlpha())
  20.  
  21. local PanelSize = W * .5 - 7.5
  22. local UsCash = vgui.Create("DPanelList", AccountCreationScreen)
  23. UsCash:EnableHorizontal(false)
  24. UsCash:EnableVerticalScrollbar(true)
  25. UsCash:StretchToParent(130, 30, 5, 5)
  26. UsCash:SetPadding(5)
  27.  
  28. local UsCash2 = vgui.Create("DPanelList", AccountCreationScreen)
  29. UsCash2:EnableHorizontal(false)
  30. UsCash2:EnableVerticalScrollbar(true)
  31. UsCash2:SetPos(5, 30)
  32. UsCash2:SetSize(120, 150)
  33. UsCash2:SetPadding(5)
  34.  
  35. local ModelPanel = vgui.Create('DModelPanel', AccountCreationScreen)
  36. ModelPanel:SetPos(5, 30)
  37. ModelPanel:SetSize(120, 120)
  38. ModelPanel:SetFOV(70)
  39. ModelPanel:SetCamPos(Vector(14, 0, 60))
  40. ModelPanel:SetLookAt(CAM_LOOK_AT[SEX_MALE])
  41. ModelPanel:SetModel(Models[curModelReference][2])
  42. function ModelPanel:LayoutEntity( Entity ) end
  43. local ourModel = Models[curModelReference][3]
  44.  
  45. local UserNamel = vgui.Create("DLabel", UsCash)
  46. UserNamel:SetPos(80, 30)
  47. UserNamel:SetSize(100, 20)
  48. UserNamel:SetText("Character's First Name:")
  49. UsCash:AddItem(UserNamel)
  50.  
  51. local LeftButton = vgui.Create("DButton", AccountCreationScreen)
  52. LeftButton:SetPos(10, H - 30)
  53. LeftButton:SetSize((110 * .5) - 2.5, 20)
  54. LeftButton:SetText("<")
  55.  
  56. function LeftButton:DoClick ( )
  57. curModelReference = curModelReference - 1
  58. if (curModelReference < 1) then
  59. curModelReference = #Models
  60. end
  61.  
  62. ModelPanel:SetModel(Models[curModelReference][2])
  63. ModelPanel:SetLookAt(CAM_LOOK_AT[Models[curModelReference][1]])
  64. ourModel = Models[curModelReference][3]
  65. end
  66.  
  67. local RightButton = vgui.Create("DButton", AccountCreationScreen)
  68. RightButton:SetPos(12.5 + (110 * .5), H - 30)
  69. RightButton:SetSize((110 * .5) - 2.5, 20)
  70. RightButton:SetText(">")
  71.  
  72. function RightButton:DoClick ( )
  73. curModelReference = curModelReference + 1
  74. if (curModelReference > #Models) then
  75. curModelReference = 1
  76. end
  77.  
  78. ModelPanel:SetModel(Models[curModelReference][2])
  79. ModelPanel:SetLookAt(CAM_LOOK_AT[Models[curModelReference][1]])
  80. ourModel = Models[curModelReference][3]
  81. end
  82.  
  83. UserName = vgui.Create("DTextEntry", UsCash)
  84. UserName:SetPos(80, 30)
  85. UserName:SetSize(100, 20)
  86. UserName:SetText("John")
  87. UsCash:AddItem(UserName)
  88.  
  89. local UserNamel = vgui.Create("DLabel", UsCash)
  90. UserNamel:SetPos(80, 30)
  91. UserNamel:SetSize(100, 20)
  92. UserNamel:SetText("")
  93. UsCash:AddItem(UserNamel)
  94.  
  95. local UserNamel = vgui.Create("DLabel", UsCash)
  96. UserNamel:SetPos(80, 30)
  97. UserNamel:SetSize(100, 20)
  98. UserNamel:SetText("Character's Last Name:")
  99. UsCash:AddItem(UserNamel)
  100.  
  101. UserPass = vgui.Create("DTextEntry", UsCash)
  102. UserPass:SetPos(80, 30)
  103. UserPass:SetSize(100, 20)
  104. UserPass:SetText("Doe")
  105. UsCash:AddItem(UserPass)
  106.  
  107. local UserNamel = vgui.Create("DLabel", UsCash)
  108. UserNamel:SetPos(80, 30)
  109. UserNamel:SetSize(100, 20)
  110. UserNamel:SetText("")
  111. UsCash:AddItem(UserNamel)
  112.  
  113. local SubmitButton = vgui.Create("DButton", UsCash)
  114. SubmitButton:SetPos(80, 30)
  115. SubmitButton:SetSize(100, 20)
  116. SubmitButton:SetText("Create User")
  117.  
  118. UsCash:AddItem(SubmitButton)
  119.  
  120. local function MonitorColors ( wantReturn )
  121. local firstName = UserName:GetValue()
  122. local lastName = UserPass:GetValue()
  123.  
  124. local anyInvalid = false
  125.  
  126. if !GAMEMODE.IsValidPartialName(firstName) then
  127. UserName:SetTextColor(Color(255, 0, 0, 255))
  128. anyInvalid = true
  129. else
  130. UserName:SetTextColor(Color(0, 0, 0, 255))
  131. end
  132.  
  133. if !GAMEMODE.IsValidPartialName(lastName) then
  134. UserPass:SetTextColor(Color(255, 0, 0, 255))
  135. anyInvalid = true
  136. else
  137. UserPass:SetTextColor(Color(0, 0, 0, 255))
  138. end
  139.  
  140. if (!GAMEMODE.IsValidName(firstName, lastName, true)) then
  141. UserPass:SetTextColor(Color(255, 0, 0, 255))
  142. UserName:SetTextColor(Color(255, 0, 0, 255))
  143. anyInvalid = true
  144. end
  145.  
  146. if (anyInvalid) then
  147. SubmitButton:SetEnabled(false)
  148. else
  149. SubmitButton:SetEnabled(true)
  150. end
  151.  
  152. if (wantReturn) then
  153. return !anyInvalid
  154. end
  155. end
  156. hook.Add('Think', 'MonColors', MonitorColors)
  157.  
  158. function SubmitButton:DoClick ( )
  159. if (!MonitorColors(true)) then
  160. LocalPlayer():Notify("Please fix any fields that may have errors.");
  161. return;
  162. end
  163.  
  164.  
  165. hook.Remove("Think", 'MonColors');
  166. AccountCreationScreen:Remove();
  167. RunConsoleCommand("gta_nc", ourModel, UserName:GetValue(), UserPass:GetValue());
  168. LocalPlayer():Notify("Creating character please wait...")
  169. end
  170. end
  171.  
  172. local rulesOnce = false
  173. function ShowRulesConfirmation ( )
  174. if (rulesOnce) then return end
  175. rulesOnce = true
  176.  
  177. local W, H = ScrW() * .5, ScrH() * .75;
  178. local X, Y = ScrW() * .5 - W * .5, ScrH() * .5 - H * .5;
  179.  
  180. local ConfirmRulesScreen = vgui.Create("DFrame")
  181. ConfirmRulesScreen:SetPos(X, Y)
  182. ConfirmRulesScreen:SetSize(W, H)
  183. ConfirmRulesScreen:SetTitle("Rules Confirmation")
  184. ConfirmRulesScreen:SetVisible(true)
  185. ConfirmRulesScreen:SetDraggable(false)
  186. ConfirmRulesScreen:ShowCloseButton(false)
  187. ConfirmRulesScreen:MakePopup()
  188. ConfirmRulesScreen:SetAlpha(GAMEMODE.GetGUIAlpha());
  189.  
  190. local PanelList = vgui.Create("DPanelList", ConfirmRulesScreen);
  191. PanelList:EnableHorizontal(false)
  192. PanelList:EnableVerticalScrollbar(true)
  193. PanelList:SetPos(5, 50);
  194. PanelList:StretchToParent(5, 30, 5, 30);
  195. PanelList:SetPadding(5);
  196. PanelList:SetSpacing(-5);
  197.  
  198. HTML = vgui.Create("HTML")
  199. HTML:SetSize(PanelList:GetWide(), PanelList:GetTall() - 20)
  200. HTML:OpenURL("http://www.darkfusiongaming.net/showthread.php?t=141")
  201.  
  202. PanelList:AddItem(HTML)
  203.  
  204. local SubmitButton = vgui.Create("DButton", ConfirmRulesScreen);
  205. SubmitButton:SetPos(5, H - 25);
  206. SubmitButton:SetSize(W * .5 - 7.5, 20);
  207. SubmitButton:SetText("I Agree ( 10 Seconds )");
  208. SubmitButton:SetDisabled(true);
  209.  
  210. timer.Simple(1, function ( ) SubmitButton:SetText("I Agree ( 9 Seconds )"); end);
  211. timer.Simple(2, function ( ) SubmitButton:SetText("I Agree ( 8 Seconds )"); end);
  212. timer.Simple(3, function ( ) SubmitButton:SetText("I Agree ( 7 Seconds )"); end);
  213. timer.Simple(4, function ( ) SubmitButton:SetText("I Agree ( 6 Seconds )"); end);
  214. timer.Simple(5, function ( ) SubmitButton:SetText("I Agree ( 5 Seconds )"); end);
  215. timer.Simple(6, function ( ) SubmitButton:SetText("I Agree ( 4 Seconds )"); end);
  216. timer.Simple(7, function ( ) SubmitButton:SetText("I Agree ( 3 Seconds )"); end);
  217. timer.Simple(8, function ( ) SubmitButton:SetText("I Agree ( 2 Seconds )"); end);
  218. timer.Simple(9, function ( ) SubmitButton:SetText("I Agree ( 1 Seconds )"); end);
  219. timer.Simple(10, function ( ) SubmitButton:SetText("I Agree"); SubmitButton:SetDisabled(false); LOADED_RULES = true; end);
  220.  
  221. function SubmitButton:DoClick ( )
  222. if (LOADED_RULES) then
  223. ConfirmRulesScreen:Remove();
  224. ShowUserCreationScreen();
  225. end
  226. end
  227.  
  228. local SubmitButton = vgui.Create("DButton", ConfirmRulesScreen);
  229. SubmitButton:SetPos(10 + (W * .5 - 7.5), H - 25);
  230. SubmitButton:SetSize(W * .5 - 7.5, 20);
  231. SubmitButton:SetText("I Disagree");
  232.  
  233. function SubmitButton:DoClick ( )
  234. RunConsoleCommand('disconnect');
  235. end
  236. end
  237.  
  238. local function startNewChar ( )
  239. if (GAMEMODE.ShowedIntro) then
  240. ShowRulesConfirmation();
  241. else
  242. vgui.Create("gta_intro"):EnableRules();
  243. end
  244. end
  245. net.Receive( "gta_newchar", startNewChar )
Add Comment
Please, Sign In to add comment