[Sqlite] query player that is not online

Started by kennedyarz, Apr 29, 2017, 12:24 PM

Previous topic - Next topic

kennedyarz

There is some way to obtain and modify data of a player which is stored in a database Sqlite but not available in the game "online"?

EK.IceFlake

SQLi:
Inst.exec("update players set kills = ? where lower(name) = '?'", 16, "kennedyarz");Official:
QuerySQL(Inst, "update player set kills = " + 16 + " where lower(name) = '" + escapeSQLString(player.Name.tolower()) + "'");

kennedyarz

Quote from: EK.IceFlake on Apr 29, 2017, 12:33 PMSQLi:
Inst.exec("update players set kills = ? where lower(name) = '?'", 16, "kennedyarz");Official:
QuerySQL(Inst, "update player set kills = " + 16 + " where lower(name) = '" + escapeSQLString(player.Name.tolower()) + "'");

There is only talking about a change in the database (could explain in a simple command for me) and also on the query (just to know the data of a player not connected "simple cmd") I would appreciate it.

KrlozZ...

well i uses it for get accinfo.

local q = QuerySQL( db, "SELECT * FROM table WHERE Name LIKE '"+text.tolower()+"'" );
if ( !q ) MessagePlayer ( "No exist that name.",player)

hope it's what you was asking.

kennedyarz

Is only checking if an account exists or not, I do not want that, I need something like

local q = QuerySQL (db, "SELECT * FROM tabla WHERE nombre LIKE ' "+ text.tolower () +"'");
MessagePlayer ( ""+text+" Kills "+ GetSQLColumnData(q, 2) +" Level "+ GetSQLColumnData(q, 3) + "", player)

KrlozZ...

Quote from: kennedyarz on Apr 30, 2017, 04:33 AMIs only checking if an account exists or not, I do not want that, I need something like

local q = QuerySQL (db, "SELECT * FROM tabla WHERE nombre LIKE ' "+ text.tolower () +"'");
MessagePlayer ( ""+text+" Kills "+ GetSQLColumnData(q, 2) +" Level "+ GetSQLColumnData(q, 3) + "", player)

well i gave you that thinking thats what u wanted, you did the message.

so now you want modify it ?

just make another command like this:

*/
if(cmd=="modifyaccount")
{
if( !text ) MessagePlayer("Use /"+cmd+" <player> <kills> <Deaths> <Level>.", player);
else {
local TextSplit = split( text, " " ),plr=TextSplit[ 0 ],kills=TextSplit[ 1 ],deaths=TextSplit[ 2 ],level=TextSplit[ 3 ];
if (!plr) MessagePlayer("invalid player.",player);
else if ( !IsNum(kills)) MessagePlayer("Only numbers.", player);
else if (!deaths) {
QuerySQL( db, "UPDATE table SET kills='"+kills+"' WHERE Name='"+plr+"'" );
}
else if ( !IsNum(deaths)) MessagePlayer("Only numbers.", player);
else if (!level) {
QuerySQL( db, "UPDATE table SET kills='"+kills+"' WHERE Name='"+plr+"'" );
QuerySQL( db, "UPDATE table SET deaths='"+deaths+"' WHERE Name='"+plr+"'" );
}
else if ( !IsNum(level)) MessagePlayer("Only numbers.", player);
else {
QuerySQL( db, "UPDATE table SET kills='"+kills+"' WHERE Name='"+plr+"'" );
QuerySQL( db, "UPDATE table SET deaths='"+deaths+"' WHERE Name='"+plr+"'" );
QuerySQL( db, "UPDATE table SET level='"+deaths+"' WHERE Name='"+plr+"'" );
}
}
}
*/

have no tested. ._. im newbie in script so i dont know if it will really will work, just modify it :P