/ban and /kick problem: You are not admin
#3

If you knew anything about scripting you'd know || means or.

Anyways, use this(download zcmd and sscanf2, much easier and quicker):
pawn Код:
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;
}
Try and follow the same format for the other command.

sscanf2 DL: https://sampforum.blast.hk/showthread.php?tid=120356
zcmd DL: https://sampforum.blast.hk/showthread.php?tid=91354
Reply


Messages In This Thread
/ban and /kick problem: You are not admin - by Makaak - 20.12.2013, 18:50
Re: /ban and /kick problem: You are not admin - by Zamora - 20.12.2013, 19:03
Re: /ban and /kick problem: You are not admin - by Mitchy - 20.12.2013, 19:14

Forum Jump:


Users browsing this thread: 1 Guest(s)