SA-MP Forums Archive
[AJUDA] Ligar Timer - 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: [AJUDA] Ligar Timer (/showthread.php?tid=299460)



[AJUDA] Ligar Timer - atsbs - 26.11.2011

Ja fiz tudo na conce, agr so ta dando poblema no no tempo, nao tu conseguindo ligar o comando /teste ao contador, segue as linhas :

Comando:

PHP код:
if(strcmp("/teste"cmdtexttrue10) == 0)
        {
                if(
IsPlayerConnected(playerid))
                {
                        new 
carid GetPlayerVehicleID(playerid);
                        if(
Testedrive(carid))
                        {
                        
Teste[playerid] = GetPlayerVehicleID(playerid);
                        
SetTimer("testtimer"1200001);
                        
PlayerPlaySound(playerid10520.00.00.0);
                        
TogglePlayerControllable(playerid1);
                        
GameTextForPlayer(playerid"~w~O Teste Drive Em ~b~120 SEG~n~ ~w~Acaba, Bom Proveito"50003);
                        }
                }
                return 
1;
        } 
Timer:

PHP код:
public testtimer()
{
    for(new 
i=0;i<MAX_PLAYERS;i++)
    {
        if(
Teste[i] == 1)
        {
            
TimeTest[i]++;
            new 
str[256];
            
format(str256," ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ tempo: ~w~%d"TimeTest[i]);
            
GameTextForPlayer(istr2000,6);
            if(
TimeTest[i] >= 120 && Teste[i] == 1)
            {
                
TimeTest[i]=0;
                
Teste[i] = 0;
                
TakingLesson[i] = 0;
                
KillTimer(testtempo);
                
KillTimer(testtempo);
                
KillTimer(testtempo);
                
SendClientMessage(iCOLOR_OOC"Tempo Acabado, Volte Sempre");
                
SetVehicleToRespawn(i);
                
SetPlayerPos(i,-2048.0999, -84.500035.0000);
                
GameTextForPlayer(i"~y~Seu Teste Driver Acabou~n~~r~Se Quiser Compra o Carro /compra [CarroNome/ID]"50003);
             }
        }
    }
    return 
0;




Re: [AJUDA] Ligar Timer - Lуs - 26.11.2011

Tente:

pawn Код:
//================== VARIБVEL GLOBAL ==========//
new bool:Teste[MAX_PLAYERS];

//================== COMANDO ==================//
        if(strcmp("/teste", cmdtext, true, 10) == 0)
        {
                if(IsPlayerConnected(playerid))
                {
                        new carid = GetPlayerVehicleID(playerid);
                        if(Testedrive(carid))
                        {
                            Teste[playerid] = true;
                            SetTimer("testtimer", 120*1000, false);
                            PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                            TogglePlayerControllable(playerid, 1);
                            GameTextForPlayer(playerid, "~w~O Teste Drive Em ~b~120 SEG~n~ ~w~Acaba, Bom Proveito", 5000, 3);

                        }
                }
                return 1;
        }

//=================== PUBLIC ====================//
public testtimer()
{
    for(new i=0;i<MAX_PLAYERS;i++)
    {
        new str[256];
        format(str, 256," ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ tempo: ~w~%d", TimeTest[i]);
        GameTextForPlayer(i, str, 2000,6);
        if(Teste[i] == true)
        {
            Teste[i] = false;
            TakingLesson[i] = 0;
            SendClientMessage(i, COLOR_OOC, "Tempo Acabado, Volte Sempre");
            SetVehicleToRespawn(i);
            SetPlayerPos(i,-2048.0999, -84.5000, 35.0000);
            GameTextForPlayer(i, "~y~Seu Teste Driver Acabou~n~~r~Se Quiser Compra o Carro /compra [CarroNome/ID]", 5000, 3);
        }
    }
    return 0;
}



Re: [AJUDA] Ligar Timer - atsbs - 26.11.2011

Consegui ligar, mais ele nao anda so sai TEMPO:1 e some nao conta ate 120.


Re: [AJUDA] Ligar Timer - Lуs - 26.11.2011

Tente assim entгo:
pawn Код:
new bool:Teste[MAX_PLAYERS];
testtimer(playerid);

//================== COMANDO ==================//
        if(strcmp("/teste", cmdtext, true, 10) == 0)
        {
                if(IsPlayerConnected(playerid))
                {
                        new carid = GetPlayerVehicleID(playerid);
                        if(Testedrive(carid))
                        {
                            Teste[playerid] = true;
                            SetTimerEx("testtimer", 120*1000, false, "i", playerid);
                            PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                            TogglePlayerControllable(playerid, 1);
                            GameTextForPlayer(playerid, "~w~O Teste Drive Em ~b~120 SEG~n~ ~w~Acaba, Bom Proveito", 5000, 3);

                        }
                }
                return 1;
        }

//=================== PUBLIC ====================//
public testtimer(playerid)
{
//    new str[256];
//    format(str, 256," ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ tempo: ~w~%d", TimeTest[i]);
//    GameTextForPlayer(playerid, str, 2000,6);
    new veiculo = GetPlayerVehicleID(playerid);
    Teste[playerid] = false;
    TakingLesson[playerid] = 0;
    SendClientMessage(playerid, COLOR_OOC, "Tempo Acabado, Volte Sempre");
    SetVehicleToRespawn(veiculo);
    SetPlayerPos(playerid,-2048.0999, -84.5000, 35.0000);
    GameTextForPlayer(playerid, "~y~Seu Teste Driver Acabou~n~~r~Se Quiser Compra o Carro /compra [CarroNome/ID]", 5000, 3);
    return 1;
}



Re: [AJUDA] Ligar Timer - atsbs - 26.11.2011

Editei e deixei assim

CMD:

PHP код:
if(strcmp("/teste"cmdtexttrue10) == 0)
        {
                if(
IsPlayerConnected(playerid))
                {
                        new 
carid GetPlayerVehicleID(playerid);
                        if(
Testedrive(carid))
                        {
                        
Teste[playerid] = GetPlayerVehicleID(playerid);
                        
PlayerPlaySound(playerid10520.00.00.0);
                        
TogglePlayerControllable(playerid1);
                        
GameTextForPlayer(playerid"~w~O Teste Drive Em ~b~120 SEG~n~ ~w~Acaba, Bom Proveito"50003);
                            if (
testtimer())
                            {
                                
Teste[playerid] = 1;
                                
SetTimer("testtimer"120*10001);
                                
GameTextForPlayer(playerid"~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~-~y~ 3 ~g~-",1000,3);
                            }
                        }
                }
                return 
1;
        } 
Public:
PHP код:
public testtimer()
{
    for(new 
i=0;i<MAX_PLAYERS;i++)
    {
        if(
Teste[i] == 1)
        {
            
TimeTest[i]++;
            new 
str[256];
            
format(str256," ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ tempo: ~w~%d"TimeTest[i]);
            
GameTextForPlayer(istr2000,6);
            
SetTimer("testtimer"120*10001);
            if(
TimeTest[i] >= 120 && Teste[i] == 1)
            {
                
TimeTest[i]=0;
                
Teste[i] = 0;
                
TakingLesson[i] = 0;
                
KillTimer(testtempo);
                
KillTimer(testtempo);
                
KillTimer(testtempo);
                
SendClientMessage(iCOLOR_OOC"Tempo Acabado, Volte Sempre");
                
SetVehicleToRespawn(i);
                
SetPlayerPos(i,-2048.0999, -84.500035.0000);
                
GameTextForPlayer(i"~y~Seu Teste Driver Acabou~n~~r~Se Quiser Compra o Carro /compra [CarroNome/ID]"50003);
             }
        }
    }
    return 
0;

Mais so sai TEMPO:1 e acaba, Nem o Tempo Acado diz.


Re: [AJUDA] Ligar Timer - atsbs - 26.11.2011

Galera desculpe o doubler post mais estou precisando muito e nao acho a soluзгo.