CMD:ban help
#1

Okay, so I want it so no-body can ban me.. So I found a code for it, but there's some errors..


pawn Код:
CMD:ban(playerid, params[])
{
    if(PlayerInfo[playerid][pAdminDuty] == 0) return SendClientMessage(playerid, -1, "You must be on Admin Duty to use this Command!");
    if (PlayerInfo[playerid][pAdmin] >= 4 && PlayerInfo[playerid][pAdmin] != -1)
    {
        new string[128], giveplayerid, reason[64];
        if(sscanf(params, "us[64]", giveplayerid, reason)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /ban [playerid] [reason]");

        if(IsPlayerConnected(giveplayerid))
        {
            if(PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin])
            {
                format(string, sizeof(string), "AdmCmd: %s has been auto-banned, reason: Trying to /ban a higher admin.", GetPlayerNameEx(playerid));
                ABroadCast(COLOR_YELLOW,string,2);
                PlayerInfo[playerid][pBanned] = 1;
                new ip[32];
                GetPlayerIp(playerid,ip,sizeof(ip));
                AddBan(ip);
                Kick(playerid);
                return 1;
            }
            if(GD[giveplayerid])    // This line is the error
            {
                SendClientMessage(playerid, COLOR_GREY, "You cannot ban the big boss. You were banned instead.");
                new year, month,day;
                getdate(year, month, day);
                new playerip[32];
                format(reason, sizeof(reason), "Trying to ban James Willowfield.");
                GetPlayerIp(playerid, playerip, sizeof(playerip));
                format(string, sizeof(string), "AdmCmd: %s(IP:%s) was automatically banned, reason: %s (%d-%d-%d)", GetPlayerNameEx(playerid), playerip,reason,month,day,year);
                Log("logs/ban.log", string);
                format(string, sizeof(string), "AdmCmd: %s was banned by the system, reason: %s", GetPlayerNameEx(playerid), reason);
                SendClientMessageToAllEx(COLOR_LIGHTRED, string);
                PlayerInfo[playerid][pBanned] = 1;
                format(PlayerInfo[playerid][pFlag], 128, "");
                new ip[32];
                GetPlayerIp(playerid,ip,sizeof(ip));
                AddBan(ip);
                Kick(playerid);
                return 1;
            }
            else
            {
                new year, month,day;
                getdate(year, month, day);
                new playerip[32];
                GetPlayerIp(giveplayerid, playerip, sizeof(playerip));
                format(string, sizeof(string), "AdmCmd: %s(IP:%s) was banned by %s, reason: %s (%d-%d-%d)", GetPlayerNameEx(giveplayerid), playerip, GetPlayerNameEx(playerid), reason,month,day,year);
                Log("logs/ban.log", string);
                format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
                SendClientMessageToAllEx(COLOR_LIGHTRED, string);
                PlayerInfo[giveplayerid][pBanned] = 1;
                format(PlayerInfo[giveplayerid][pFlag], 128, "");
                new ip[32];
                GetPlayerIp(giveplayerid,ip,sizeof(ip));
                AddBan(ip);
                Kick(giveplayerid);
                return 1;
            }

        }
    }
    else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
    return 1;
}

Код:
C:\Users\****\Desktop\SA-MP gamemodes\Infinity RP\pawno\include\OPSP.inc(250) : error 010: invalid function or declaration
C:\Users\****\Desktop\SL-RP\DS-RP.pwn(786) : warning 213: tag mismatch
C:\Users\****\Desktop\SL-RP\DS-RP.pwn(63313) : error 017: undefined symbol "GD"
C:\Users\****\Desktop\SL-RP\DS-RP.pwn(63313) : warning 215: expression has no effect
C:\Users\****\Desktop\SL-RP\DS-RP.pwn(63313) : error 001: expected token: ";", but found "]"
C:\Users\****\Desktop\SL-RP\DS-RP.pwn(63313) : error 029: invalid expression, assumed zero
C:\Users\****\Desktop\SL-RP\DS-RP.pwn(63313) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
Reply
#2

On script's top:

pawn Код:
new GD[MAX_PLAYERS];
Reply
#3

In my opinion it will be better to detect the name and if its you you have supreme power .
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)