PDA

View Full Version : Ban Nick


Edin Black
11/05/2012, 07:42 PM
Hello. Can anyone make me the command in strcmp, to ban a players nickname no ip.

And i would have a command: /rob [ID], when you rob a man(you must be rank 3), you take him 10% of his money.

Please.

Edin Black
11/05/2012, 08:29 PM
EDIT: i scripted that alone. delete topic

Arnold_Collins
11/05/2012, 08:34 PM
Try This

EDIT:NVM THEN U DELETE IT xD

if(strcmp(cmd, "/ban", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new playersip[64];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /ban [playerid/PartOfName] <reason>");
return 1;
}
giveplayerid = ReturnUser(tmp);
if (PlayerInfo[playerid][pAdmin] >= 1 || IsPlayerAdmin(playerid))
{
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerIp(giveplayerid,playersip,sizeof(playersi p));
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: /ban [playerid/PartOfName] [reason]");
return 1;
}
if(giveplayerid != playerid && Untouchable[giveplayerid]) return SendClientMessage(playerid, COLOR_GREY, "* You Can't Do this on This player!");
new targetlevel = PlayerInfo[giveplayerid][pAdmin];
new playerlevel = PlayerInfo[playerid][pAdmin];
if(targetlevel > playerlevel) return SendClientMessage(playerid, COLOR_GREY, "* You can not ban People that is higher Than You!");
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 banned by %s for: %s",d,m,y,h,mi,s,giveplayer,sendername, (result));
BanLog(string);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] Banned by %s - Reason: %s",d,m,y,h,mi,s,sendername,(result));
AddPunishment(giveplayerid, string);
format(string, sizeof(string), "%s (%d), Has been Banned by Administrator %s for %s", giveplayer, giveplayerid, sendername, (result));
SendClientMessageToAll(COLOR_NICERED, string);
format(string, sizeof(string), "[ADMIN]: %s Has Been Added to the Ban list by %s", playersip, sendername);
SendAdminMessage(COLOR_WHITE, string);
format(string, sizeof(string), "You have Been Banned by Administrator %s for %s", sendername, (result));
SendClientMessage(giveplayerid,COLOR_LIGHTBLUE, string);
SendClientMessage(giveplayerid,COLOR_BLUE, "If You Feel that This has Been an Error, Report the Admin to <changeme at 51586>");
SendClientMessage(giveplayerid,COLOR_BLUE, "To Get Unbanned Post an Unban Request at Our Forums <changeme at 51587>");
SendClientMessage(giveplayerid,COLOR_LIGHTRED, "Don't Evade, Otherwise you wont get unbanned");
SafeSetPlayerPos(giveplayerid,264.6288,77.5742,100 1.0391);
SafeSetPlayerInterior(giveplayerid, 6);
PlayerInfo[giveplayerid][pJailTime] = 300;
PlayerInfo[giveplayerid][pJailed] = 1;
format(string, sizeof(string), "~r~~h~Admin Ban: ~n~~r~%s",(result));
GameTextForPlayer(giveplayerid, string, 6000, 3);
PlayerInfo[giveplayerid][pPending] = 0;
PlayerInfo[giveplayerid][pBanned] = 1;
ScriptBan(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;
}

Dan_Barocu
11/05/2012, 08:48 PM
Try This

EDIT:NVM THEN U DELETE IT xD

if(strcmp(cmd, "/ban", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new playersip[64];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /ban [playerid/PartOfName] <reason>");
return 1;
}
giveplayerid = ReturnUser(tmp);
if (PlayerInfo[playerid][pAdmin] >= 1 || IsPlayerAdmin(playerid))
{
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerIp(giveplayerid,playersip,sizeof(playersi p));
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: /ban [playerid/PartOfName] [reason]");
return 1;
}
if(giveplayerid != playerid && Untouchable[giveplayerid]) return SendClientMessage(playerid, COLOR_GREY, "* You Can't Do this on This player!");
new targetlevel = PlayerInfo[giveplayerid][pAdmin];
new playerlevel = PlayerInfo[playerid][pAdmin];
if(targetlevel > playerlevel) return SendClientMessage(playerid, COLOR_GREY, "* You can not ban People that is higher Than You!");
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 banned by %s for: %s",d,m,y,h,mi,s,giveplayer,sendername, (result));
BanLog(string);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] Banned by %s - Reason: %s",d,m,y,h,mi,s,sendername,(result));
AddPunishment(giveplayerid, string);
format(string, sizeof(string), "%s (%d), Has been Banned by Administrator %s for %s", giveplayer, giveplayerid, sendername, (result));
SendClientMessageToAll(COLOR_NICERED, string);
format(string, sizeof(string), "[ADMIN]: %s Has Been Added to the Ban list by %s", playersip, sendername);
SendAdminMessage(COLOR_WHITE, string);
format(string, sizeof(string), "You have Been Banned by Administrator %s for %s", sendername, (result));
SendClientMessage(giveplayerid,COLOR_LIGHTBLUE, string);
SendClientMessage(giveplayerid,COLOR_BLUE, "If You Feel that This has Been an Error, Report the Admin to <changeme at 51586>");
SendClientMessage(giveplayerid,COLOR_BLUE, "To Get Unbanned Post an Unban Request at Our Forums <changeme at 51587>");
SendClientMessage(giveplayerid,COLOR_LIGHTRED, "Don't Evade, Otherwise you wont get unbanned");
SafeSetPlayerPos(giveplayerid,264.6288,77.5742,100 1.0391);
SafeSetPlayerInterior(giveplayerid, 6);
PlayerInfo[giveplayerid][pJailTime] = 300;
PlayerInfo[giveplayerid][pJailed] = 1;
format(string, sizeof(string), "~r~~h~Admin Ban: ~n~~r~%s",(result));
GameTextForPlayer(giveplayerid, string, 6000, 3);
PlayerInfo[giveplayerid][pPending] = 0;
PlayerInfo[giveplayerid][pBanned] = 1;
ScriptBan(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;
}

you got this from ravens?

Arnold_Collins
11/05/2012, 08:53 PM
Yep lol i cant give my own script it is unique and ill make it good
So i just gived from a old raven i have here