Advertisement
Guest User

Untitled

a guest
May 11th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.47 KB | None | 0 0
  1. function createLoginWindow()
  2.     local X = 0.375
  3.     local Y = 0.375
  4.     local Width = 0.25
  5.     local Height = 0.25
  6.     wdwLogin = guiCreateWindow(X, Y, Width, Height, "Please Log In", true)
  7.  
  8.     X = 0.0825
  9.     Y = 0.2
  10.     Width = 0.25
  11.     height = 0.25
  12.  
  13.     guiCreateLabel(X, Y, Width, Height, "Username", true, wdwLogin)
  14.  
  15.     Y = 0.5
  16.     guiCreateLabel(X, Y, Width, height, "Password", true, wdwLogin)
  17.  
  18.     X = 0.415
  19.     Y = 0.2
  20.     Width = 0.5
  21.     Height = 0.15
  22.     edtUser = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin)
  23.     Y = 0.5
  24.     edtPass = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin)
  25.     guiEditSetMaxLength(edtuser, 50)
  26.     guieditSetMaxLength(edtPass, 50)
  27.  
  28.     X = 0.415
  29.     Y = 0.7
  30.     X = 0.415
  31.     Y = 0.7
  32.     Width = 0.25
  33.     Height = 0.2
  34.     btnLogin = guiCreateButton(X, Y, Width, Height, "Log In", true, wdwLogin)
  35.  
  36.     guiSetVisible(wdwLogin, false)
  37. end
  38.  
  39. addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()),
  40.     function ()
  41.         createLoginWindow()
  42.         outputChatBox("Welcome, i'm a noob.")
  43.    
  44.         if(wdwLogin ~= nil) then
  45.             guiSetVisible(wdwLogin, true)
  46.         else
  47.             outputChatBox("I failed, yet again.")
  48.         end
  49.  
  50.         showCursor(true)
  51.         guiSetInputEnabled(true)
  52.     end
  53.  
  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  tutorial.
  92.     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.
  93.     This is me talking to myself.]], false,rulesWindow)
  94.  
  95.     guiLabelsetHorizontalAlign(ruleslabel,"center",true)
  96.     addEventHandler("onClientGUIClick", rulesButton, acceptRules, false)
  97.     rulesWarningTimer = setTimer(inactivePlayer,120000,1,1)
  98.  
  99. end
  100.  
  101. addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()),
  102.  
  103.     function ()
  104.  
  105.         createRulesWindow
  106.  
  107.         showCursor(true,true)
  108.     end
  109. )  
  110.  
  111. function acceptRules(button,state)
  112.     if button == "left" and state == "up" then
  113.         guiSetVisible(rulesWindow, false)
  114.  
  115.         showCursor(false,false)
  116.  
  117.         outputChatbox("You passed me.")
  118.  
  119.  
  120.         if rulesWarningTimer then
  121.             killTimer(rulesWarningTimer)
  122.             rulesWarningTimer = nil
  123.         end
  124.     end
  125. end
  126.  
  127. function inactivePlayer(status)
  128.     if status == 1 then
  129.         outputChatbox("Please, cope with this timer i made")
  130.         rulesWarningTimer = setTimer (inactivePlayer,10000,1,2)
  131.    
  132.     elseif status == 2 then
  133.         outputChatBox("You have 5 seconds, lol")
  134.         rulesWarningTimer = setTimer(inactivePlayer,5000,1,3)
  135.     elseif status == 3 then
  136.         outputChatBox("I was about to kick myself. Not going to happen today, mate.")
  137.     end
  138. end
  139.  
  140. function createTelePortWindow()
  141.     local sWidth, sHeight = guiGetScreenSize()
  142.  
  143.     local Width,Height = 231,188
  144.     local X = (sWidth/2) - (Width/2)
  145.     local Y = (sHeight/2) - (Height/2)
  146.  
  147.     teleportWindow = guiCreateWindow(X,Y,Width,Height,"Magic",false)
  148.  
  149.     guiWindowSetSizable(teleportWindow,true)
  150.     guiWindowSetMovable(teleportWindow,true)
  151.     showCursor(true,true)
  152.  
  153.     teleportLabel = guiCreateLabel(18,23,191,33,"Serious magic, bro",false,teleportWindow)
  154.  
  155.     guiLabelSetHorizontalAlign(teleportLabel,"center",true)
  156.  
  157.     teleportButtonLS = guiCreateButton(18,63,195,35,"Los Santos",false,teleportWindow)
  158.  
  159.     teleportButtonSF = guiCreateButton(18,103,195,35,"San Fierro",false,teleportWindow)
  160.  
  161.     teleportButtonLV = guiCreateButton(18,143,195,35,"Las Venturas",false,teleportWindow)
  162.  
  163.     guiSetVisible(teleportWindow,false)
  164.  
  165. addEventHandler("onClientGUIClivk", teleportButtonLS, teleportPlayer, false)
  166.  
  167. addEventHandler("onClientGUIClick", teleportButtonSF, teleportPlayer, false)
  168.  
  169. addEventHandler("onClientGUIClick", teleportButtonLV, teleportPlayer, false)
  170. end
  171. addEventHandler("onClientResourceStart", getResourceRootElement(getHisResource()),
  172.     function ()
  173.         createTeleportWindow
  174.     end
  175. )
  176. function open TeleportWindow
  177.     guiSetVisible(teleportWindow,true)
  178.  
  179.     showCursor(true,true)
  180. end
  181. addCommandHandler("teleportme",openTeleportWindow)
  182.  
  183. function teleportPlayer(button,state)
  184.     if button == "left" and state == "up" then
  185.         if source ==teleportButtonLS then
  186.             triggerServerEvent ("movePlayerToPosition",getLocalPlayer(),1479.6,-1612.8,14.0,0)
  187.  
  188.             outputChatBox ("You managed to not fail!")
  189.  
  190.         elseif source == teleportButtonSF then
  191.  
  192.             triggerServerEvent("movePlayerToPosition",getLocalPlayer(),-2265.5,534.0,35.0,270)
  193.  
  194.             outputChatBox("Coool")
  195.  
  196.         elseif source == teleportButtonLV then
  197.  
  198.             triggerServerEvent("movePlayerToPosition",getLocalPlayer(),2036.9,1545.2,10.8,270)
  199.            
  200.             outputChatBox("Coolest")
  201.         end
  202.        
  203.         guiSetVisible(teleportWindow,false)
  204.  
  205.         showCursor(false)
  206.     end
  207. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement