06.11.2015, 20:39 
	
	
	
		Hello. So I have made a ban command, but when I ban someone, it bans me too, just says "The server closed the connection". How to fix that?
Here is my code:
Thanks in advance for the help!
	
	
	
	
Here is my code:
PHP код:
CMD:ban(playerid,params[])
{
    if(pInfo[playerid][pAdminLevel] >= 2)
    {
        if(IsPlayerConnected(playerid))
        {
            new targetid,reason[105],ip[50],string[256];
            if(sscanf(params, "us[105]", targetid,reason)) return SendClientMessage(playerid,-1,"{C0C0C0}USAGE: /ban [playerid] [reason]");
            if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1,""chat" Player is not online.");
            format(string, sizeof(string), "{DC143C}Administrator %s has banned %s [Reason: %s]",PlayerName(playerid),PlayerName(targetid),reason);
            SendClientMessageToAll(-1,string);
            format(string,sizeof(string), "You are banned from the server!\n\n{DC143C}Banned by{ffffff}: %s\n{DC143C}Reason{ffffff}: %s\n\nYou can post Ban Appeal on our Forums:\n{FFFF33}www.blablabla.com",PlayerName(playerid), reason);
            ShowPlayerDialog(targetid,DIALOG_HELP,DIALOG_STYLE_MSGBOX,"{DC143C}BANNED",string,"Close","");
            pInfo[targetid][pBanned] = 1;
            GetPlayerIp(targetid, ip, sizeof(ip));
            format(string, sizeof(string), "banip %s",ip);
            SetTimerEx("BanTimer", 1000, false, "i", playerid);
        }
    }
    else {
        //SendClientMessage(playerid,-1,""chat""COL_LIGHTBLUE" You do not have the right admin permissions for this command!");
    }
    return 1;
}
public BanTimer(playerid)
{
    Ban(playerid);
    return 1;
}
forward BanTimer(playerid); 

