Unknown7 Posted March 7, 2021 Share Posted March 7, 2021 Hello there! I'm trying to get my old server back online, I'm currently having problems with the stats scripts, which kinda works since it returns the table info on servers, such as dms, wins, cash and etc, even the old stats from 2010. It also inserts the new account starting stats (1dms, 1win, $1000 cash). The problem is that new stats don't get saved. Checking the wiki I found executeSQLUpdate function is deprecated and I should use executeSQLQuery but I don't know exactly how to do it, so I'm asking for help. At least an example on how to do it with my script. Here is the server script using executeSQLUpdate function DBSave(playerName) if statsCash[playerName] then statsCash[playerName] = tonumber(statsCash[playerName]) executeSQLUpdate ("stats", "cash = '" .. statsCash[playerName] .. "', dms = '" .. statsDms[playerName] .. "', wins = '" .. statsWins[playerName] .. "', owner = '" .. statsOwner[playerName] .. "', skill = '" .. statsSpts[playerName] .. "', pts = '" .. statsPts[playerName] .. "'", "player = '" .. playerName .. "'") executeSQLUpdate ("userinfo", "sexage = '" .. infoSex[playerName] .. "', contact = '" .. infoContact[playerName] .. "', message = '" .. infoMsg[playerName] .. "', gametime = '" .. infoGametime[playerName] .. "', seen = '" .. infoSeen[playerName] .. "', lock = '" .. infoLock[playerName] .. "', rating = '" .. infoPrate[playerName] .. "', votes = '" .. infoPvote[playerName] .. "', messageon = '" .. infoMsgon[playerName] .. "'", "player = '" .. playerName .. "'") executeSQLUpdate ("settings", "carcolor1 = '" .. settVColor1[playerName] .. "', carcolor2 = '" .. settVColor2[playerName] .. "', skin = '" .. settSkin[playerName] .. "', namecolor = '" .. settCColor[playerName] .. "', chatcolor = '" .. settTColor[playerName] .. "'", "player = '" .. playerName .. "'") executeSQLUpdate ("xstats", "abooms = '" .. statsX[playerName..'abooms'] .. "', akicks = '" .. statsX[playerName..'akicks'] .. "', abans = '" .. statsX[playerName..'abans'] .. "', pbooms = '" .. statsX[playerName..'pbooms'] .. "', pkicks = '" .. statsX[playerName..'pkicks'] .. "', pbans = '" .. statsX[playerName..'pbans'] .. "', spins = '" .. statsX[playerName..'spins'] .. "', cashin = '" .. statsX[playerName..'cashin'] .. "', cashout = '" .. statsX[playerName..'cashout'] .. "', rolls = '" .. statsX[playerName..'rolls'] .. "'", "player = '" .. playerName .. "'") end end Everything else in the server is working fine, thank you in advance. Link to comment
SpecT Posted March 7, 2021 Share Posted March 7, 2021 (edited) Welcome to the forums! For all the SQL operations you should use executeSQLQuery as you have already noticed. There are many examples in the wiki page which you could use. I will show you an example how your first executeSQLUpdate will be with executeSQLQuery. executeSQLQuery("UPDATE stats SET cash=?, dms=?, wins=?, owner=?, skill=?, pts=? WHERE player=?", statsCash[playerName], statsDms[playerName], statsWins[playerName], statsOwner[playerName], statsSpts[playerName], statsPts[playerName], playerName) I guess now you know how to make the other ones. Don't hesitate to ask if there is a problem! Edited March 7, 2021 by SpecT 1 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