if(strcmp(cmd, "/ban", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new playersip[64];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "KASUTUS: /ban [playerid/PartOfName] <reason>");
return 1;
}
giveplayerid = ReturnUser(tmp);
new string3[256];
if (PlayerInfo[playerid][pAdmin] >= 3 || IsPlayerAdmin(playerid))
{
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerIp(giveplayerid,playersip,sizeof(playersip));
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, "KASUTUS: /ban [playerid/PartOfName] [reason]");
return 1;
}
if(giveplayerid != playerid && Untouchable[giveplayerid]) return SendClientMessage(playerid, COLOR_GREY, " Nice try dude...");
new targetlevel = PlayerInfo[giveplayerid][pAdmin];
new playerlevel = PlayerInfo[playerid][pAdmin];
if(targetlevel > playerlevel) return SendClientMessage(playerid, COLOR_GREY, "[Totaalne-AC] - You can't use this command on that person!");
new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
format(string3,sizeof(string3), "(%d/%d/%d)[%d:%d:%d] %s Has been banned by %s for: %s",d,m,y,h,mi,s,giveplayer,sendername, (result));
BanLog(string3);
format(string3,sizeof(string3), "(%d/%d/%d)[%d:%d:%d] Banned by %s - Reason: %s",d,m,y,h,mi,s,sendername,(result));
AddPunishment(giveplayerid, string3);
format(string3, sizeof(string3), "%s (%d), Has been Banned by Administrator %s for %s", giveplayer, giveplayerid, sendername, (result));
SendClientMessageToAll(COLOR_NICERED, string3);
format(string3, sizeof(string3), "[ADMIN]: %s Has Been Added to the Ban list by %s", playersip, sendername);
SendAdminMessage(COLOR_WHITE, string3);
format(string3, sizeof(string3), "You have Been Banned by Administrator %s for %s", sendername, (result));
SendClientMessage(giveplayerid,COLOR_NICERED, string3);
SendClientMessage(giveplayerid,COLOR_BLUE, "If You Feel that This has Been an Error, Report the Admin to www.totalroleplay.zxq.net/index.php");
SendClientMessage(giveplayerid,COLOR_BLUE, "To Get Unbanned Post an Unban Request at Our Forums www.totalroleplay.zxq.net/index.php");
SendClientMessage(giveplayerid,COLOR_LIGHTRED, "Don't Evade, Otherwise you wont get unbanned");
SafeSetPlayerPos(giveplayerid,264.6288,77.5742,1001.0391);
SafeSetPlayerInterior(giveplayerid, 6);
PlayerInfo[giveplayerid][pJailTime] = 300;
PlayerInfo[giveplayerid][pJailed] = 1;
PlayerInfo[giveplayerid][pBanned] = 1;
format(string3, sizeof(string3), "~r~~h~Admin Ban: ~n~~r~%s",(result));
GameTextForPlayer(giveplayerid, string3, 6000, 3);
PlayerInfo[giveplayerid][pPending] = 0;
//ScriptBan(giveplayerid,playerid,result);
BanEx(giveplayerid/*,playerid*/,result);
return 1;
}
}//not connected
}
else
{
format(string, sizeof(string), " %d is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOR_ORANGE, string);
}
}
return 1;
}
if(strcmp(cmd, "/kick", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "KASUTUS: /kick [playerid/PartOfName] <reason>");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(giveplayerid != playerid && Untouchable[giveplayerid]) return SendClientMessage(playerid, COLOR_GREY, "* Sa ei saa seda selle mдngijaga teha!");
new targetlevel = PlayerInfo[giveplayerid][pAdmin];
new playerlevel = PlayerInfo[playerid][pAdmin];
if(targetlevel > playerlevel) return SendClientMessage(playerid, COLOR_GREY, "* You can not Kick People that is higher Than You!");
if (PlayerInfo[playerid][pAdmin] >= 1 || IsPlayerAdmin(playerid))
{
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
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))
{
new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s Has been kicked by %s, No Reason Given",d,m,y,h,mi,s,giveplayer,sendername);
KickLog(string);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] Kicked by %s - No Reason Given.",d,m,y,h,mi,s,sendername);
AddPunishment(giveplayerid, string);
format(string, sizeof(string), "%s (%d), Has been kicked by Administrator %s, No Reason Given", giveplayer, giveplayerid, sendername);
SendClientMessageToAll(COLOR_NICERED, string);
format(string, sizeof(string), "You have Been Kicked by Administrator %s, No Reason Given", sendername);
SendClientMessage(giveplayerid,COLOR_LIGHTBLUE, string);
SafeSetPlayerPos(giveplayerid,1601.8762,-1671.9099,-40.5941);
SafeSetPlayerInterior(giveplayerid, 0);
GameTextForPlayer(giveplayerid, "~r~~h~Admin Kicked: ~n~~r~No Reason Given", 6000, 3);
SetTimerEx("KickOut",500,false,"i",giveplayerid);
return 1;
}
new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s Has been kicked by %s for: %s",d,m,y,h,mi,s,giveplayer,sendername, (result));
KickLog(string);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] Kicked by %s - Reason: %s",d,m,y,h,mi,s,sendername,(result));
AddPunishment(giveplayerid, string);
format(string, sizeof(string), "%s (%d), Has been kicked by Administrator %s for: %s", giveplayer, giveplayerid, sendername, (result));
SendClientMessageToAll(COLOR_NICERED, string);
format(string, sizeof(string), "You have Been Kicked by Administrator %s for: %s", sendername, (result));
SendClientMessage(giveplayerid,COLOR_LIGHTBLUE, string);
SafeSetPlayerPos(giveplayerid,1601.8762,-1671.9099,-40.5941);
SafeSetPlayerInterior(giveplayerid, 0);
format(string, sizeof(string), "~r~~h~Admin Kicked: ~n~~r~%s",(result));
GameTextForPlayer(giveplayerid, string, 6000, 3);
SetTimerEx("KickOut",500,false,"i",giveplayerid);
return 1;
}
}
}
else
{
format(string, sizeof(string), "** %d is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
return 1;
}
IsPlayerAdmin
forward KickPublic(playerid)
{
Kick(playerid);
}
CMD:ban(playerid, params[])
{
new id, y, m, d, h, mi, s, string1[128], string[1024], string2[128], string3[128], string4[128];
if(PlayerInfo[playerid][pAdmin] >= 3 || IsPlayerAdmin(playerid))
{
if(sscanf(params, "us[50]", id, string1)) return SendClientMessage(playerid, GREY, "Usage: /ban <playerid/name> <reason>");
{
if(id != INVALID_PLAYER_ID)
{
if(PlayerInfo[id][pAdmin] < Player[playerid][pAdmin])
{
getdate(y, m, d);
gettime(h, mi, s);
format(string, sizeof(string), "(%d/%d/%d) [%d:%d:$d] %s has been banned by %s. [Reason: %s]", d, m, y, h, mi, s, pName(playerid), pName(id), string1);
BanLog(string);
format(string, sizeof(string), "(%d/%d/%d)[%d:%d:%d] Banned by %s - Reason: %s",d, m, y, h, mi, s, pName(id), string1);
AddPunishment(string);
format(string, sizeof(string), "%s (%d), Has been Banned by Administrator %s for %s", pName(id), pName(playerid), string1);
SendClientMessageToAll(COLOR_NICERED, string);
format(string2, sizeof(string2), "You have been banned. If you feel this ban has been an error, you can appeal and report the admin.\n");
format(string3, sizeof(string3), "If you want to be unbanned, post an unban appeal here: www.totalroleplay.zxg.net\n");
format(string4, sizeof(string4), "Don't evade, otherwise you will not be unbanned from our server.\n");
format(string5, sizeof(string5, "%s%s%s", string2, string3, string4);
SendClientMessage(playerid, WHITE, string5);
SetTimer("KickPublic", 3000, 0);
}
else return SendClientMessage(playerid, GREY, "You may not ban admins that are a higher rank than you!");
}
else return SendClientMessage(playerid, GREY, "Invalid playerid.");
}
}
else return SendClientMessage(playerid, GREY, "You are not a high enough administrator rank/you are not rcon admin.");
}
stock pName(playerid)
{
new pname;
GetPlayerName(playerid, pname, 24);
return pname;
}
stock getIP(playerid)
{
new pIp;
GetPlayerIp(playerid, pIp, 16);
return pIp;
}