Jump to content

Help to get internal.db informations


Recommended Posts

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 by Gabriel1375
Link to comment

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
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...