15.01.2011, 23:55
Bom eu tentei fazer um relogio de contagem regresiva, que comeзa aos 10:00 e termina no 00:00 e recomeзa denovo do 10:00, mais nгo consegui, quem pode me ajudar a fazer um eu agradeзo
|
Poe um timer com 1 segundo (1000) |
SetTimer("AumentarVariavel",1000,true);
|
fazendo aumentar alguma variбvel |
public AumentarVariavel()
{
++VariavelAumentar;
return true;
}
new Timer,VariavelAumentar = 10;//10 segundos
public OnFilterScriptInit()
{
Timer = SetTimer("AumentarVariavel",1000,true);
return true;
}
forward AumentarVariavel();
public AumentarVariavel()
{
--VariavelAumentar; //-- = contagem regresssiva
if(VariavelAumentar == 0)
{
KillTimer(Timer);
VariavelAumentar = 10;
Timer = SetTimer("AumentarVariavel",1000,true);
}
//Atualizar relogio
return true;
}

#define SLOTS MAX_PLAYERS
new Contar ;
forward Contar10( playerid) ;
forward Contar9( playerid) ;
forward Contar8( playerid) ;
forward Contar7( playerid) ;
forward Contar6( playerid) ;
forward Contar5( playerid) ;
forward Contar4( playerid) ;
forward Contar3( playerid) ;
forward Contar2( playerid) ;
forward Contar1( playerid) ;
forward Correr( playerid) ;
if ( strcmp( cmdtext, "/contar", true) == 0)
{
GetPlayerName( playerid, sendername, sizeof( sendername) ) ;
format( string, sizeof( string) , "%s Comeзou a contagem!", sendername) ;
Contar = 1 ;
SetTimerEx( "Contar10", 500, false, "d", playerid) ;
SendClientMessageToAll( 0xFFFF00AA, string) ;
return 1 ;
}
public Contar10( playerid)
{
SetTimerEx( "Contar9", 1000, false, "d", playerid) ;
for( new i = 0 ; i < SLOTS ; i++)
{
PlayerPlaySound( i, 1056, 0.0, 0.0, 0.0) ;
}
GameTextForAll( "~b~[10]", 1500, 3) ;
return 1 ;
}
public Contar9( playerid)
{
SetTimerEx( "Contar8", 1000, false, "d", playerid) ;
for( new i = 0 ; i < SLOTS ; i++)
{
PlayerPlaySound( i, 1056, 0.0, 0.0, 0.0) ;
}
GameTextForAll( "~b~[9]", 1500, 3) ;
return 1 ;
}
public Contar8( playerid)
{
SetTimerEx( "Contar7", 1000, false, "d", playerid) ;
for( new i = 0 ; i < SLOTS ; i++)
{
PlayerPlaySound( i, 1056, 0.0, 0.0, 0.0) ;
}
GameTextForAll( "~b~[8]", 1500, 3) ;
return 1 ;
}
public Contar7( playerid)
{
SetTimerEx( "Contar6", 1000, false, "d", playerid) ;
for( new i = 0 ; i < SLOTS ; i++)
{
PlayerPlaySound( i, 1056, 0.0, 0.0, 0.0) ;
}
GameTextForAll( "~b~[7]", 1500, 3) ;
return 1 ;
}
public Contar6( playerid)
{
SetTimerEx( "Contar5", 1000, false, "d", playerid) ;
for( new i = 0 ; i < SLOTS ; i++)
{
PlayerPlaySound( i, 1056, 0.0, 0.0, 0.0) ;
}
GameTextForAll( "~b~[6]", 1500, 3) ;
return 1 ;
}
public Contar5( playerid)
{
SetTimerEx( "Contar4", 1000, false, "d", playerid) ;
for( new i = 0 ; i < SLOTS ; i++)
{
PlayerPlaySound( i, 1056, 0.0, 0.0, 0.0) ;
}
GameTextForAll( "~b~[5]", 1500, 3) ;
return 1 ;
}
public Contar4( playerid)
{
SetTimerEx( "Contar3", 1000, false, "d", playerid) ;
for( new i = 0 ; i < SLOTS ; i++)
{
PlayerPlaySound( i, 1056, 0.0, 0.0, 0.0) ;
}
GameTextForAll( "~b~[4]", 1500, 3) ;
return 1 ;
}
public Contar3( playerid)
{
SetTimerEx( "Contar2", 1000, false, "d", playerid) ;
for( new i = 0 ; i < SLOTS ; i++)
{
PlayerPlaySound( i, 1056, 0.0, 0.0, 0.0) ;
}
GameTextForAll( "~b~[3]", 1500, 3) ;
return 1 ;
}
public Contar2( playerid)
{
SetTimerEx( "Contar1", 1000, false, "d", playerid) ;
for( new i = 0 ; i < SLOTS ; i++)
{
PlayerPlaySound( i, 1056, 0.0, 0.0, 0.0) ;
}
GameTextForAll( "~b~[2]", 1500, 3) ;
return 1 ;
}
public Contar1( playerid)
{
SetTimerEx( "Correr", 1000, false, "d", playerid) ;
for( new i = 0 ; i < SLOTS ; i++)
{
PlayerPlaySound( i, 1056, 0.0, 0.0, 0.0) ;
}
GameTextForAll( "~b~[1]", 1500, 3) ;
return 1 ;
}
public Correr( playerid)
{
Contar = 0 ;
for( new i = 0 ; i < SLOTS ; i++)
{
PlayerPlaySound( i, 1057, 0.0, 0.0, 0.0) ;
}
GameTextForAll( "~r~Vai !", 1500, 3) ;
return 1 ;
}