Countdown problems
#1

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
Reply
#2

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;
}
Reply
#3

Use THIS
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)