Gabriel1375 Posted March 20, 2017 Share Posted March 20, 2017 (edited) Hello, so i have this script that gets the rank / experience from the player, and save in another database, to backup the rank/exp, because we need to reset the accounts, as it has more than 6000 accounts and its lagging because of this, and i want to know how to connect to the internal.db and get the informations, the function to get the information: rank, experience from internal.db ? The script: local dbConnection = dbConnect("sqlite", "backupexprank.db") local qh = dbQuery( dbConnection,"CREATE TABLE IF NOT EXISTS accounts (nomeconta text,patente text,experiencia text)") dbFree( qh ) function saveStat(sourcePlayer) local account = getPlayerAccount(sourcePlayer) local nomeconta = getAccountName(account) local patente = getAccountData(account, "rank") local experiencia = getPlayerIP(account, "experience") local qh = dbQuery( dbConnection, "SELECT * FROM accounts where nomeconta=?",nomeconta) local res = dbPoll(qh,-1) dbFree( qh ) if #res > 0 then dbExec( dbConnection, "UPDATE accounts SET experiencia=? where nomeconta=? ", experiencia,nomeconta ) dbExec( dbConnection, "UPDATE accounts SET patente=? where nomeconta=? ", patente,nomeconta ) outputChatBox ( "Saved account " .. nomeconta .. " with the rank " .. patente .. " with the exp at" .. experiencia ..) else dbExec(dbConnection, "INSERT INTO accounts VALUES(?, ?, ?)", nomeconta, patente, experiencia) outputChatBox ( "Saved account " .. nomeconta .. " with the rank " .. patente .. " with the exp at" .. experiencia ..) end end addCommandHandler("savestats", saveStat) Ty !!! Edited March 20, 2017 by Gabriel1375 Link to comment
#BrosS Posted March 20, 2017 Share Posted March 20, 2017 you can use that i think http://sqlitebrowser.org/ Link to comment
Gabriel1375 Posted March 20, 2017 Author Share Posted March 20, 2017 No, that's not what i'm saying, i want that THE SCRIPT connect to the database and get the information, and store it to a variable, the information RANK and EXP, because we need to reset the server and want to make and /save command, to save the stats and restore it after the database resetting, we can't do it manually, as we have more than 6000 accounts... Link to comment
Ayush Rathore Posted March 21, 2017 Share Posted March 21, 2017 15 hours ago, Gabriel1375 said: No, that's not what i'm saying, i want that THE SCRIPT connect to the database and get the information, and store it to a variable, the information RANK and EXP, because we need to reset the server and want to make and /save command, to save the stats and restore it after the database resetting, we can't do it manually, as we have more than 6000 accounts... wait i will give you how to do that Link to comment
Addlibs Posted March 21, 2017 Share Posted March 21, 2017 You could try a for-loop on getAllAccounts() but with that many accounts it will probably freeze up your server and maybe even get aborted by MTA for taking too long to execute, so you should limit how many accounts it does every second or so. 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