27.08.2015, 21:57
I have created an unban command using SQLite but the command would not work, also sscanf isn't being called when I don't type the name of the player, also nothing is being printed into the console after doing the command.
pawn Код:
CMD:unban(playerid, params[])
{
new name[24], string[128], Query[500], DBResult:Result;
if(dAdmin[playerid][USER_ADMIN] == 3)
{
if(sscanf(params, "s[24]", name))
{
SendClientMessage(playerid, -1, "[USAGE]/unban (name)");
return 1;
}
format(Query, sizeof(Query), "SELECT banned FROM users WHERE username = '%s'", DB_Escape(name));
Result = db_query(Database, Query);
if(db_num_rows(Result))
{
format(Query, sizeof(Query), "UPDATE users SET banned = 0 WHERE username = '%s'", DB_Escape(name));
Result = db_query(Database, Query);
format(string, sizeof(string), "Player %s's ban was set to 0.", name);
print(string);
}
db_free_result(Result);
return 1;
}
return 1;
}