hello..
Код:
//AddBan(playerid,time)
if(strcmp(cmd, "/tempban", true) == 0||strcmp(cmd, "/tban", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /tempban [playerid/PartOfName] [time] [reason]");
return 1;
}
if(gAdminLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GRAD2, "Your not logged in through the admin panel, /adminlogin.");
return 1;
}
giveplayerid = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /tempban [playerid/PartOfName] [days] [reason]");
return 1;
}
playermoney=strval(tmp);
if (PlayerInfo[playerid][pAdmin] >= 1)
{
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
GiveNameSpace(sendername);
GiveNameSpace(giveplayer);
if(PlayerInfo[playerid][pHidden] == 1) { sendername = "Hidden Admin"; }
else if(PlayerInfo[playerid][pAdmin] == 11) { sendername = "Hidden Admin"; }
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /tempban [playerid/PartOfName] [days] [reason]");
return 1;
}
if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "You cannot Ban yourself!"); return 1; }
if(PlayerInfo[giveplayerid][pAdmin] >= 1)
{
if(PlayerInfo[playerid][pAdmin] < 10)
{
SendClientMessage(playerid, COLOR_GRAD2, "Your admin level is too low to ban other admins.");
return 1;
}
}
if(!AddBan(giveplayerid,playermoney,result)) {
SendClientMessage(playerid,COLOR_GRAD2,"Temp ban is full, Please inform a lead admin about this.");
return 1;
}
format(string,sizeof(string),"AdmCmd: %s was temp banned by %s, reason: %s",giveplayer,sendername,result);
SendClientMessageToAll(COLOR_LIGHTRED,string);
BanLog(string);
strmid(PlayerInfo[giveplayerid][pBanReason], result, 0, strlen(result), 255);
PlayerInfo[giveplayerid][pLockTime]=GetUnixTimeDays(playermoney);
new ip[16];
GetPlayerIp(giveplayerid,ip,16);
format(string, sizeof(string), "Banned Player's IP: %s", ip);
ABroadCast(COLOR_YELLOW,string,1);
Kick(giveplayerid);
}
}
}
return 1;
}
if(strcmp(cmd, "/stempban", true) == 0||strcmp(cmd, "/stban", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /stempban [playerid/PartOfName] [time] [reason]");
return 1;
}
if(gAdminLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GRAD2, "Your not logged in through the admin panel, /adminlogin.");
return 1;
}
giveplayerid = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /tempban [playerid/PartOfName] [days] [reason]");
return 1;
}
playermoney=strval(tmp);
if (PlayerInfo[playerid][pAdmin] >= 1)
{
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
GiveNameSpace(sendername);
GiveNameSpace(giveplayer);
if(PlayerInfo[playerid][pHidden] == 1) { sendername = "Hidden Admin"; }
else if(PlayerInfo[playerid][pAdmin] == 11) { sendername = "Hidden Admin"; }
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /tempban [playerid/PartOfName] [days] [reason]");
return 1;
}
if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "You cannot Ban yourself!"); return 1; }
if(PlayerInfo[giveplayerid][pAdmin] >= 1)
{
if(PlayerInfo[playerid][pAdmin] < 10)
{
SendClientMessage(playerid, COLOR_GRAD2, "Your admin level is too low to ban other admins.");
return 1;
}
}
if(!AddBan(giveplayerid,playermoney,result)) {
SendClientMessage(playerid,COLOR_GRAD2,"Temp ban is full, Please inform a lead admin about this.");
return 1;
}
format(string,sizeof(string),"AdmCmd: %s was temp banned by %s, reason: %s",giveplayer,sendername,result);
ABroadCast(COLOR_YELLOW,string,1);
BanLog(string);
strmid(PlayerInfo[giveplayerid][pBanReason], result, 0, strlen(result), 255);
PlayerInfo[giveplayerid][pLockTime]=getdate()+playermoney;
new ip[16];
GetPlayerIp(giveplayerid,ip,16);
format(string, sizeof(string), "Banned Player's IP: %s", ip);
ABroadCast(COLOR_YELLOW,string,1);
Kick(giveplayerid);
}
}
}
return 1;
}