#1

Ok ive got a timer that works great but i want asecond time the same but ust with a different time on it but when i try to moddify it i get errors i do not understand totally.

Код:
forward TimedCountdown(playerid);
public TimedCountdown(playerid) {
    if(iTimedCountdown == -1) {
        iTimedCountdown = 81;
    }

    new
        szMessage[10];

    iTimedCountdown--;
    format(szMessage, sizeof(szMessage), "~r~%d",iTimedCountdown); // Add more in if you wish.

    GameTextForPlayer(playerid, szMessage, 950, 6);

    if(iTimedCountdown == 0) {
        KillTimer(Sfracetimer);
        DisablePlayerRaceCheckpoint(playerid);
    }
    return 1;
}
So i need another one like this but im not sure what i need to change in it ?
Reply
#2

pawn Код:
forward TimedCountdown1(playerid); // Also make a new SetTimerEx function in which you just add the number 1 in the funciton name.
public TimedCountdown1(playerid) {
    if(iTimedCountdown[1] == -1) { // Under there on iTimedCountDown put: new iTimedCountdown[2];
        iTimedCountdown[1] = 81; // At the other timer put : iTimedCountdown[0] Or you can do it it like this:
    }
/*    if(iTimedCountdown1 == -1) { // UYou need a >> new iTimedCountdown1;
        iTimedCountdown1 = 81; // Just uncomment and comment the other one.
    }
*/

    new
        szMessage[10];

    iTimedCountdown--; //  v down there, I have put ~n~ because that makes a new row, you don't want the timers to be in the same row and get one over an other.
    format(szMessage, sizeof(szMessage), "~n~~r~%d",iTimedCountdown); // Add more in if you wish.

    GameTextForPlayer(playerid, szMessage, 950, 6);

    if(iTimedCountdown == 0) {
        KillTimer(Sfracetimer);
        DisablePlayerRaceCheckpoint(playerid);
    }
    return 1;
}
Try this one.
Reply
#3

Yep that work thanks. So now if i want to make another i just chane the 1 to 2.
Reply
#4

Yes. There are better methods tohugh, what do you need the timers for ?
Reply
#5

They are for races. So if the timer runs out disableracecheckpoints happens.
Reply
#6

You know you shoul store the timer in a variable and at the end of the race destoy the timer.
Reply
#7

How would i do that do you know any guides or links for doing that?
Reply
#8

There you go :

https://sampwiki.blast.hk/wiki/KillTimer
https://sampwiki.blast.hk/wiki/SetTimer
https://sampwiki.blast.hk/wiki/SetTimerEx
Reply
#9

sovled
Reply
#10

Half Solved
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)