The known kick/ban bug (not sending message with kick/ban) for 0.3x [FIX]
#1

Alright, so many scripters already know that with the 0.3x update, when you kick/ban someone, it's not sending the message to the player that gets kicked/banned.

Well, here's a simple, easy fix.

pawn Code:
forward UnsetKick(playerid);
public UnsetKick(playerid)
{
    Kick(playerid);
    return 1;
}

CMD:kick(playerid, params[])
{
    new string[128];
    format(string, sizeof(string), "%s has been kicked by %s, reason: %s", Name?, Name?, Reason?);
    SendClientMessageToAll(-1, string);
    SetTimerEx("UnsetKick", 500, 0, "i", playerid);
}
And the same thing goes for banning. Hope this helps.

For instance, this is what I did:
pawn Code:
forward UnsetKick(playerid);
public UnsetKick(playerid)
{
    Kick(playerid);
    return 1;
}
CMD:kick(playerid, params[])
{
    if(PI[playerid][p_Admin] >= CI[cmd_Kick])
    {
        new targetid, reason[64], string[128];
        if(sscanf(params, "us[64", targetid, reason)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /kick [playerid] [reason]");
       
        if(!IsPlayerConnected(targetid)) return SendConnectionError(playerid);
        if(strlen(reason) <= 0) reason = "Not specified.";
       
        format(string, sizeof(string), "Admin %s has kicked %s, reason: %s", GetName(playerid), GetName(targetid), reason);
        SendClientMessageToAll(COLOR_REALRED, string);
        SetTimerEx("UnsetKick", 500, 0, "i", targetid);
    }
    else
    {
        SendPermissionError(playerid);
    }
    return 1;
}
P.S: Alternatively, you can use textdraws, as they seem to show up right before the kick/ban.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)