Advertisement Queue [+REP] - 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: Advertisement Queue [+REP] (
/showthread.php?tid=605207)
Advertisement Queue [+REP] -
Amit1998 - 15.04.2016
Hey,
I've been thinking about adding an advertisement queue system to my server. However, I'm having a hard time in figuring out how to script it. Would love it if you gave me ideas.
Respuesta: Advertisement Queue [+REP] -
DragonZafiro - 16.04.2016
use the "SetTimerEx" function, you can make it with a very easy method:
PHP код:
// OnGameModeInit... or wherever you want
SetTimerEx("Advertisement", 10000, false, "d", 0); // We will start at messageID 0
// Top on your script
forward Advertisement(messageID);
public Advertisement(messageID)
{
switch(messageID)
{
case 0: SendClientMessageToAll(-1, "My Advertisement!!");
case 1: ...............
}
// Call the timer again, but with another ID, you can do it random
SetTimerEx("Advertisement", 50000, false, "d", messageID + 1); // Call the function again, after 50 secs, with another ID
}
Rep me if i helped