Having a problem with Kicking with message
#5

pawn Код:
forward KickTimer(playerid);

ACMD:ban(playerid, params[])
{
    if (pInfo[playerid][Adminlevel] < 2)return 0;
    new reason[128], string[250];
    if(sscanf(params, "us[128]",ID, reason))
    return SCM(playerid, orange, "--- /ban <ID> <Reason> ---");
    if(ID == IPI)return SCM(playerid, red, "Player is not connected!");
    pInfo[ID][Banned]=1;
    GetPlayerName(ID,pname,MAX_PLAYER_NAME);
    GetPlayerName(playerid,Nam, MAX_PLAYER_NAME);
    format(string, sizeof(string), "%s %s has banned %s for %s", AdminLevelName(playerid),Nam, pname, reason);
    SCMToAll(red, string);
    //Kick(ID); Remove This, this is causing the timer to fail as it is closing the connection immediately
    SetTimerEx("KickTimer", 1000, false, "i", playerid); 10ms isn't long enough to show the message, so i changed this to 100
    return 1;
}

public OnPlayerConnect(playerid)
{
    if(pInfo[playerid][Banned]==1)
    {
    SCM(playerid, red, "You are banned from the server");
    SetTimerEx("KickTimer", 1000, false, "i", playerid);//You can use the same timer for this.
    }
    return 1;
}

public KickTimer(playerid)
{
    Kick(playerid);
    return 1;
}
Reply


Messages In This Thread
Having a problem with Kicking with message - by LeXuZ - 25.11.2014, 21:00
Re: Having a problem with Kicking with message - by DRCharlie - 25.11.2014, 22:19
Re: Having a problem with Kicking with message - by AnthonyTimmers - 25.11.2014, 22:37
Re: Having a problem with Kicking with message - by DRCharlie - 26.11.2014, 02:34
Re: Having a problem with Kicking with message - by Banana_Ghost - 26.11.2014, 03:27
Re: Having a problem with Kicking with message - by LeXuZ - 26.11.2014, 16:02

Forum Jump:


Users browsing this thread: 1 Guest(s)