SA-MP Forums Archive
MySQL R7 problem - 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: MySQL R7 problem (/showthread.php?tid=397104)



MySQL R7 problem - CONTROLA - 03.12.2012

Hey guys!

pawn Код:
new qstr[200];
format(qstr,200,"SELECT * FROM `players` WHERE `username`='%s';",plname);
mysql_function_query(g_Handle, qstr, true, "OnPlayerCheckAccount", "i", playerid);
^ I've got the code above but sometimes the variable isn't set correctly. Is the code wrong?

pawn Код:
forward OnPlayerCheckAccount(playerid);
public OnPlayerCheckAccount(playerid)
{
    new rows, fields;
    cache_get_data(rows, fields);
    if(rows)
    {
        gPlayerAccount[playerid] = 1;
        cache_get_row(0, 2, PlayerInfo[playerid][pKey], g_Handle);
    }
    else
    {
        gPlayerAccount[playerid] = 0;
    }
}
Please help me!