Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2016
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.13 KB | None | 0 0
  1. function createLoginWindow()
  2.  
  3.   -- gui elements
  4.   outputChatBox("Welcome to My MTA:SA Server, Please log in")
  5.  
  6.   wdwLogin = guiCreateWindow(0.375, 0.375, 0.25, 0.25, "Please Log In", true)
  7.   guiCreateLabel (0.0825, 0.25, 0.25, 0.25, "Username", true, wdwLogin)
  8.   guiCreateLabel (0.0825, 0.5, 0.25, 0.25, "Password", true, wdwLogin)
  9.  
  10.   edtUser = guiCreateEdit(0.415, 0.2, 0.2, 0.15, "...", true, wdwLogin)
  11.   edtPass = guiCreateEdit(0.415, 0.5, 0.2, 0.15, "....", true, wdwLogin)
  12.   guiEditSetMaxLength(edtUser, 50)
  13.   guiEditSetMaxLength(edtPass, 50)
  14.  
  15.   btnLogin = guiCreateButton(0.415, 0.7, 0.25, 0.2, "Log In", true, wdwLogin)
  16.  
  17.   -- gui settings
  18.   showCursor(true)
  19.  
  20.   -- event handlers
  21.   addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin, false)
  22. end
  23. addEventHandler( "onClientResourceStart", getRootElement(), createLoginWindow) -- makes the function to execute when the resource starts for the client.
  24.  
  25. -- function that handles the login submition
  26. function clientSubmitLogin(button,state)
  27.   if button == "left" and state == "up" then
  28.     guiSetVisible(wdwLogin, false)
  29.     showCursor(false)
  30.   end
  31. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement