Using Timers
#1

Hello,
I was wondering how I would set a player in an interior for 10 seconds, then move to another interior.

I.E
In a plane interior then to the Airport Interior!

Thanks.
Reply
#2

Something like a Random Interior ?
Reply
#3

Well,
What I want to do is..
Set a player in the plane interior for 10 seconds, then to the Airport Interior.. How can I do this? (first time using timers)
Reply
#4

Oh, ok :
pawn Код:
// Global Variable
new ChangeInterior_Timer[ MAX_PLAYERS ];

// Timer
ChangeInterior_Timer[ playerid ] = SetTimerEx( "ChangeInterior", 10000, true, "i", playerid );

// Callback
forward ChangeInterior( playerid );
public ChangeInterior( playerid )
{
    new _P[ MAX_PLAYERS ] = 0;
   
    switch( _P[ playerid ] )
    {
        case 0:
        {
            // Do your code for the Plane Interior
        }
        case 1:
        {
            // Do your code for the Airport Interior
        }
        // And so on...
        // PS: At the last case, in this case, '1', use 'KillTimer( ChangeInterior_Timer[ playerid ] );' and '_P[ playerid ] = 0;'.
    }
    _P[ playerid ] ++;

    return 1;
}
Reply
#5

Something like that?
pawn Код:
// Making a command to start the timer
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/start", cmdtext, true) == 1)
    {
            /*
                Here you should set them to the plane interior
            */

            SetTimerEx("MyCallback", 10000, false, "i", playerid); // Calling the timer (10 seconds)
            return 1;
    }
    return 0;
}

// forwarding MyCallback
forward MyCallback(playerid);

public MyCallback(playerid)
{
    // When 10 seconds passed
    /*
        Here set them to the airport interior
    */

    return 1;
}
Reply
#6

Thanks both!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)