SA-MP Forums Archive
Help Advertise timer - 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: Help Advertise timer (/showthread.php?tid=385707)



Help Advertise timer - KP2 - 17.10.2012

Hey i use this code for advertising forum and irc but all this does is flood the chat endlessly...any solution
Код:
#include <a_samp>
new Advertise_Gen1_idx, Advertise_Gen1[][] = {
	"Remember to visit our forum at -------.",
	"Admins 24/7 online at our IRC channel #-----. But players can join it too."
};
public OnFilterScriptInit()
{
	SetTimer("Advertise_Gen2", (00152), 1);
}
forward Advertise_Gen2();
public Advertise_Gen2()
{
	if(Advertise_Gen1_idx == sizeof(Advertise_Gen1))
		Advertise_Gen1_idx = 0;
	SendClientMessageToAll(0xCCFF00, Advertise_Gen1[Advertise_Gen1_idx]);
	Advertise_Gen1_idx ++;
}
+Rep who helps me first


Re: Help Advertise timer - KP2 - 17.10.2012

No one?


Re: Help Advertise timer - TzAkS. - 17.10.2012

Will call the function just once like this.
Код:
SetTimer("Advertise_Gen2", (00152), 0);



Re: Help Advertise timer - doreto - 17.10.2012

Quote:

SetTimer("Advertise_Gen2", (00152), 1);

It wil repeat calling Advertise function every 0.1.2 of the second(script will call every 1 second)

you can use it like


PHP код:
SetTime("Advertise_Gen2",300000,1); // 300 000  = 5 (by ****** calculation) 



Re: Help Advertise timer - x96664 - 17.10.2012

Just set the timer to 60000 milliseconds (1 minute) it doesn't flood.