mysql_ban_connect(const host[], const user[], const database[], const password[]);
mysql_ban_connect("localhost", "root", "server_samp", "password");
bool:mysql_ban_player_check(Find[])
//CHECKING THE NAME GetPlayerName(playerid, Name, 24); if(mysql_ban_player_check(Name) == true) { //Player On } else { //Player Off } //CHECKING THE IP GetPlayerIp(playerid, IP, 16); if(mysql_ban_player_check(IP) == true) { //Player On } else { //Player Off }
mysql_ban_player(Player_Name[], Player_IP[], Ban_By[], Reason[], Ban_Type, Time);
mysql_ban_player("UserName", "127.0.0.1", "F1N4L", "TEST", PERMANENT, 0);
mysql_ban_remove(Banned[]);
//CHECKING THE NAME if(mysql_ban_player_check("F1N4L") == true) { //Column found } else { //Column not found } //CHECKING THE IP if(mysql_ban_player_check("127.0.0.1") == true) { //Column found } else { //Column not found }
mysql_banned_check(playerid);
public OnFilterScriptInit() // or OnGameModeInit { mysql_ban_connect("localhost", "root", "server_samp", "password"); return 1; }
CMD:banname(playerid, params[]) { new BannedName[24], BannedByName[24], Reason[20], BanType, Time, String[128]; if(sscanf(params, "s[24]iis[20]", BannedName, BanType, Time, Reason)) return SendClientMessage(playerid, -1, "/ban [name] [Tipo: 0 = permanent | 1 = minutes | 2 = hours | 3 = days] [time] [reason]"); if(BanType < 0 || BanType > 3) return SendClientMessage(playerid, -1, "Incorrect type of ban! Uses: 0 = permanent | 1 = minutes | 2 = hours | 3 = days"); GetPlayerName(playerid, BannedByName, sizeof BannedByName); if(mysql_ban_player_check(BannedName) == true) { switch(BanType) { case 0: format(String, sizeof String, "Admin% s Online banned player %s. Reason: %s. Time: PERMANENT", BannedByName, BannedName, Reason); case 1: format(String, sizeof String, "Admin% s Online banned player %s. Reason: %s. Time: %i Minutes", BannedByName, BannedName, Reason, Time); case 2: format(String, sizeof String, "Admin% s Online banned player %s. Reason: %s. Time: %i Hours", BannedByName, BannedName, Reason, Time); case 3: format(String, sizeof String, "Admin% s Online banned player %s. Reason: %s. Time: %i Days", BannedByName, BannedName, Reason, Time); } } else { switch(BanType) { case 0: format(String, sizeof String, "Admin% s Offline banned player %s. Reason: %s. Time: PERMANENT", BannedByName, BannedName, Reason); case 1: format(String, sizeof String, "Admin% s Offline banned player %s. Reason: %s. Time: %i Minutes", BannedByName, BannedName, Reason, Time); case 2: format(String, sizeof String, "Admin% s Offline banned player %s. Reason: %s. Time: %i Hours", BannedByName, BannedName, Reason, Time); case 3: format(String, sizeof String, "Admin% s Offline banned player %s. Reason: %s. Time: %i Days", BannedByName, BannedName, Reason, Time); } } SendClientMessageToAll(-1, String); mysql_ban_player(BannedName, "0.0.0.0", BannedByName, Reason, BanType, Time); return 1; } CMD:banip(playerid, params[]) { new BannedIP[24], BannedByName[24], Reason[20], BanType, Time, String[128]; if(sscanf(params, "s[16]iis[20]", BannedIP, BanType, Time, Reason)) return SendClientMessage(playerid, -1, "/ban [name] [Tipo: 0 = permanent | 1 = minutes | 2 = hours | 3 = days] [time] [reason]"); if(BanType < 0 || BanType > 3) return SendClientMessage(playerid, -1, "Incorrect type of ban! Uses: 0 = permanent | 1 = minutes | 2 = hours | 3 = days"); GetPlayerName(playerid, BannedByName, sizeof BannedByName); if(mysql_ban_player_check(BannedIP) == true) { switch(BanType) { case 0: format(String, sizeof String, "Admin% s Online banned the IP range's. Reason: %s. Time: PERMANENT", BannedByName, BannedIP, Reason); case 1: format(String, sizeof String, "Admin% s Online banned the IP range's. Reason: %s. Time: %i Minutes", BannedByName, BannedIP, Reason, Time); case 2: format(String, sizeof String, "Admin% s Online banned the IP range's. Reason: %s. Time: %i Hours", BannedByName, BannedIP, Reason, Time); case 3: format(String, sizeof String, "Admin% s Online banned the IP range's. Reason: %s. Time: %i Days", BannedByName, BannedIP, Reason, Time); } } else { switch(BanType) { case 0: format(String, sizeof String, "Admin% s Offline banned the IP range's. Reason: %s. Time: PERMANENT", BannedByName, BannedIP, Reason); case 1: format(String, sizeof String, "Admin% s Offline banned the IP range's. Reason: %s. Time: %i Minutes", BannedByName, BannedIP, Reason, Time); case 2: format(String, sizeof String, "Admin% s Offline banned the IP range's. Reason: %s. Time: %i Hours", BannedByName, BannedIP, Reason, Time); case 3: format(String, sizeof String, "Admin% s Offline banned the IP range's. Reason: %s. Time: %i Days", BannedByName, BannedIP, Reason, Time); } } SendClientMessageToAll(-1, String); mysql_ban_player("N/A", BannedIP, BannedByName, Reason, BanType, Time); return 1; } CMD:banid(playerid, params[]) { new Banned, BannedIP[24], BannedName[24], BannedByName[24], Reason[20], BanType, Time, String[128]; if(sscanf(params, "uiis[20]", Banned, BanType, Time, Reason)) return SendClientMessage(playerid, -1, "/ban [id/name] [Tipo: 0 = permanent | 1 = minutes | 2 = hours | 3 = days] [time] [reason]"); if(!IsPlayerConnected(Banned)) return SendClientMessage(playerid, -1, "Jogador nгo conectado!"); if(BanType < 0 || BanType > 3) return SendClientMessage(playerid, -1, "Incorrect type of ban! Uses: 0 = permanent | 1 = minutes | 2 = hours | 3 = days"); GetPlayerName(playerid, BannedByName, sizeof BannedByName); GetPlayerName(Banned, BannedName, sizeof BannedName); GetPlayerIp(Banned, BannedIP, sizeof BannedIP); if(mysql_ban_player_check(BannedIP) == true) { switch(BanType) { case 0: format(String, sizeof String, "Admin% s Online banned player %s [IP: %s]. Reason: %s. Time: PERMANENT", BannedByName, BannedName, BannedIP, Reason); case 1: format(String, sizeof String, "Admin% s Online banned player %s [IP: %s]. Reason: %s. Time: %i Minutes", BannedByName, BannedName, BannedIP, Reason, Time); case 2: format(String, sizeof String, "Admin% s Online banned player %s [IP: %s]. Reason: %s. Time: %i Hours", BannedByName, BannedName, BannedIP, Reason, Time); case 3: format(String, sizeof String, "Admin% s Online banned player %s [IP: %s]. Reason: %s. Time: %i Days", BannedByName, BannedName, BannedIP, Reason, Time); } SendClientMessageToAll(-1, String); } else SendClientMessage(playerid, -1, "Player ID don't connected!"); mysql_ban_player(BannedName, BannedIP, BannedByName, Reason, BanType, Time); return 1; } CMD:banremove(playerid, params[]) { if(isnull(params)) return SendClientMessage(playerid, -1, "/banremove [name/ip]"); if(mysql_ban_remove_check(params) == true) { mysql_ban_remove(params); SendClientMessage(playerid, -1, "Player/IP found and successfully unbanned!"); } else SendClientMessage(playerid, -1, "Player/IP not found in the database!"); return 1; }
Great job on this! My only 'quibble' would be the display, it seems a little garish? Nevertheless, script looks great
|