hola denuevo, necesito ayuda con un comando
#1

hola el error es este cuando le doy mas de 3 warns a alguien el server kickea a todos incluyendome a mi porque pasa eso este es el 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;
}
porfavor ayuda es urgente
Reply
#2

pawn Код:
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(playerid);
public WARN_KICK(playerid)
{
    Kick(playerid);
    return 1;
}
La funciуn que llamas con el timer hacнa un bucle y kickeaba a todos
Reply
#3

esta es la forma correcta:

Код:
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(playerid);
public WARN_KICK(playerid)
{
    Kick(playerid);
    return 1;
}
? o cual es xD soy noob estoy aprendiendo apenas xD
Reply
#4

la que te pase, al final decнa lo que estabas haciendo mal
Reply
#5

ya esta!! muchas gracias.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)