23.05.2014, 17:03
You should use cache_num_rows() as DobbysGamertag said.
EDIT: This is a fast example taken from my gamemode, don't copy and paste you should modify it first!
pawn Код:
new query[126];
format(query, sizeof(query), "SELECT * FROM bantable WHERE BannedName = '%s' AND status = 1", GetPlayerNameEx(playerid));//Firstly we should select everything from your ban table however you named it.
mysql_tquery(mysql, query,"BanResults","i",playerid); //now we added a call back to check if this name is banned or not,
forward BanResults(playerid);
public BanResults(playerid)
{
if(cache_num_rows(mysql) >=1)
{
//if this name was found.
}
else
{
//cannot find
}
return 1;
}