SA-MP Forums Archive
[Pedido] Cronometro - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Pedido] Cronometro (/showthread.php?tid=541129)



Cronometro - AssasinoLM - 09.10.2014

eu gostaria de um cronometro que quando termina-se a contagem ele ativa-se uma aзгo.


Re: Cronometro - Marlon307 - 09.10.2014

https://sampwiki.blast.hk/wiki/SetTimerEx


Re: Cronometro - Bruno13 - 09.10.2014

Simples cara, vк o link do amigo acima, logo pense como montar...
pawn Код:
new timerContagem[MAX_PLAYERS]; //define uma variбvel em primeiro lugar para salvar o id do timer
new varContagem[MAX_PLAYERS]; //variбvel para a contagem regressiva
forward Regressivo(playerid); //define a callback

//Agora a criaзгo do callback
public Regressivo(playerid)
{
    new str[50];
    varContagem[playerid]--;
    format(str, sizeof(str), "Tempo restante %d", varContagem[playerid]);
    SendClientMessage(playerid, -1, str);
    if(varContagem[playerid] < 1)
    {
        KillTimer(timerContagem);
        varContagem[playerid] = 0;
        SendClientMessage(playerid, -1, "Timer terminado");
    }
    return 1;
}

//E por fim sua aplicaзгo
CMD:iniciar(playerid, params[])
{
    if(sscanf(params, "d", temp)) return SendClientMessage(playerid, "Uso: /iniciar [tempo]");
    varContagem[playerid] = temp;
    timerContagem[playerid] = SetTimerEx("Regressivo", 1000, true, "i", playerid);
    return 1;
}



Re: Cronometro - DarkBr - 27.03.2017

EAI MAN VLW! TEM COMO FAZER UM DESSE MAS SEM COMANDOS TIPO COM UM TEMPO DETERMINADO TIPO 20 SEGUNDOS /CORRIDA 20 SEGUNDOS ANTES DE COMEЗAR AJUDA AI... ABRAЗO!


Re: Cronometro - Swinte - 27.03.2017

Quote:
Originally Posted by DarkBr
Посмотреть сообщение
EAI MAN VLW! TEM COMO FAZER UM DESSE MAS SEM COMANDOS TIPO COM UM TEMPO DETERMINADO TIPO 20 SEGUNDOS /CORRIDA 20 SEGUNDOS ANTES DE COMEЗAR AJUDA AI... ABRAЗO!
Vocк й o cara do tуpico ?


Re: Cronometro - GabrielMT - 27.03.2017

KKKKKKKKKKKKKKKK MeoDeus

@Topico
Код:
	 		if( !strcmp( cmd, "/econtar", true ))
			{
   				tmp = strtok(cmdtext, idx);
				if( !strlen( tmp ))
				{
					SendClientMessage( playerid, Vermelho, " | ERRO | Uso correto: /eContar [Segundos]" );
					return 1;
				}
				new
					eSegundos = strval( tmp )
				;
				if( eSegundos < 1 || eSegundos > 60 )
				{
			    	SendClientMessage( playerid, 0xFF0000AA, " | ERRO | Somente segundos para iniciar uma contagem de 1 a 60!" );
			    	return 1;
				}
				ContagemRegressiva = eSegundos;
				eContageme();
				return 1;
			}

// NAS SUAS forward  '-*'
 forward eContageme();
public eContageme()
{
    foreach(Player, i)
	{
			if( ParticipandoEvento[ i ] == 1 )
			{
			    if( ContagemRegressiva == 0 )
			    {
			        T_AntBug = -1;
					GameTextForAll( "~n~~r~~h~VALENDO!", 1000, 5 );
					T_Rank = SetTimer( "RankEvento", 1000, true );
					PlayerPlaySound( i, 1057, 0.0, 0.0, 0.0 );
					SetCameraBehindPlayer( i );
					TextDrawShowForPlayer( i, text_Top5[ 0 ] );
					TextDrawShowForPlayer( i, text_Top5[ 1 ] );
			    }
			    else
			    {
					format( gStr, sizeof( gStr ), "~n~%d", ContagemRegressiva );
					GameTextForAll( gStr, 1000, 5 );
					ContagemRegressiva --;
					SetTimer( "eContageme", 1000, false );
					PlayerPlaySound( i, 1056, 0.0, 0.0, 0.0 );
				}
				return 1;
			}
		}
	return 1;
}
Seria isso ?
Se Sim;
Adapte ao seu GM, e termine '-'