SA-MP Forums Archive
Countdown problems - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Countdown problems (/showthread.php?tid=333054)



Countdown problems - spd_sahil - 10.04.2012

pawn Код:
dcmd_timer(playerid,params[])
{
    #pragma unused params
    cd1 = 6;
    SetTimerEx("CdCd",100,0,"i",playerid);
    return 1;
}
forward CdCd(playerid);
public CdCd(playerid)
{
    cd1--;
    if(cd1 == 0)
    {
        GameTextForPlayer(playerid,"Go!",1500,6);
    }
    if(cd1 >= 1)
    {
        new string[256];
        format(string,sizeof(string),"%i",cd1);
        GameTextForPlayer(playerid,string,1000,6);
        check();
    }
}
forward check();
public check()
{
    SetTimer("CdCd",1000,0);
}
thats my countdown code.. which shows countdown only for the person who is doing it...


but the problem is , when i plugin the FS in my gamemode, the first time a command /timer . the number 5 appears for a second and goes away , but when i do this the second time.. the countdown works properly


Re: Countdown problems - DarkScripter - 10.04.2012

pawn Код:
new Temp;


dcmd_timer(playerid, params[])
{
    if(Temp != 6)
        return SendClientMessage(playerid, -1,"The timer was started,");
       
    StartTime(playerid);
    return true;
}



StartTime(playerid);
public StartTime(playerid)
{
    if(Temp == 6)
    {
        GameTextForPlayer(playerid, "Go Go Go", 2500, 3);
        Temp = 6;
        return false;
    }
   
    Temp--;
    GameTextForPlayer(playerid,evalstr(Temp), 2500, 3);
    return SetTimerEx("StartTime", 1000, false, "i", playerid);
}


evalstr(inte)
{
    static it[10];
    format(it, sizeof(it),"%d", inte);
    return it;
}



Re: Countdown problems - Knight_Rider - 10.04.2012

Use THIS