Using Timers - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Using Timers (
/showthread.php?tid=335977)
Using Timers -
HazardGaming - 20.04.2012
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.
Re: Using Timers -
aRoach - 20.04.2012
Something like a Random Interior ?
Re: Using Timers -
HazardGaming - 20.04.2012
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)
Re: Using Timers -
aRoach - 20.04.2012
Oh, ok
![Cheesy](images/smilies/biggrin.png)
:
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;
}
Re: Using Timers -
[KHK]Khalid - 20.04.2012
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;
}
Re: Using Timers -
HazardGaming - 20.04.2012
Thanks both!