Advertisement
Guest User

Untitled

a guest
Jun 9th, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.11 KB | None | 0 0
  1. -- create our loginHandler function, with username and password parameters (passed from the client gui)
  2. function loginHandler(username,password)
  3.     --If there is no connection, print it.
  4.     --if( not connect_mysql ) then
  5.     --  outputChatBox( "Could not connect to MySQL server [DG:RP]" )
  6.     --else
  7.     local name = mysql_query( connect_mysql, "SELECT Username FROM players WHERE serial='" .. getPlayerSerial( client ) .. "'"  )
  8.     local pass = mysql_query( connect_mysql, "SELECT Password FROM players WHERE serial='" .. getPlayerSerial( client ) .. "'"  )
  9.     -- check that the username and password are correct
  10.     if username == name and password == pass then
  11.         -- the player has successfully logged in, so spawn them
  12.             spawnPlayer(client, 1959.55, -1714.46, 10)
  13.             fadeCamera(client, true)
  14.             outputChatBox("Welcome to Division Gamers RolePlay.", client)
  15.     else
  16.         -- if the username or password are not correct, output a message to the player
  17.         outputChatBox("Invalid username and password. Please re-connect and try again.",client)
  18.         end        
  19. end
  20. addEvent("submitLogin",true)
  21. addEventHandler("submitLogin",root,loginHandler)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement