SA-MP Forums Archive
[Ajuda] Uma contagem apenas pra quem estб no x1. - 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] Uma contagem apenas pra quem estб no x1. (/showthread.php?tid=384059)



Uma contagem apenas pra quem estб no x1. - Dragonborn - 10.10.2012

Boa noite pessoal, bom, todo o esquema do x1 eu consegui fazer, o probelma agora й com a contagem, de quando alguйm aceita o x1 e aparece... Eu tentei milhхes de vezes de diversas formas, porйm, a contagem nunca saia certa, sempre pulava alguns nъmeros (ia rapido de mais) ou ao chegar no ultimo valor (GO!) repetia...

Atй ai oq eu fiz :
pawn Код:
// Dentro da public de menus
Count = 5;
                CountdownTimerX1Running = SetTimerEx("CountDownX1Running", 1000, 1, "n", i);


// public quando й chamada pelo timer.
public CountDownX1Running(playerid)
{
    switch(Count)
    {
        case 5: { GameTextForPlayer(playerid,"~n~~w~]~r~ 5 ~w~]", 1000, 3), PlayerPlaySound(playerid, 1056, 0,0,0); }
        case 4: { GameTextForPlayer(playerid,"~n~~w~]~r~ 4 ~w~]", 1000, 3), PlayerPlaySound(playerid, 1056, 0,0,0); }
        case 3: { GameTextForPlayer(playerid,"~n~~w~]~r~ 3 ~w~]", 1000, 3), PlayerPlaySound(playerid, 1056, 0,0,0); }
        case 2: { GameTextForPlayer(playerid,"~n~~w~]~y~ 2 ~w~]", 1000, 3), PlayerPlaySound(playerid, 1056, 0,0,0); }
        case 1: { GameTextForPlayer(playerid,"~n~~w~]~y~ 1 ~w~]", 1000, 3), PlayerPlaySound(playerid, 1056, 0,0,0); }
        case 0:
        {
            GameTextForPlayer(playerid,"~n~~b~]~g~ GO! ~b~]", 2000, 3);
            PlayerPlaySound(playerid, 1057, 0,0,0);
            KillTimer(CountdownTimerX1Running);
        }
    }
    Count--;
}
Nгo preciso postar o resto pos nгo estб envolvido, mas na public do menu, o "i" vem do loop dentro da public.

ah, esse foi o ultimo que eu tentei... Se alguem poder me ajudar, agradeзo (estou confundindo tudo...)


Re: Uma contagem apenas pra quem estб no x1. - Jonas_Alves - 10.10.2012

Bem... se й o que eu entendi... Crie uma bool
pawn Код:
new bool:EstouNoX1;
Depois...
pawn Код:
if(EstouNoX1[playerid] ==  true)
{    
    SetTimer("CountDownX1Running", 1000, false);
    return 1;
}
Assim... a settimer sу vai ser executada para o player que estiver no X1...
Ou seja caso houver um comando em seu GM/FS /irx1 Coloque no comando:
pawn Код:
EstouNoX1[playerid] = true;



Re: Uma contagem apenas pra quem estб no x1. - ForT - 10.10.2012

no seu GM sу pode 2 pessoas tirar x1 por vez? porque se nгo teria que ser
pawn Код:
//no topo
new CountdownTimerX1Running[MAX_PLAYERS];


CountdownTimerX1Running[i] = SetTimerEx("CountDownX1Running", 1000, 1, "n", i);

public CountDownX1Running(playerid)
{
    switch(Count)
    {
        case 5: { GameTextForPlayer(playerid,"~n~~w~]~r~ 5 ~w~]", 1000, 3), PlayerPlaySound(playerid, 1056, 0,0,0); }
        case 4: { GameTextForPlayer(playerid,"~n~~w~]~r~ 4 ~w~]", 1000, 3), PlayerPlaySound(playerid, 1056, 0,0,0); }
        case 3: { GameTextForPlayer(playerid,"~n~~w~]~r~ 3 ~w~]", 1000, 3), PlayerPlaySound(playerid, 1056, 0,0,0); }
        case 2: { GameTextForPlayer(playerid,"~n~~w~]~y~ 2 ~w~]", 1000, 3), PlayerPlaySound(playerid, 1056, 0,0,0); }
        case 1: { GameTextForPlayer(playerid,"~n~~w~]~y~ 1 ~w~]", 1000, 3), PlayerPlaySound(playerid, 1056, 0,0,0); }
        case 0:
        {
            GameTextForPlayer(playerid,"~n~~b~]~g~ GO! ~b~]", 2000, 3);
            PlayerPlaySound(playerid, 1057, 0,0,0);
            KillTimer(CountdownTimerX1Running[playerid]);
        }
    }
    Count--;
}