Problem with cmd /warn
#1

Hi, this is my problem: the server kick all players, when we give more than three warnings to a rule-breaker

This is the CMD:

Код:
CMD:warn(playerid,params[])
{
	if(pInfo[playerid][pLogged] == 1)
	{
		if(pInfo[playerid][pAdminLevel] >= 1 || IsPlayerAdmin(playerid))
		{
			new targetid,reason[105],string[256];
			if(sscanf(params, "us[105]", targetid, reason)) return SendClientMessage(playerid,-1,""chat" /warn [playerid] [reason]");
			if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1,""chat" Player is not online");

			new sentstring[128];

			pInfo[targetid][pWarnings]++;
			format(string,sizeof(string), "%s %s warned you\nReason: %s\nWarning Number: %i",GetAdminName(playerid),PlayerName(playerid), reason, pInfo[targetid][pWarnings]);
			ShowPlayerDialog(targetid,DIALOG_WARN,DIALOG_STYLE_MSGBOX,"Warning",string,"I Understand","");
			format(sentstring,sizeof(sentstring), ""chat""COL_RED" %s %s has warned %s Reason: %s (%i / 3)",GetAdminName(playerid),PlayerName(playerid),PlayerName(targetid),reason,pInfo[targetid][pWarnings]);
			SendClientMessageToAll(-1,sentstring);

			if(pInfo[targetid][pWarnings] >= 3)
			{
				format(string, sizeof(string), ""chat""COL_RED" %s %s has kicked %s [Reason: %s][3 Warnings EXCEEDED]",GetAdminName(playerid),PlayerName(playerid),PlayerName(targetid),reason);
				SendClientMessageToAll(-1,string);
				SCM(targetid, -1, ""COL_LIGHTBLUE" You have Been Kicked Because your Warns EXCEEDED 3 ");
				SetTimerEx("WARN_KICK",2000,0,"i",targetid);
			}
		}
		else {
			SendClientMessage(playerid,-1,""chat""COL_LIGHTBLUE" You do not have the right admin permissions for this command!");
		}
	}
    else if(pInfo[playerid][pLogged] == 0)
	{
		SendClientMessage(playerid,-1,""chat""COL_LIGHTBLUE" Nice try u fucking fag gay!");
		printf("%s has been kicked for trying to use a command without being logged in!", PlayerName(playerid));
		Kick(playerid);
	}
	return 1;
}

forward WARN_KICK();
public WARN_KICK()
{
	for(new i=0; i<MAX_PLAYERS; i++)
 	{
     	if(IsPlayerConnected(i))
		{
		    Kick(i);
		}
	}
	return 1;
}
please help me

sorry for my bad english, I'm Mexican
Reply
#2

please help
Reply
#3

that's because
pawn Код:
forward WARN_KICK();
public WARN_KICK()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            Kick(i);
        }
    }
    return 1;
}
it should be:
pawn Код:
forward WARN_KICK(playerid);
public WARN_KICK(playerid)
{
        Kick(playerid);
    return 1;
}
Reply
#4

Solved, Thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)