MySQL dont load users items - 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 dont load users items (
/showthread.php?tid=466846)
MySQL dont load users items -
Tutrix - 29.09.2013
Hey, I got a problem with my MySQL account system. It refuses to give players their stats.
This is my loadstats:
pawn Код:
stock LoadStats(playerid)
{
new Query[1024],result[200];
format(Query, sizeof(Query), "SELECT * FROM `users` WHERE `Username` = '%s'", GetPName(playerid));
mysql_query(Query);
mysql_fetch_field("AdminLevel", result);
PlayerInfo[playerid][pAdmin] = strval(result);
PlayerInfo[playerid][Logged] = 1;
gPlayerLogged[playerid] = 1;
mysql_store_result();
mysql_free_result();
return 1;
}
Dont know why it refuses to give the players their admin
Re: MySQL dont load users items -
Konstantinos - 29.09.2013
It goes like that:
Executing query.
Storing result.
Assigning data somewhere.
Freeing result.
Re: MySQL dont load users items -
Tutrix - 29.09.2013
So how should it be?
Re: MySQL dont load users items -
Konstantinos - 29.09.2013
pawn Код:
stock LoadStats(playerid)
{
new Query[64],result[6]; // beware of the lenght - count to be sure!
format(Query, sizeof(Query), "SELECT * FROM `users` WHERE `Username` = '%s'", GetPName(playerid));
mysql_query(Query);
mysql_store_result();
if(mysql_num_rows() != 0) mysql_fetch_field("AdminLevel", result);
PlayerInfo[playerid][pAdmin] = strval(result);
PlayerInfo[playerid][Logged] = 1;
gPlayerLogged[playerid] = 1; // double ??
mysql_free_result();
return 1;
}
Re: MySQL dont load users items -
Tutrix - 29.09.2013
oh okey! thank you
And I was going to add more stats, it was just for testing with the admin lvl
Re: MySQL dont load users items -
Tutrix - 29.09.2013
still dosent work