Mysql troubles?
#1

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;
}
Reply
#2

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) ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)