Код:
if(strcmp(cmd, "/rangeban", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /rangeban [playerid/PartOfName] [reason]");
return 1;
}
giveplayerid = ReturnUser(tmp);
// if(IsPlayerNPC(giveplayerid)) return 1;
if(PlayerInfo[playerid][pAdmin] >= 1337)
{
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
strmid(giveplayer, PlayerRPName(giveplayerid), 0, MAX_PLAYER_NAME);
strmid(sendername, PlayerRPName(playerid), 0, MAX_PLAYER_NAME);
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[96];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /rangeban [playerid/PartOfName] [reason]");
return 1;
}
new IP[16];
new logstring[128];
new year, month, day;
getdate(year, month, day);
if(UseAdmCmdTimer[playerid] > 2)
{
GetPlayerIp(playerid, IP, sizeof(IP));
format(logstring, sizeof(logstring), "%s [%d/%d/%d] Name: %s Key: %s Reason: Spam.", IP, day, month, year,sendername,PlayerInfo[playerid][pKey]);
BanLog(logstring);
format(string, sizeof(string), "{FF6347}SERVER: %s was banned, reason: Spam.", sendername);
SendClientMessageToAll(COLOR_WHITE, string);
PlayerInfo[playerid][pBand] = 3;
PlayerInfo[playerid][pPermBand] = 1;
format(string, sizeof(string), "Ban Reason: Spam - Banned by: Autoban");
strmid(PlayerInfo[playerid][pBanReason], string, 0, strlen(string), 255);
BanEx(playerid, "Banned By: Autoban Reason: Spam");
return 1;
}
if(PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin])
{
GetPlayerIp(playerid, IP, sizeof(IP));
format(logstring, sizeof(logstring), "%s [%d/%d/%d] Name: %s Key: %s Reason: Attempting to rangeban a higher admin.", IP, day, month, year,sendername,PlayerInfo[playerid][pKey]);
BanLog(logstring);
format(string, sizeof(string), "{FF6347}SERVER: %s was banned, reason: Attempting to rangeban a higher admin.", sendername);
SendClientMessageToAll(COLOR_WHITE, string);
PlayerInfo[playerid][pBand] = 3;
PlayerInfo[playerid][pPermBand] = 1;
format(string, sizeof(string), "Ban Reason: Attempting to rangeban a higher admin - Banned by: Autoban");
strmid(PlayerInfo[playerid][pBanReason], string, 0, strlen(string), 255);
BanEx(playerid, "Banned By: Autoban Reason: Attempting to rangeban a higher admin");
return 1;
}
GetPlayerIp(giveplayerid, IP, sizeof(IP));
format(logstring, sizeof(logstring), "%s [%d/%d/%d] Name: %s Key: %s RangeBanned by: %s Reason: %s", IP, day, month, year,giveplayer,PlayerInfo[giveplayerid][pKey], sendername, (result));
BanLog(logstring);
format(string, sizeof(string), "{FF6347}SERVER: %s was rangebanned by %s, reason: %s", giveplayer, sendername, (result));
SendClientMessageToAll(COLOR_WHITE, string);
format(string, sizeof(string), "Rangeban Reason: %s - Banned by: %s",result,sendername);
strmid(PlayerInfo[giveplayerid][pBanReason], string, 0, strlen(string), 255);
PlayerInfo[giveplayerid][pBand] = 3;
Rangeban(giveplayerid);
UseAdmCmdTimer[playerid]++;
SetTimerEx("UseAdmCmd",3*1000,0,"i",playerid); //3 seconds
return 1;
}
}
else
{
format(string, sizeof(string), " %d is not an active player !", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, " You are not authorized to use that command !");
}
}