[Ajuda] Settimer nгo funfa nem..
#1

o Aviso de helpers estб para que o Helper nao floode no Aviso, entao fiz um settimer, mais ele nao funfa, o cara manda uma vez, e so da pra ele mandar denovo depois de GMX ! Olhem o Code ai:
Код:
if(strcmp(cmd, "/avisohelper", true) == 0 || strcmp(cmd, "/avh", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			GetPlayerName(playerid, sendername, sizeof(sendername));
			new length = strlen(cmdtext);
			while ((idx < length) && (cmdtext[idx] <= ' '))
			{
				idx++;
			}
			new offset = idx;
			new result[64];
			while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
			{
				result[idx - offset] = cmdtext[idx];
				idx++;
			}
			result[idx - offset] = EOS;
			if(!strlen(result))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USE: (/[av]iso[h]elper) [mensagem]");
				return 1;
			}
			if(PlayerInfo[playerid][pHelperTrabalhando] == 0)
			{
				return SendClientMessage(playerid,COLOR_GRAD2,"Vocк nгo estб em trabalho! Use: /th");
			}
			if(PlayerInfo[playerid][pHelper] < 1)
		 	{
			 	return SendClientMessage(playerid,COLOR_GRAD1,"Vocк nгo tem autorizaзгo para usar este comando");
		 	}
			if(anhelper[playerid] == 1)
		 	{
			 	return SendClientMessage(playerid,COLOR_GRAD1,"Vocк ainda nгo pode fazer um novo anuncio! Espere...");
		 	}
            SendClientMessageToAll(COLOR_WHITE, "|______________ {FF7800}Aviso dos Helpers {FFFFFF}______________|");
		 	if(PlayerInfo[playerid][pHelper] == 1)
		 	{
			 	format(string, sizeof(string), "Helper Iniciante %s: {F5FF00}%s", sendername, result);
		 	}
	   		else if(PlayerInfo[playerid][pHelper] == 2)
	   		{
			   format(string, sizeof(string), "Helper Moderador+ %s: {F5FF00}%s", sendername, result);
	   		}
            else if(PlayerInfo[playerid][pHelper] == 3)
	   		{
			   format(string, sizeof(string), "Helper Moderador++ %s: {F5FF00}%s", sendername, result);
	   		}
            else if(PlayerInfo[playerid][pHelper] == 4)
	   		{
			   format(string, sizeof(string), "Helper Intermediбrio %s: {F5FF00}%s", sendername, result);
	   		}
            else if(PlayerInfo[playerid][pHelper] == 5)
	   		{
			   format(string, sizeof(string), "Helper Master %s: {F5FF00}%s", sendername, result);
	   		}
			else if(PlayerInfo[playerid][pHelper] == 6)
			{
				format(string, sizeof(string), "Helper Lider %s: {F5FF00}%s", sendername, result);
			}
			SendClientMessageToAll(COLOR_HELPER, string);
			anhelper[playerid] = 1;
			SetTimer("TempoAnHelper",15000,false);
		}
		return 1;
	}
Depois..
Код:
public TempoAnHelper(playerid)
{
    anhelper[playerid] = 0;
	return 1;
}
News e Forwards.
Код:
forward TempoAnHelper(playerid);
         new anhelper[MAX_PLAYERS];
Nao й erro de compilaзгo nao !
Reply
#2

" voce esta fazendo isso errado " kkkkkkkkkk

voce precisa passar o id do player

https://sampwiki.blast.hk/wiki/SetTimerEx
Reply
#3

pawn Код:
new HelperPodeUsarCMD[MAX_PLAYERS];


public OnPlayerConnect(playerid) {

    HelperPodeUsarCMD[playerid] = 0;
    return true;
}

public OnPlayerCommandText(playerid, cmdtext[] ) {

    if(!strcmp(cmd, "/avisohelper", true) || !strcmp(cmd, "/avh", true)) {

        GetPlayerName(playerid, sendername, 24);
        new length = strlen(cmdtext);

        while ((idx < length) && (cmdtext[idx] <= ' ')) {

            idx++;
        }
        new offset = idx;
        new result[64];
        while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) {

            result[idx - offset] = cmdtext[idx];
            idx++;
        }

        result[idx - offset] = EOS;

        if(!strlen(result))
            return SendClientMessage(playerid, COLOR_GRAD2, "USE: (/[av]iso[h]elper) [mensagem]");

        if(PlayerInfo[playerid][pHelperTrabalhando] == 0)
            return SendClientMessage(playerid,COLOR_GRAD2,"Vocк nгo estб em trabalho! Use: /th");

        if(PlayerInfo[playerid][pHelper] < 1)
            return SendClientMessage(playerid,COLOR_GRAD1,"Vocк nгo tem autorizaзгo para usar este comando");

        if(HelperPodeUsarCMD[playerid] > gettime())
            return SendClientMessage(playerid,COLOR_GRAD1,"Vocк ainda nгo pode fazer um novo anuncio! Espere...");

        SendClientMessageToAll(COLOR_WHITE, "|______________ {FF7800}Aviso dos Helpers {FFFFFF}______________|");

        switch (PlayerInfo[playerid][pHelper]) {

            case 1:format(string, sizeof(string), "Helper Iniciante %s: {F5FF00}%s", sendername, result);
            case 2:format(string, sizeof(string), "Helper Moderador+ %s: {F5FF00}%s", sendername, result);
            case 3:format(string, sizeof(string), "Helper Moderador++ %s: {F5FF00}%s", sendername, result);
            case 4:format(string, sizeof(string), "Helper Intermediбrio %s: {F5FF00}%s", sendername, result);
            case 5:format(string, sizeof(string), "Helper Master %s: {F5FF00}%s", sendername, result);
            case 6:format(string, sizeof(string), "Helper Lider %s: {F5FF00}%s", sendername, result);

        }

        SendClientMessageToAll(COLOR_HELPER, string);
        HelperPodeUsarCMD[playerid] = gettime() + 15;

        return true;
    }

    return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)