SA-MP Forums Archive
Random Messages blinking! Why? - 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: Random Messages blinking! Why? (/showthread.php?tid=401216)



Random Messages blinking! Why? - FL3GM4 - 22.12.2012

my random messages blinking whole time, why?

Код:
forward RandomMessage();
Код:
SetTimer("RandomMessage",1000,true);
Код:
new RandomMessages[][] =
{
	"~y~WestSide: ~w~Ukoliko uocite Hakera prijavite ga na ~r~/report",
    "~y~WestSide: ~w~Ukoliko ste novi na serveru, pisite ~g~/new",
    "~y~WestSide: ~w~Posijetite nas na forumu: ~r~http://ch-samp.com/forum/",
    "~y~WestSide: ~w~Uocili ste Bug? Prijavite ga na ~r~/report ~w~ i na ~g~forumu"
};
Код:
public RandomMessage()
{
	TextDrawSetString(KizlaRandomP, RandomMessages[random(sizeof(RandomMessages))]);
 	return 1;
}



Re: Random Messages blinking! Why? - zDevon - 22.12.2012

The 'true' in your SetTimer function is telling the server to call your RandomMessage() every 1000 milliseconds, that's why .

https://sampwiki.blast.hk/wiki/SetTimer
Quote:
funcname[] Name of the function to call as a string. Needs to be a public!
interval Interval in milliseconds.
repeating Boolean if the timer should occur repeatedly or only once
See if changing it to false will help.

Edit: or, it seems like you followed https://sampforum.blast.hk/showthread.php?tid=401096. If you want the messages to alternate periodically you should just increase the interval (from 1000, to something like 60000). Only change that last param to false if you want to select a random message once (in OnGameModeInit for instance).