24.06.2011, 01:47
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.
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;
}