A quick question about timers.
#1

How to run same timer multiple times? not on repeat, but to run it whenever needed
Reply
#2

Often people use a tick timer, which is a one second timer, with a loop, that counts onto each of the variables being monitored.

Depends on how you are using your timers though...
Reply
#3

I'm trying to make a system where like, There's a /join command to join the match its like a battleroyal mode, so whenever I type that it works the first time it's a 5 second timer letting people join the match before it starts, me and my mate play and I kill him, the second time I type it, after the match finishes It just puts us in instantly, no chance for other people to play.
Reply
#4

Near the top of your script.

Код:
new Countdown = -1;
Within the timer, one second, repeating.

Код:
{
    if(Countdown)
    {
        Countdown--;
    {
    elseif(Countdown==0)
    {
        Countdown--;
        SendMessageToAll(-1, "Join time finished.");
    }
    elseif(Countdown<0)
    {
    }
}
In the command that starts the countdown.

Код:
Countdown=5;
SendMessageToAll(-1, "Join match via /join");
In the command that joins the event,

Код:
if(!Countdown)
{
    SendClientMessage(playerid, -1, "You are too late to join.");
}
else
{
    SetPlayerPos(playerid, x,y,z);
}
Now the if structure can use some work, as it's simply from scratch, and could even have issues with it but it's something to look at.

Countdown will stay at -1 at rest, when hit to 5, it'll count down. When it hits 0 it'll advertise that people are no longer able to join, and then it will roll over to -1, where it will sit.
Reply
#5

if it keeps failing on the second time make sure that you're resetting every variable thats set the moment u enter that battleroyal at the time it ends, there must be something u forgot to reset for ex new bool:battleroyalstarted; once u enter its battleroyalstarted =truel; YOU MUST make it battleroyalstarted=false; once it ends, or show me your code and i'll point out where u went wrong if possible.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)