Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function registerPlayer(userName,password,passwordReEntry)
- if userName ~= nil and password ~= nil and passwordReEntry ~= nil then
- local checkIfAccountAvailable = executeSQLQuery("SELECT * FROM accounts WHERE accountname =?",userName)[1]
- outputChatBox(tostring(checkIfAccountAvailable))
- if (string.len(password) < 6) then
- outputChatBox("Your password should be at least 6 chars. long!",client,255,0,0)
- elseif (password ~= passwordReEntry) then
- outputChatBox("Your password and your re-enter arent the same!",client,255,0,0)
- elseif (string.len(userName) <= 0) then
- outputChatBox("Please insert an username!",client,255,0,0)
- elseif (#checkIfAccountAvailable == 1 ) then
- outputChatBox("#FF0000This Username is already taken!#FFFFFF( "..userName.." )", client, 255,0,0, true)
- return
- elseif userName and password == passwordReEntry then
- local ipFromPlayerRegistered = getPlayerIP(client)
- local serialFromPlayerRegistered = getPlayerSerial(client)
- executeSQLInsert("accounts","'"..userName.."','"..password.."',0,'"..ipFromPlayerRegistered.."','"..serialFromPlayerRegistered.."'","accountname,accountpassword,level,ip,serial")
- outputChatBox("#FF0000Your account has been successfully created!#FFFFFF(User: "..tostring(userName)..", Password: "..tostring(password)..")",client,255,0,0,true)
- triggerClientEvent("onRegisterDone",getRootElement())
- end
- end
- end
- addEvent("onClientRegisterFinish",true)
- addEventHandler("onClientRegisterFinish",getRootElement(),registerPlayer)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement