Mysql troubles? - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Mysql troubles? (
/showthread.php?tid=263915)
Mysql troubles? -
Rokzlive - 24.06.2011
I got a function thats supposed to check if a person owns to many vehicles, but every time its called, it says the command cannot be called because the connection is dead. But, when i comment this out, the connection does not die. So this thing does not workj and somehow kills the mysql connection.
Can someone try to help? I talked to Lethal on xfire, and he cant even find the problem.
pawn Код:
public CheckCars(playerid)
{
new query[1000], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(query, sizeof(query), "SELECT * FROM `vehicles` WHERE `Owner` = '%s'", pname);
mysql_query(query);
new rows = mysql_num_rows();
if(rows > playerdata[playerid][MaxCars])
{
new string[250];
format(string,sizeof(string),"NOTICE: You own %d cars but you only have %d slots! You must sell your extra cars or risk being banned!",rows, playerdata[playerid][MaxCars]);
SendClientMessage(playerid,COLOR_RED,string);
}
mysql_free_result();
return 1;
}
Re: Mysql troubles? -
Donya - 24.06.2011
why are u doing new query[1000]? lol... that should be like 96..
and new string[250];? max chat is 128..
is there a query called before CheckCars(playerid) ?