2013martin1212 Posted October 6, 2015 Share Posted October 6, 2015 Hi all i try to create a login command with mysql , but when i try to log in then debugscript was give me this problems and this is my script local mysql = exports.cG_MySQL function loginPlayer (thePlayer, command, username, password ) if thePlayer and username and password then if getElementType(thePlayer) == "player" then local account = mysql:dbQuery("SELECT * FROM users WHERE username='" .. username .. "'") for i, sor in ipairs(account) do if sor["password"] == password then local lastLogin = getRealTime() if tostring(lastLogin.month+1):len() < 2 then lastLogin.month = "0" .. tostring(lastLogin.month)+1 end if tostring(lastLogin.monthday):len() < 2 then lastLogin.monthday = "0" .. tostring(lastLogin.monthday) end local lastLoginText = tostring(lastLogin.year+1900 .. "-" .. lastLogin.month .. "-" ..lastLogin.monthday) mysql:db_Exec("UPDATE users SET pLastLogin='" .. lastLoginText .. "' WHERE username='" .. username .. "'" ) mysql:db_Exec("UPDATE users SET pIP='" .. getPlayerIP(thePlayer) .. "' WHERE username='" .. username .. "'") mysql:db_Exec("UPDATE users SET pSerial='" ..getPlayerSerial(thePlayer) .. "' WHERE username='" .. username .. "'") local character = mysql:db_Query("SELECT * FROM characters WHERE accountname='" ..username .. "'") setElementData(thePlayer, "acc:adminLevel", sor["adminLevel"]) if character then outputChatBox("The character was ready to play!") for i, sor in ipairs(character) do setElementData(thePlayer, "acc:username", username) setPlayerMoney(thePlayer, sor["money"]) spawnPlayer(thePlayer, sor["pX"], sor["pY"], sor["pZ"], sor["pRot"], sor["pSkin"], sor["pInt"], sor["pDim"]) setElementData(thePlayer, "acc:legalChange", true) setPlayerName(thePlayer, sor["characterName"] ) setCameraTarget(thePlayer, thePlayer) end end else outputChatBox("Character nincs letrehozva!") end end end end end addCommandHandler("log-in", loginPlayer ) --Make it trigger for /log-in, NOTE:/login is hardcored and cannot be used. Link to comment
ALw7sH Posted October 8, 2015 Share Posted October 8, 2015 You are not using the export right Also you are not calling any function in your export 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