CMD:unban(playerid,params[])
{
new query[126];
new usertounban[24];
if(sscanf(params, "u[24]", usertounban)) return SendClientMessage(playerid,-1,"{FF0000}__**ERROR**__ {FFFFFF}Usage /Unban <Username>");
if(PlayerInfo[playerid][pAdmin] < 5) return SendClientMessage(playerid, -1, "{FF0000}__**ERROR**__ {FFFFFF} You are not authorized to use that command!");
format(query, sizeof(query), "SELECT * FROM 'BannedAccounts' WHERE 'UserName' = %s ", usertounban);
mysql_tquery(mysql, query,"CheckBan","d",playerid);
printf("%s",query);
printf("%s",usertounban);
print("CMD:unban -- properly executed");
return 1;
}
What I would actually do, instead of u[24], use a s[24] and check to see if that string is an actual account or whatever, that actually might be your problem cause I don't really see nothing wrong with it.
|
public CheckBan(playerid)
{
print("CheckBan is working");
if(cache_num_rows() >=1)
{
SendClientMessage(playerid,-1,"{FF0000}__**INFO**__ {FFFFFF} Username found, now you should finish the code!");
}
else
{
SendClientMessage(playerid,-1,"{FF0000}__**ERROR**__ {FFFFFF} Username not found in our database!");
}
return 1;
}
SELECT * FROM `BannedAccounts` WHERE `UserName` = %s
You are using the incorrect MySQL query syntax in your /unban command. In other words, table and column names must be enclosed in grave accents (`), not singular quotes.
Try: pawn Код:
|
SELECT * FROM `BannedAccounts` WHERE `UserName` = '%s'