Player ids are mixed ?!
#1

EDITED: I fixed it myself, thanks to everyone though .
Reply
#2

Sorry, but i cant really understand your post.

You start 3 timers every time a player is connected and you need to kill timers when the player finish his tutorial, right?

Код:
new timer1[MAX_PLAYERS];
new timer2[MAX_PLAYERS];
new timer3[MAX_PLAYERS];
.. start ..
timer1[playerid]=SetTimerEx
timer2[playerid]=SetTimerEx
timer3[playerid]=SetTimerEx
.. kill ..
KillTimer(timer1[playerid]);
KillTimer(timer2[playerid]);
KillTimer(timer3[playerid]);
KillTimer ( timer_id ); kills the timer.
Reply
#3

I know how to kill a timer, the thing is, once a player connects and finishes everything and spawns, and another player connects, BOTH of the players are sent to the tutorial/registration/etc.
Reply
#4

You don't need to kill the timer, it will kill itself when the time is passed
Reply
#5

Maybe you want something like this:

How this works:
Every X time the player see a tutorial stage; after X time the tutorial stages change until he reach the final stage where he is set ready to spawn.

Код:
new TutorialTimer [MAX_PLAYERS];

public OnPlayerConnect (playerid)
{
TutorialTimer [playerid] = SetTimerEx ("TutorialStage", 1, 0, "ii", playerid, 1);
}

public TutorialStage(playerid, stage) {
switch (stage) {
case 1: {
// the player are in stage 1

SetTimerEx ("TutorialStage", 3500, 0, "ii", playerid, 2); // 3500 = how much time the player should see this message? // 2 = what is the next stage?
}
case 2: 
{
SetTimerEx ("TutorialStage", 3500, 0, "ii", playerid, 3); // 3500 = how much time the player should see this message? // 3 = what is the next stage?
}
case 3:
{
// finish here
SetTimerEx ("TutorialStage", 3500, 0, "ii", playerid, 4); // 3500 = how much time the player should see this message? // 4 = what is the next stage?
}
case 4:
{
// reset the player here; him is ready to spawn.
}
}
}
if you think you can do something wrong

Код:
top:

#define NEXT_TUT_STAGE(%0,%1) SetTimerEx ("TutorialStage", %0, 0, "ii", playerid, %1);

then


public TutorialStage(playerid, stage) {
switch (stage) {
case 1: {
// the player are in stage 1

NEXT_TUT_STAGE(3500, 2); // 3500 = how much time the player should see this message? // 2 = what is the next stage?
}
case 2: 
{
NEXT_TUT_STAGE(3500, 3); // 3500 = how much time the player should see this message? // 3 = what is the next stage?
}
case 3:
{
// finish here
NEXT_TUT_STAGE(3500, 4); // 3500 = how much time the player should see this message? // 4 = what is the next stage?
}
case 4:
{
// reset the player here; he is ready to spawn.
}
}
}
You can do the same thing in different ways, using a repeat system but if you want to use different timers for every stage of the tutorial this is better.
You should use a variable to kill the timer if the player have any way to leave the tutorial
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)