SA-MP Forums Archive
[solved] npc 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [solved] npc Timers (/showthread.php?tid=106849)



[solved] npc Timers - troy52192 - 06.11.2009

im having an issue with timers i want the timers just to delay on the first round . how can i fix this to order to not repeat on the next rounds?

here is the code:
Код:
#include <a_npc>

#define NUM_PLAYBACK_FILES 2
new gPlaybackFileCycle=0;

//------------------------------------------

main(){}

//------------------------------------------

NextPlayback()
{
	// Reset the cycle count if we reach the max
	if(gPlaybackFileCycle==NUM_PLAYBACK_FILES) gPlaybackFileCycle = 0;

	if(gPlaybackFileCycle==0) {
 	SetTimer("delay",900,0);
	}
	else if(gPlaybackFileCycle==1) {
	SetTimer("delay2",900,0);
	}

	gPlaybackFileCycle++;
}

//------------------------------------------

public OnRecordingPlaybackEnd()
{
  NextPlayback();
}

//------------------------------------------

public OnNPCEnterVehicle(vehicleid, seatid)
{
	NextPlayback();
}

//------------------------------------------

public OnNPCExitVehicle()
{
  StopRecordingPlayback();
  gPlaybackFileCycle = 0;
}

//------------------------------------------
forward delay(delay);
public delay(delay)
{
	StartRecordingPlayback(PLAYER_RECORDING_TYPE_DRIVER,"Packer2");
	KillTimer(delay);
}
forward delay2(delay2);
public delay2(delay2)
{
 	StartRecordingPlayback(PLAYER_RECORDING_TYPE_DRIVER,"Packer22");
	KillTimer(delay2);
}