Én kaptam egy módba lehet át kell írni kicsit:
COMMAND:rangeban(playerid, params[])
{
// Setup local variables
new PlayerToBan, PlayerIP[16], FirstPartsOfIP[16], BanCmd[24], Reason[128], Msg[128], Name[24], AdminName[24];
// Check if the player has logged in
if (APlayerData[playerid][LoggedIn] == true)
{
// Check if the player\'s admin-level is at least 3
if (APlayerData[playerid][PlayerLevel] >= 3)
{
if (sscanf(params, \"us[128]\", PlayerToBan, Reason))
SendClientMessage(playerid, 0xFF0000AA, \"Usage: \\\"/rangeban <PlayerToBan> <Reason>\\\"\");
else
{
if (IsPlayerConnected(PlayerToBan))
{
// Get the names of the player and the admin who executed the ban
GetPlayerName(playerid, AdminName, sizeof(AdminName));
GetPlayerName(PlayerToBan, Name, sizeof(Name));
// Get the player\'s IP-address
GetPlayerIp(PlayerToBan, PlayerIP, 16);
// Inform the player about his ban
format(Msg, 128, \"{FF0000}You have been ip-range-banned permanently by {FFFF00}%s\", AdminName);
SendClientMessage(PlayerToBan, 0xFFFFFFFF, Msg);
format(Msg, 128, \"{FF0000}Reason: {FFFF00}%s\", Reason);
SendClientMessage(PlayerToBan, 0xFFFFFFFF, Msg);
// Get the first three digits from the player\'s ip, so the fourth part can be added from 0 to 255
FirstPartsOfIP = GetFirstThreeDigitsFromIP(PlayerIP);
// Ban the entire range of IP-addresses of the player
for (new i; i < 256; i++)
{
format(BanCmd, 24, \"banip %s%i\", FirstPartsOfIP, i); // Construct the RCon command to ban every IP
SendRconCommand(BanCmd); // Execute the command
}
// Finally kick the player (the RCon command doesn\'t kick you out automatically)
Kick(PlayerToBan);
// Inform everybody else which player was ip-range-banned
format(Msg, 128, \"{808080}%s %s has ip-range-banned {FFFF00}%s\", AdminLevelName[APlayerData[playerid][PlayerLevel]], AdminName, Name);
SendClientMessageToAll(0xFFFFFFFF, Msg);
}
}
}
else
return 0;
}
else
return 0;
return 1;
}