Small problem with /ban cmd.
#1

I made this ban cmd but the message "You have been banned by Administrator Nick" is not sending to the player that is banned, its directly showing "Server closed the connection" i have even set the timer to 4 seconds before kicking the player, but still same thing is going on. Any idea?

pawn Код:
CMD:ban(playerid, params[])
{
    new BanMsg[128], target, Reason[100], Msg1[128], Msg2[128], targetname[24], AdminName[24];
   
    SendAdminText(playerid, "/ban", params);

    if(APlayerData[playerid][LoggedIn] == true && APlayerData[playerid][PlayerLevel] >=3)
    {
        if(sscanf(params, "us[128]", target, Reason)) return SendClientMessage(playerid, RED, "» Syntax: /ban [ID] [Reason]");
       
        if(APlayerData[target][Banned] == 0)
        {
            GetPlayerName(playerid, AdminName, sizeof(AdminName));
            GetPlayerName(target, targetname, sizeof(targetname));
            SetTimerEx("KickPlayer", false, 4000, "i", target);
            format(Msg1, sizeof(Msg1), "» You have banned %s(%d) for the reason: %s", targetname, target, Reason);
            SendClientMessage(playerid, BLUE, Msg1);
            format(Msg2, sizeof(Msg2), "» You have been banned by Admin %s(%d)! Reason: %s", AdminName, playerid, Reason);
            format(BanMsg, sizeof(BanMsg), "*** %s(%d) has been banned by Administrator %s(%d). (Reason: %s)", targetname, target, AdminName, playerid, Reason);
            SendClientMessageToAll(RED, BanMsg);
            APlayerData[target][Banned] = 1;
            SendClientMessage(target, RED, Msg2);
        }
    }
    else
        return 0;
    return 1;
}
   
forward KickPlayer(playerid);
public KickPlayer(playerid)
{
      Kick(playerid);
}
Reply


Messages In This Thread
Small problem with /ban cmd. - by iOxide - 19.03.2014, 10:29
Re: Small problem with /ban cmd. - by ChandraLouis - 19.03.2014, 10:35
Re: Small problem with /ban cmd. - by iOxide - 19.03.2014, 10:39
Re: Small problem with /ban cmd. - by ChandraLouis - 19.03.2014, 10:52
Re: Small problem with /ban cmd. - by ACI - 19.03.2014, 10:56

Forum Jump:


Users browsing this thread: 3 Guest(s)