Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- create our loginHandler function, with username and password parameters (passed from the client gui)
- function loginHandler(password)
- --If there is no connection, print it.
- --if( not connect_mysql ) then
- -- outputChatBox( "Could not connect to MySQL server [DG:RP]" )
- --else
- local login = mysql_query( connect_mysql, "SELECT * FROM players WHERE Username='" .. getPlayerName(client) .. "'" )
- -- check that the username and password are correct
- if (login) then
- for login,row in mysql_rows_assoc(login) do
- pass = row['Password']
- posx = row['saveX']
- posy = row['saveY']
- posz = row['saveZ']
- end
- mysql_free_result(login)
- end
- if password == pass then
- -- the player has successfully logged in, so spawn them
- spawnPlayer(client, posx, posy, posz)
- fadeCamera(client, true)
- outputChatBox("Welcome to Division Gamers RolePlay.", client)
- else
- -- if the username or password are not correct, output a message to the player
- outputChatBox("Invalid username and password. Please re-connect and try again.",client)
- end
- end
- addEvent("submitLogin",true)
- addEventHandler("submitLogin",root,loginHandler)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement