UNBAN Command
#1

Ok, here is my unban command.
pawn Код:
CMD:unban(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 2)
    {
        new string[128];
        if(isnull(params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /unban [playername]");

        if( PlayerInfo[MAX_PLAYERS][pBan] >= 1 )
        {
            PlayerInfo[MAX_PLAYERS][pBan] = 0;
            print("OnPlayerOfflineLogin: Variables saved properly");
            format(string, 128, "[ADMIN] %s (IP:%s) was unbanned by %s.", params, PlayerInfo[MAX_PLAYERS][pIP], GetPlayerNameEx(playerid));
            SendStaffMessage(COLOR_RED,string);
            new year, month,day;
            getdate(year, month, day);
            new playa[MAX_PLAYER_NAME];
            GetPlayerName(playerid, playa, MAX_PLAYER_NAME);
            format(string, sizeof(string), "[ADMIN] %s : was unbanned by %s.", params, playa);
            SendStaffMessage(COLOR_RED, string);
        }
        else
        {
            SendClientMessage( playerid, COLOR_WHITE, "Not a banned account or no such account was found!" );
        }
    }
    return 1;
}
I get these Errors

Код:
C:\Documents and Settings\User\Desktop\GTA SA server\gamemodes\server.pwn(1398) : error 032: array index out of bounds (variable "PlayerInfo")
C:\Documents and Settings\User\Desktop\GTA SA server\gamemodes\server.pwn(1400) : error 032: array index out of bounds (variable "PlayerInfo")
C:\Documents and Settings\User\Desktop\GTA SA server\gamemodes\server.pwn(1402) : error 032: array index out of bounds (variable "PlayerInfo")
C:\Documents and Settings\User\Desktop\GTA SA server\gamemodes\server.pwn(1515) : error 032: array index out of bounds (variable "PlayerInfo")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Can someone fix this code or create me a /unabn command?
Here is the /ban command
pawn Код:
CMD:ban(playerid, params[])
{
        if(PlayerInfo[playerid][pAdmin] >= 2)
        {
            new targetid, reason;
            new VBName[MAX_PLAYER_NAME];
            new VBName1[MAX_PLAYER_NAME];
            GetPlayerName(playerid, VBName, MAX_PLAYER_NAME);
            GetPlayerName(targetid, VBName1, MAX_PLAYER_NAME);
            if(sscanf(params, "ri", targetid, reason)) return SendClientMessage(playerid, COLOR_RED,"Usage: /Ban [playerid] [reason]");
            if(targetid == playerid) return SendClientMessage(playerid, COLOR_RED, "You Can't Ban Yourself!");
            if(PlayerInfo[targetid][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, COLOR_RED, "You Can't Kick Higher Administrators!");
            else
            {
                new str[128];
                format(str, sizeof(str), "Administrator %s Has Banned %s Reason: %d!", VBName, VBName1, reason);
                SendClientMessageToAll(COLOR_RED,str);
                PlayerInfo[playerid][pBan] = 1;
                Ban(targetid);
        }
    }
        else return SendClientMessage(playerid, COLOR_RED, "You Need To Be A Administrator!");
        return 1;
}
Reply
#2

Try now
pawn Код:
CMD:unban(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 2)
    {
        new string[128];
        if(isnull(params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /unban [playername]");

        if( PlayerInfo[playerid][pBan] >= 1 )
        {
            PlayerInfo[playerid][pBan] = 0;
            print("OnPlayerOfflineLogin: Variables saved properly");
            format(string, 128, "[ADMIN] %s (IP:%s) was unbanned by %s.", params, PlayerInfo[playerid][pIP], GetPlayerNameEx(playerid));
            SendStaffMessage(COLOR_RED,string);
            new year, month,day;
            getdate(year, month, day);
            new playa[MAX_PLAYER_NAME];
            GetPlayerName(playerid, playa, MAX_PLAYER_NAME);
            format(string, sizeof(string), "[ADMIN] %s : was unbanned by %s.", params, playa);
            SendStaffMessage(COLOR_RED, string);
        }
        else
        {
            SendClientMessage( playerid, COLOR_WHITE, "Not a banned account or no such account was found!" );
        }
    }
    return 1;
}
Reply
#3

Cheers mate, +REP you
Reply
#4

you're welcome
Reply
#5

hey can you help me here is my /ban command

Quote:

CMD:ban(playerid,params[])
{
if(pInfo[playerid][pAdminLevel] >= 2)
{
if(IsPlayerConnected(playerid))
{
new targetid,reason[105],string[256];
if(sscanf(params, "us[105]", targetid,reason)) return SendClientMessage(playerid,-1,""chat" /ban [playerid] [reason]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1,""chat" Player is not online");

format(string, sizeof(string), ""chat""COL_LIGHTBLUE" %s %s has banned %s [Reason: %s]",GetAdminName(playerid),PlayerName(playerid),Play erName(targetid),reason);
SendClientMessageToAll(-1,string);

BanPlayer(targetid,reason,PlayerName(playerid));
}
}
else {
SendClientMessage(playerid,-1,""chat""COL_LIGHTBLUE" You do not have the right admin permissions for this command!");
}
return 1;
}

please man help cause i realy need /unban command
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)