Timer in case 0:
#1

pawn Код:
new Tutorial[ MAX_PLAYERS ][ 2 ]; //Should be global, so we can use it.

forward PlayerTutorial(playerid);
public PlayerTutorial(playerid)
{
    Tutorial[ playerid ][ 1 ] = SetTimerEx( "PlayerTutorial", 100*10*20, true, "i", playerid );
    choir = SetTimerEx( "WaitingTutorial", 100*10*2, true, "i", playerid );
    switch(Tutorial[playerid][0])
    {
        case 0:
        {
            KillTimer(choir);
        }
        case 1:
        {
            SendClientMessage(playerid, GREEN, "=========================================");
            SendClientMessage(playerid, -1, "Hello there. Welcome to San Andreas Online.");
            SendClientMessage(playerid, -1, "In this server, you will be able to ................");
            SendClientMessage(playerid, -1, "---------------------------------------------------");
            SendClientMessage(playerid, GREEN, "=========================================");
        }
        case 2:
        {
            SendClientMessage(playerid, -1, "Hello, welcome to SAOnline");
        }
        case 3:
        {
            SendClientMessage(playerid, -1, "Hello, welcome to SAOnline");
        }
        case 4:
        {
            SendClientMessage(playerid, -1, "Hello, welcome to SAOnline");
        }
        case 5:
        {
            SendClientMessage(playerid, -1, "Hello, welcome to SAOnline");
        }
        case 6:
        {
            SpawnPlayer(playerid);
            SendClientMessage(playerid, -1, "The end");
        }
        case 7:
        {
            KillTimer(Tutorial[ playerid ][ 1 ]);
        }
    }
    Tutorial[ playerid ][ 0 ] ++;
    return true;
}
I'm not sure if this is the way it is done, but I wanted to create a timer of 2 seconds (100*10*2 = 2000 miliseconds = 2 seconds) before the case 1: appears, which is simple SendClientMessage. However, it does not seem to work. What should I do?
Reply
#2

pawn Код:
new Tutorial[MAX_PLAYERS];


// You can add this to place where you want message to appear
SetTimerEx("WaitingTutorial", 500, false, "i", playerid); // It will show

forward WaitingTutorial(playerid);
public WaitingTutorial(playerid)
{
    SendClientMessage(....);
    SetTimerEx("PlayerTutorial", 2000, false, "i", playerid); // Next tut will begin after 2 secs
    Tutorial[playerid] = 1;
    return 1;
}

forward PlayerTutorial(playerid);
public PlayerTutorial(playerid)
{
    if(Tutorial[playerid] == 1)
    {
        // Your code
        SetTimerEx("PlayerTutorial", 2000, false, "i", playerid);
        Tutorial[playerid] = 2; // Second tutorial
    }
    else if(Tutorial[playerid] == 2)
    {
   
    }
    // etc
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)