Player doesn't get added to samp.ban when trying to ban.
#1

pawn Код:
dcmd_ban(playerid, params[])
{
    new id;
    new reason[128] = "- ";
    new name[MAX_PLAYER_NAME+1], string[64+MAX_PLAYER_NAME+1+sizeof(reason)];
    if (PlayerInfo[playerid][pAdmin] > 3)
    {
        if (AdminDuty[playerid] == 1)
        {
            if(sscanf(params, "uz", id, reason))
            {
                SendClientMessage(playerid, COLOR_DARKRED, "USAGE: /ban [name/id] (optional reason)");
            }
            else if (id == INVALID_PLAYER_ID)
            {
                SendClientMessage(playerid, COLOR_RED, "Player not found!");
            }
            else
            {
                GetPlayerName(id, name, sizeof(name));
                format(string, sizeof(string), "You have banned %s (ID %d) - (Reason: %s).", name, id, reason);
                SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                new adminname[MAX_PLAYER_NAME+1];
                new banmessage[sizeof(string)+32];
                new message[sizeof(string)+32];
                GetPlayerName(playerid, adminname, sizeof(adminname));
                format(banmessage, sizeof(banmessage), "%s has been banned by %s - (Reason: %s).", name, adminname, reason);
                SendClientMessageToAll(COLOR_DARKYELLOW, banmessage);
                format(message, sizeof(message), "You have been banned - (Reason: %s).", reason);
                KickWithMessage(id, 0xFF0000FF, message);
                return 1;
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "You have to be onduty before you can ban someone.");
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_RED, "You need to be an administrator to ban someone!");
    }
    return 1;
}
pawn Код:
forward BanPublic(id, reason[]);
public BanPublic(id, reason[])
{
    BanEx(id, reason);
}

stock BanWithMessage(id, color, message[], reason[])
{
    SendClientMessage(id, color, message);
    SetTimerEx("BanPublic", 1000, false, "d", id); // Delay of 1 second before banning the player so he receives the message
}
Anyone know what I did wrong?
Reply
#2

Anyone?
Reply
#3

Quote:
Originally Posted by AnthonyTimmers
Посмотреть сообщение
Anyone?
Your code says "KickWithMessage" instead of ban, this misstype is most likely the reason of your problem.
Reply
#4

You did "KickWithMessage" how-ever the public is BanWithMessage...
Reply
#5

KickWithMessage(id, 0xFF0000FF, message);

Should be :

BanWithMessage(id, 0xFF0000FF, message);
Reply
#6

I literally spent a good hour looking for that and I didn't see it. :"(
Thanks guys
Reply


Forum Jump:


Users browsing this thread: