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(username,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 serial='" .. getPlayerSerial( client ) .. "'" )
- -- check that the username and password are correct
- if( login ) then
- while true do
- local row = mysql_fetch_assoc( login )
- if (not row) then break end
- name = row['Username']
- pass = row['Password']
- if username == name and password == pass then
- -- the player has successfully logged in, so spawn them
- spawnPlayer(client, 1959.55, -1714.46, 10)
- 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