SQLite help - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: SQLite help (
/showthread.php?tid=293579)
SQLite help -
FireCat - 29.10.2011
pawn Код:
function LoginPlayer(playerid)
{
new DBResult: Result;
format(Query, sizeof(Query),"SELECT * FROM `Users` WHERE `Username` = '%s'", GetPName(playerid));
Result = db_query(Users,Query);
new Field[30];
db_get_field_assoc(Result, "Money", Field, 30);
PInfo[playerid][Money] = strval(Field);
db_get_field_assoc(Result, "Jailed", Field, 30);
PInfo[playerid][Jailed] = strval(Field);
db_get_field_assoc(Result, "Jailtime", Field, 30);
PInfo[playerid][Jailtime] = strval(Field);
GivePlayerMoney(playerid,PInfo[playerid][Money]);
PInfo[playerid][Logged] = 1;
db_free_result(Result);
return 1;
}
When the player disconnects from the server, it saves the stats. (I printed it)
But when he logs in, and I print the previous vars, it prints (null).
Whats wrong?
Re: SQLite help -
DRIFT_HUNTER - 29.10.2011
Im not sure how much MySql and sqlite are similar but in mysql you need to store result so i guess in sqllite you need to....
Re: SQLite help -
ahbir_jhon - 29.10.2011
yes DRIFT _HUNTER right
Re: SQLite help -
Zh3r0 - 29.10.2011
Quote:
Originally Posted by ahbir_jhon
yes DRIFT _HUNTER right
|
No shit Sherlock.
He solved the problem. He forgot to add the Robbed and HasRobbed columns.
And he was actually trying to store values to those 2 columns, and since those don't exist the whole query stops.
Re: SQLite help -
FireCat - 29.10.2011
Quote:
Originally Posted by Zh3r0
No shit Sherlock.
He solved the problem. He forgot to add the Robbed and HasRobbed columns.
And he was actually trying to store values to those 2 columns, and since those don't exist the whole query stops.
|
Thanks! (:
Rep :b