02.11.2013, 15:43
Hi, I've problem with /ban command, in this code, it should :
1. strmid "reason" to PlayerInfo[otherplayer][pBanReason]
2. Send Client Message to *otherplayer*, with Info about BAN
3. Send Client Message to *admin*, with info about banned player
4. Send Client Message to ALL with *banned player's Name, Admin's name, and Reason*
5. KICK(otherplayer);
But
when I do /ban command (myself)
e.g. /ban Ermin cheater, it really Bans me, but not showing "You have been banned",
"Ermin has been banned", etc, why ?
i Will rape those who help me
1. strmid "reason" to PlayerInfo[otherplayer][pBanReason]
2. Send Client Message to *otherplayer*, with Info about BAN
3. Send Client Message to *admin*, with info about banned player
4. Send Client Message to ALL with *banned player's Name, Admin's name, and Reason*
5. KICK(otherplayer);
But
when I do /ban command (myself)
e.g. /ban Ermin cheater, it really Bans me, but not showing "You have been banned",
"Ermin has been banned", etc, why ?
i Will rape those who help me
pawn Код:
YCMD:ban(playerid, params[], help)
{
#pragma unused help
new otherplayer, string[128], banstring[128], reason[128], bannedplayerName[MAX_PLAYER_NAME];
GetPlayerName(otherplayer, bannedplayerName, sizeof(bannedplayerName));
if(!IsPlayerAdmin(playerid) && PlayerInfo[playerid][pAdmin] < 1)
return SCM(playerid, RED, "(REFUSED) Administrators ONLY!");
else if(sscanf(params, "us[128]", otherplayer, reason))
return SCM(playerid, GREY, "Usage: /ban [id] [reason]");
else if(!IsPlayerConnected(otherplayer))
return SCM(playerid, GREY, "*Invalid ID");
else if(PlayerInfo[otherplayer][pAdmin] > 1 && PlayerInfo[playerid][pAdmin] < 1338)
return SCM(playerid, RED, "(REFUSED) You have no permission to ban Admin!");
else if(PlayerInfo[otherplayer][pAdmin] >= 1337 && !IsPlayerAdmin(playerid))
return SCM(playerid, RED, "(REFUSED) Can't ban 1337/Head (rcon only)!");
format(banstring, sizeof(banstring), "%s", reason);
strmid(PlayerInfo[otherplayer][pBanReason], banstring, 0, strlen(banstring));
PlayerInfo[otherplayer][pBanned] = 1;
SCM(otherplayer, DARKRED, "________________________________________ %%:RP _______________________________________");
format(string, sizeof(string), "- %s(ID:%d) You have been banned permanently", bannedplayerName, otherplayer);
SCM(otherplayer, WHITE, string);
format(string, sizeof(string), "- Reason: %s", reason);
SCM(otherplayer, WHITE, string);
SCM(otherplayer, YELLOW, "______________________________________________________________________________________");
new ip[16];
GetPlayerIp(otherplayer, ip, sizeof(ip));
format(string, sizeof(string), "Banned player's info | Nick: %s, Level: %d, IP: %s", bannedplayerName, PlayerInfo[otherplayer][pLevel], ip);
SCM(playerid, ORANGE2, string);
format(string, sizeof(string), "If you want to ban players IP > /banip [ip]");
SCM(playerid, ORANGE2, string);
SCM(playerid, YELLOW, "IP Adress is not banned!");
format(string, sizeof(string), "%s has been banned, Admin: %s, Reason: %s", bannedplayerName, RPname(playerid), reason);
SendClientMessageToAll(BRIGHTRED, string);
Kick(otherplayer);
return 1;
}

