08.06.2016, 16:01
Jake server you are no errors on /ban /oban
when I banned player, the player is not banned in the account file, the player can log back in sign in benned
and when I /unban No posts like this player is not in the database banned.
if you do not believe the test
when I banned player, the player is not banned in the account file, the player can log back in sign in benned
and when I /unban No posts like this player is not in the database banned.
Code:
CMD:ban(playerid, params[]) { LoginCheck(playerid); if(User[playerid][accountAdmin] >= 1) { new string[150], id, reason[128], when[128], ban_hr, ban_min, ban_sec, ban_month, ban_days, ban_years ; gettime(ban_hr, ban_min, ban_sec); getdate(ban_years, ban_month, ban_days); if(sscanf(params, "us[128]", id, reason)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /ban [playerid] [reason]"); if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "» "red"Player not connected."); if(User[playerid][accountAdmin] < User[id][accountAdmin]) { SendClientMessage(playerid, -1, "» "red"You cannot use this command on high ranking admin."); format(string, sizeof(string), "[NOTIFY] "white"%s has attempted to banned you with the reason %s.", GetName(playerid), reason); SendClientMessage(id, COLOR_ORANGE, string); format(string, sizeof(string), "%s has attempted to banned %s but failed for %s", GetName(playerid), GetName(id), reason); Log("admin.txt", string); return 1; } format(when, 128, "%02d/%02d/%d %02d:%02d:%02d", ban_month, ban_days, ban_years, ban_hr, ban_min, ban_sec); format(sInfo[last_bperson], 256, "%s", GetName(id)); format(sInfo[last_bwho], 256, "%s", reason); savestatistics(); AddBan(User[id][accountIP], 1); BanAcc(id, GetName(playerid), reason); ShowBan(id, GetName(playerid), reason, when); format(string, sizeof(string), "[BANNED] "white"%s has been banned by an admin for "grey"%s"white".", GetName(id), reason); SendPlayerMessage(COLOR_RED, string); format(string, sizeof(string), "[BANNED] "white"%s has been banned by %s for "grey"%s"white".", GetName(id), GetName(playerid), reason); SendAMessage(COLOR_RED, string); format(string, sizeof(string), "[BANNED] %s has been banned by %s for %s.", GetName(id), GetName(playerid), reason); Log("ban.txt", string); KickDelay(id); } else { SendClientMessage(playerid, -1, "» "red"You are not authorized to use this command."); } return 1; } CMD:unban(playerid, params[]) { LoginCheck(playerid); if(User[playerid][accountAdmin] >= 1) { 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; } CMD:oban(playerid, params[]) { LoginCheck(playerid); if(User[playerid][accountAdmin] >= 1) { new string[150], name[24], reason[128], Query[256], admin, ip[20], DBResult:Result, ban_hr, ban_min, ban_sec, ban_month, ban_days, ban_years ; gettime(ban_hr, ban_min, ban_sec); getdate(ban_years, ban_month, ban_days); if(sscanf(params, "s[24]s[128]", name, reason)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /oban [name in the data] [reason]"); foreach(new i : Player) { if(strcmp(GetName(i), name, true) == 0) { SendClientMessage(playerid, -1, "Player that you are trying to banned is online, /ban instead."); return 1; } } format(Query, sizeof(Query), "SELECT * FROM `users` WHERE `username` = '%s'", DB_Escape(name)); Result = db_query(Database, Query); if(db_num_rows(Result)) { db_get_field_assoc(Result, "admin", Query, 6); admin = strval(Query); db_get_field_assoc(Result, "IP", ip, 20); if(User[playerid][accountAdmin] < admin) { SendClientMessage(playerid, -1, "» "red"You cannot use this command on high ranking admin."); format(string, sizeof(string), "%s has attempted to offline banned %s but failed for %s", GetName(playerid), name, reason); Log("admin.txt", string); return 1; } format(sInfo[last_bperson], 256, "%s", name); format(sInfo[last_bwho], 256, "%s", reason); savestatistics(); AddBan(ip, 1); BanAccEx(name, ip, GetName(playerid), reason); format(string, sizeof(string), "[BANNED] "white"%s has been offline banned by an admin for "grey"%s"white".", name, reason); SendPlayerMessage(COLOR_RED, string); format(string, sizeof(string), "[BANNED] "white"%s has been offline banned by %s for "grey"%s"white".", name, GetName(playerid), reason); SendAMessage(COLOR_RED, string); format(string, sizeof(string), "[BANNED] %s has been offine banned by %s for %s.", name, GetName(playerid), reason); Log("ban.txt", string); } else { SendClientMessage(playerid, -1, "There is no such thing players in the server database."); } db_free_result(Result); } else { SendClientMessage(playerid, -1, "» "red"You are not authorized to use this command."); } return 1; }