27.08.2015, 22:16
pawn Код:
CMD:unban(playerid, params[])
{
if(dAdmin[playerid][USER_ADMIN] != 3) return 0;
if(isnull(params)) SendClientMessage(playerid, -1, "[USAGE]/unban (name)");
else if(!(3 <= strlen(params) < MAX_PLAYER_NAME)) SendClientMessage(playerid, -1, "Player name must be between 3-24 characters");
else
{
new name[MAX_PLAYER_NAME], string[128], DBResult:Result;
format(string, sizeof(string), "SELECT banned FROM users WHERE username = '%e'",name); // %e is for samp 0.3.7
Result = db_query(Database, string);
new rows = db_num_rows(Result);
db_free_result(Result);
if(rows)
{
format(string, sizeof(string), "UPDATE users SET banned = 0 WHERE username = '%e'", name);
db_free_result(db_query(Database, string));
format(string, sizeof(string), "Player %s's ban was set to 0.", name);
print(string);
}
}
return 1;
}