13.04.2015, 05:51
(
Последний раз редактировалось Shadow5; 20.04.2015 в 06:49.
Причина: Solved
)
pawn Код:
CMD:unban(playerid, params[])
{
LoginCheck(playerid);
if(User[playerid][accountAdmin] >= 2)
{
new
string[150],
Account[24],
DBResult:Result,
Query[129],
fIP[30]
;
if(sscanf(params, "s[24]", Account)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /unban [account name]");
format(Query, 129, "SELECT FROM `bans` WHERE `username` = '%s'", Account);
Result = db_query(Database, Query);
if(db_num_rows(Result))
{
db_get_field_assoc(Result, "ip", fIP, 30);
if(CheckBan(fIP))
{
RemoveBan(fIP);
}
format(Query, 129, "DELETE FROM `bans` WHERE `username` = '%s'", Account);
Result = db_query(Database, Query);
db_free_result(Result);
format(string, sizeof string, "[UNBANNED] "white"%s has been unbanned by an admin.", Account);
SendPlayerMessage(COLOR_ORANGE, string);
format(string, sizeof string, "[UNBANNED] "white"%s has been unbanned by %s.", Account, GetName(playerid));
SendAMessage(COLOR_ORANGE, string);
format(string, sizeof string, "[UNBANNED] %s has been unbanned by %s.", Account, GetName(playerid));
Log("ban.txt", string);
}
else
{
db_free_result(Result);
SendClientMessage(playerid, -1, "» "red"Player is not in the banned database.");
return 1;
}
}
else
{
SendClientMessage(playerid, -1, "» "red"You are not authorized to use this command.");
}
return 1;
}
Screenshots of SQlite DB :
-Links removed due to IPs in the Screenshots !
__________________