Advertisement
Guest User

Untitled

a guest
May 14th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.60 KB | None | 0 0
  1. addEventHandler("onClientResourceStart", getResourceRootElement,
  2.     function ()
  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.         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.     addEventHandler("onClientGUIClick", btnlogin, clientSubmitLogin, false)
  37.    
  38.         guiSetVisible(wdwLogin, false)
  39. end
  40. )
  41. addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()),
  42.  
  43.     function ()
  44.         outputChatBox("Welcome, i'm a noob.")
  45.    
  46.         if(wdwLogin ~= nil) then
  47.             guiSetVisible(wdwLogin, true)
  48.         else
  49.             outputChatBox("I failed, yet again.")
  50.         end
  51.  
  52.         showCursor(true)
  53.         guiSetInputEnabled(true)
  54.     end
  55.  
  56. )
  57. addEventHandler("onClientGUIClick", btnlogin, clientSubmitLogin, false)
  58.  
  59. function clientSubmitLogin(button,state)
  60.     if button == "left" and state == "up" then
  61.         local username = guiGetText(edtUser)
  62.         local password = guiGetText(edtPass)
  63.  
  64.         if username and password then
  65.             triggerServerEvent("submitLogin", getRootElement(), username, password)
  66.             guiSetInputEnabled(false)
  67.             guiSetVisible(wdwLogin, false)
  68.             showCursor(false)
  69.         else
  70.  
  71.             outputChatBox("You need a fucking username and password! LOL!")
  72.         end
  73.     end
  74. end
  75.  
  76. function createRulesWindow()
  77.     local sWidth, sHeight = 445,445
  78.     local X = (sWidth/2) - (Width/2)
  79.     local Y = (sHeight/2) - (Height/2)
  80.  
  81.     rulesWindow = guiCreateWindow(X,Y,Width,Height,"Test",false)
  82.  
  83.     guiWindowSetMovable(rulesWindow,true)
  84.    
  85.     guiWindowSetSizable(rulesWindow,false)
  86.  
  87.     rulesButton = guiCreateButton(137,394,156,37,"Sure",false,rulesWindow)
  88.    
  89.     rulesLabel = guiCreateLabel(10,25,425,359,[[
  90.     Hello!
  91.    
  92.     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.
  93.     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.
  94.     This is me talking to myself.]], false,rulesWindow)
  95.  
  96.     guiLabelsetHorizontalAlign(ruleslabel,"center",true)
  97.     addEventHandler("onClientGUIClick", rulesButton, acceptRules, false)
  98.     rulesWarningTimer = setTimer(inactivePlayer,120000,1,1)
  99.  
  100. end
  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", getResourceRoot, createTeleportWindow
  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