FlyingSpoon Posted April 25, 2015 Share Posted April 25, 2015 CLIENT-SIDE function loggingMenu() loginBtn = guiCreateButton(309, 491, 131, 29, "Login", false) loginUser = guiCreateEdit(299, 425, 157, 25, "Username", false) loginPass = guiCreateEdit(299, 460, 157, 25, "Password", false) end function logPlayer(button,state) if (button == "left" and state == "up") then if (source == loginBtn) then loggingUsername = guiGetText(loginUser) loggingPassword = guiGetText(loginPass) triggerServerEvent("acceptLogin", localPlayer, loggingUsername, loggingPassword) end end end addEventHandler("onClientGUIClick", getRootElement(), logPlayer) SERVER-SIDE function logPlayer(loggingUsername, loggingPassword) if loggingUsername ~= "" then if loggingPassword ~= "" then local account = getAccount(loggingUsername,loggingPassword) if ( account ~= false ) then logIn( source, loggingUsername, loggingPassword ) outputChatBox("You have successfully logged in!", source) triggerClientEvent(source,"hideMenu",getRootElement()) else outputChatBox("There was an error! Please contact an administrator!", source) end end end end addEvent("acceptLogin",true) addEventHandler("acceptLogin",getRootElement(),logPlayer) WARNING: Bad argument @ 'logIn' [Expected account at argument 2, got string 'RaysMTA'] Link to comment
Enargy, Posted April 25, 2015 Share Posted April 25, 2015 change logIn( source, loggingUsername, loggingPassword ) to: logIn( source, account, loggingPassword ) Link to comment
FlyingSpoon Posted April 25, 2015 Author Share Posted April 25, 2015 Ty, Last problem - [2015-04-25 22:55:53] WARNING: Bad argument @ 'getAccount' [Expected string at argument 1, got boolean] [2015-04-25 22:55:53] WARNING: Bad argument @ 'addAccount' [Expected string at argument 1, got boolean] function regPlayer(registerUsername, registerPassword) if registerUsername ~= "" then if registerPassword ~= "" then local account = getAccount(registerUsername, registerPassword) if account == false then local addAcc = addAccount(registerUsername, registerPassword) if (addAcc) then triggerClientEvent(source,"hideMenu",getRootElement()) outputChatBox("You have successfully registered!", source) else outputChatBox("There was an error! Please contact an administrator!", source) end end end end end addEvent("acceptRegister",true) addEventHandler("acceptRegister",getRootElement(),regPlayer) Link to comment
Enargy, Posted April 25, 2015 Share Posted April 25, 2015 function regPlayer(registerUsername, registerPassword) if registerUsername ~= "" then if registerPassword ~= "" then local account = addAccount(registerUsername,registerPassword) if account then triggerClientEvent(source,"hideMenu",getRootElement()) outputChatBox("You have successfully registered!", source) else outputChatBox("There was an error! Please contact an administrator!", source) end end end end addEvent("acceptRegister",true) addEventHandler("acceptRegister",getRootElement(),regPlayer) Link to comment
FlyingSpoon Posted April 25, 2015 Author Share Posted April 25, 2015 [2015-04-25 23:03:33] WARNING: server.lua:4: Bad argument @ 'addAccount' [Expected string at argument 1, got boolean] Link to comment
Enargy, Posted April 25, 2015 Share Posted April 25, 2015 [2015-04-25 23:03:33] WARNING: server.lua:4: Bad argument @ 'addAccount' [Expected string at argument 1, got boolean] it should be work fine. post your Register code. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now