[HELP]Timer for all ?
#1

Hi , I have a variable who checks if the player spawns without doing tutorial then I start it:
pawn Код:
TuerTempsTutoriel = SetTimer("Tutoriel", 1000, true);
the Timer function:
pawn Код:
forward Tutoriel();
public Tutoriel()
{
    for(new i; i<MAX_PLAYERS; i++)
    {
        if(!IsPlayerConnected(i)) continue;
        TempsTutoriel[i] ++;
        if(TempsTutoriel[i] == 8) // Tuto 1
        {
            //blabla
        }
        else if(TempsTutoriel[i] == 65)
        {
            //blabla
         }
//.....other things
    return 1;
}
The problem is I think that when a player spawns without doing tutorial all players do it ,(like this tutorial timer is started for everyone , So I must change it to playerid only?)
Reply
#2

Change
pawn Код:
SetTimer("Tutoriel", 1000, true);
Too this:
pawn Код:
SetTimerEx("Tutoriel", 1000, false, "i", playerid); // the false is making it NOT Loop if you want to look it change it to true
That should work
Reply
#3

Thank you ! i should also change that?
pawn Код:
forward Tutoriel();
public Tutoriel()
to :
pawn Код:
forward Tutoriel(playerid);
public Tutoriel(playerid)
or not?
Reply
#4

yes you need to do that otherwise it will say unidentified symbol "playerid"
Reply
#5

Quote:
Originally Posted by Infinity90
Посмотреть сообщение
Change
pawn Код:
SetTimerEx("Tutoriel", 1000, false, "i", playerid); // the false is making it NOT Loop if you want to look it change it to true
That should work
What are you talking about, don't teach something you have no idea what it does.
false means the timer will only run one time and stop
true means that it will keep running until the player disconnects or till you kill the timer.
Also true = 1 and false= 0
Reply
#6

Thank you !

Yes I need it until I kill timer (changed false to true)
Reply
#7

I meant repeat -_-
Reply
#8

one thing , the
pawn Код:
KillTimer(TuerTempsTutoriel);
will kill the tutorial for the player only or all ?
so should I also make it like
pawn Код:
KillTimer(TuerTempsTutoriel[playerid]);
?
Reply
#9

Use the second one.BUT make sure you define it well
pawn Код:
new TuerTempsTutoriel[MAX_PLAYERS];
Reply
#10

Thank you ! and also
Код:
TuerTempsTutoriel = SetTimerEx("Tutoriel", 1000, true, "i", playerid);
to
Код:
TuerTempsTutoriel[playerid] =SetTimerEx("Tutoriel", 1000, true, "i", playerid);
so this will start it only for the player.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)