Advertisement
Guest User

Untitled

a guest
May 11th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.55 KB | None | 0 0
  1. addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()),
  2. function createLoginWindow()
  3.     local X = 0.375
  4.     local Y = 0.375
  5.     local Width = 0.25
  6.     local Height = 0.25
  7.     wdwLogin = guiCreateWindow(X, Y, Width, Height, "Please Log In", true)
  8.  
  9.     X = 0.0825
  10.     Y = 0.2
  11.     Width = 0.25
  12.     height = 0.25
  13.  
  14.     guiCreateLabel(X, Y, Width, Height, "Username", true, wdwLogin)
  15.  
  16.     Y = 0.5
  17.     guiCreateLabel(X, Y, Width, height, "Password", true, wdwLogin)
  18.  
  19.     X = 0.415
  20.     Y = 0.2
  21.     Width = 0.5
  22.     Height = 0.15
  23.     edtUser = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin)
  24.     Y = 0.5
  25.     edtPass = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin)
  26.     guiEditSetMaxLength(edtuser, 50)
  27.     guieditSetMaxLength(edtPass, 50)
  28.  
  29.     X = 0.415
  30.     Y = 0.7
  31.     X = 0.415
  32.     Y = 0.7
  33.     Width = 0.25
  34.     Height = 0.2
  35.     btnLogin = guiCreateButton(X, Y, Width, Height, "Log In", true, wdwLogin)
  36.  
  37.     guiSetVisible(wdwLogin, false)
  38. end
  39. addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()),
  40.  
  41.     function ()
  42.         createLoginWindow()
  43.         outputChatBox("Welcome, i'm a noob.")
  44.    
  45.         if(wdwLogin ~= nil) then
  46.             guiSetVisible(wdwLogin, true)
  47.         else
  48.             outputChatBox("I failed, yet again.")
  49.         end
  50.  
  51.         showCursor(true)
  52.         guiSetInputEnabled(true)
  53.     end
  54.  
  55. )
  56. addEventHandler("onClientGUIClick", btnlogin, clientSubmitLogin, false)
  57.  
  58. function clientSubmitLogin(button,state)
  59.     if button == "left" and state == "up" then
  60.         local username = guiGetText(edtUser)
  61.         local password = guiGetText(edtPass)
  62.  
  63.         if username and password then
  64.             triggerServerEvent("submitLogin", getRootElement(), username, password)
  65.             guiSetInputEnabled(false)
  66.             guiSetVisible(wdwLogin, false)
  67.             showCursor(false)
  68.         else
  69.  
  70.             outputChatBox("You need a fucking username and password! LOL!")
  71.         end
  72.     end
  73. end
  74.  
  75. function createRulesWindow()
  76.     local sWidth, sHeight = 445,445
  77.     local X = (sWidth/2) - (Width/2)
  78.     local Y = (sHeight/2) - (Height/2)
  79.  
  80.     rulesWindow = guiCreateWindow(X,Y,Width,Height,"Test",false)
  81.  
  82.     guiWindowSetMovable(rulesWindow,true)
  83.    
  84.     guiWindowSetSizable(rulesWindow,false)
  85.  
  86.     rulesButton = guiCreateButton(137,394,156,37,"Sure",false,rulesWindow)
  87.    
  88.     rulesLabel = guiCreateLabel(10,25,425,359,[[
  89.     Hello!
  90.    
  91.     This is my first server ever, that i've tried to make. In fact, this is the first real script i've ever made, even though with the help of the  
  92.  
  93. tutorial.
  94.     My goal is to create a script that could become useful in vG MTA-RP. What script it is, i am not sure. I hope to create a mileage meter.
  95.     This is me talking to myself.]], false,rulesWindow)
  96.  
  97.     guiLabelsetHorizontalAlign(ruleslabel,"center",true)
  98.     addEventHandler("onClientGUIClick", rulesButton, acceptRules, false)
  99.     rulesWarningTimer = setTimer(inactivePlayer,120000,1,1)
  100.  
  101. end
  102. addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()),
  103.  
  104.     function ()
  105.  
  106.         createRulesWindow
  107.  
  108.         showCursor(true,true)
  109.     end
  110. )  
  111.  
  112. function acceptRules(button,state)
  113.     if button == "left" and state == "up" then
  114.         guiSetVisible(rulesWindow, false)
  115.  
  116.         showCursor(false,false)
  117.  
  118.         outputChatbox("You passed me.")
  119.  
  120.  
  121.         if rulesWarningTimer then
  122.             killTimer(rulesWarningTimer)
  123.             rulesWarningTimer = nil
  124.         end
  125.     end
  126. end
  127.  
  128. function inactivePlayer(status)
  129.     if status == 1 then
  130.         outputChatbox("Please, cope with this timer i made")
  131.         rulesWarningTimer = setTimer (inactivePlayer,10000,1,2)
  132.    
  133.     elseif status == 2 then
  134.         outputChatBox("You have 5 seconds, lol")
  135.         rulesWarningTimer = setTimer(inactivePlayer,5000,1,3)
  136.     elseif status == 3 then
  137.         outputChatBox("I was about to kick myself. Not going to happen today, mate.")
  138.     end
  139. end
  140.  
  141. function createTelePortWindow()
  142.     local sWidth, sHeight = guiGetScreenSize()
  143.  
  144.     local Width,Height = 231,188
  145.     local X = (sWidth/2) - (Width/2)
  146.     local Y = (sHeight/2) - (Height/2)
  147.  
  148.     teleportWindow = guiCreateWindow(X,Y,Width,Height,"Magic",false)
  149.  
  150.     guiWindowSetSizable(teleportWindow,true)
  151.     guiWindowSetMovable(teleportWindow,true)
  152.     showCursor(true,true)
  153.  
  154.     teleportLabel = guiCreateLabel(18,23,191,33,"Serious magic, bro",false,teleportWindow)
  155.  
  156.     guiLabelSetHorizontalAlign(teleportLabel,"center",true)
  157.  
  158.     teleportButtonLS = guiCreateButton(18,63,195,35,"Los Santos",false,teleportWindow)
  159.  
  160.     teleportButtonSF = guiCreateButton(18,103,195,35,"San Fierro",false,teleportWindow)
  161.  
  162.     teleportButtonLV = guiCreateButton(18,143,195,35,"Las Venturas",false,teleportWindow)
  163.  
  164.     guiSetVisible(teleportWindow,false)
  165.  
  166. addEventHandler("onClientGUIClivk", teleportButtonLS, teleportPlayer, false)
  167.  
  168. addEventHandler("onClientGUIClick", teleportButtonSF, teleportPlayer, false)
  169.  
  170. addEventHandler("onClientGUIClick", teleportButtonLV, teleportPlayer, false)
  171. end
  172. addEventHandler("onClientResourceStart", getResourceRootElement(getHisResource()),
  173.     function ()
  174.         createTeleportWindow
  175.     end
  176. )
  177. function open TeleportWindow
  178.     guiSetVisible(teleportWindow,true)
  179.  
  180.     showCursor(true,true)
  181. end
  182. addCommandHandler("teleportme",openTeleportWindow)
  183.  
  184. function teleportPlayer(button,state)
  185.     if button == "left" and state == "up" then
  186.         if source ==teleportButtonLS then
  187.             triggerServerEvent ("movePlayerToPosition",getLocalPlayer(),1479.6,-1612.8,14.0,0)
  188.  
  189.             outputChatBox ("You managed to not fail!")
  190.  
  191.         elseif source == teleportButtonSF then
  192.  
  193.             triggerServerEvent("movePlayerToPosition",getLocalPlayer(),-2265.5,534.0,35.0,270)
  194.  
  195.             outputChatBox("Coool")
  196.  
  197.         elseif source == teleportButtonLV then
  198.  
  199.             triggerServerEvent("movePlayerToPosition",getLocalPlayer(),2036.9,1545.2,10.8,270)
  200.            
  201.             outputChatBox("Coolest")
  202.         end
  203.        
  204.         guiSetVisible(teleportWindow,false)
  205.  
  206.         showCursor(false)
  207.     end
  208. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement