Error in SQLite. Arguement type mismatch error. - 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: Error in SQLite. Arguement type mismatch error. (
/showthread.php?tid=437562)
Error in SQLite. Arguement type mismatch error. -
electrux - 16.05.2013
OK. so here is the code:
Код:
stock IsPlayerLoggedIn(playerid)
{
new query[500],name[50],DBResult:res;
new loggedin;
GetPlayerName(playerid,name,sizeof(name));
format(query,sizeof(query),"SELECT * FROM `USERS` WHERE `Name` = '%s'",DB_Escape(name));
res = db_query(users,query);
if(db_num_rows(res))
{
db_get_field_assoc(res,"LoggedIn",loggedin,2);
}
db_free_result(res);
if(loggedin == 1) return 1;
else return 0;
}
Error is:
Код:
error 035: argument type mismatch (argument 3)
Why is it showing error? :-/
Re: Error in SQLite. Arguement type mismatch error. -
[HiC]TheKiller - 16.05.2013
db_get_field_assoc returns a string. You're assigning a single integer value to it. If you want to make it an int, do the following
pawn Код:
stock IsPlayerLoggedIn(playerid)
{
new query[500],name[50],DBResult:res, str[10];
new loggedin;
GetPlayerName(playerid,name,sizeof(name));
format(query,sizeof(query),"SELECT * FROM `USERS` WHERE `Name` = '%s'",DB_Escape(name));
res = db_query(users,query);
if(db_num_rows(res))
{
db_get_field_assoc(res,"LoggedIn",str,2);
loggedin = strval(str);
}
db_free_result(res);
if(loggedin == 1) return 1;
else return 0;
}
Re: Error in SQLite. Arguement type mismatch error. -
electrux - 16.05.2013
oh... it works. THANKS