SA-MP Forums Archive
Settimer - 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: Settimer (/showthread.php?tid=225815)



Settimer - Ironboy - 14.02.2011

I need to set a text "If you need any help do /help" like this.
It should be automatically come in a fixed time .how to do this?


Re: Settimer - Conroy - 14.02.2011

https://sampwiki.blast.hk/wiki/SetTimer


Re: Settimer - Ironboy - 14.02.2011

pawn Код:
forward message();
 
public OnGameModeInit()
{
    print("Starting timer...");
    SetTimer("message",1000,false); // Set a timer of 1000 miliseconds (1 second)
}
 
public message()
{
    print("1 second has passed.");
plz show me an example


Re: Settimer - BlackWolf120 - 14.02.2011

hi,
if u want to have more messages to announce (random) do it like in the folowing.
Otherwise just leave out the randomizing part and do a simple timer with only a single SendClientMessageToAll timer.

pawn Код:
//Timer, set time to whatever you want

//OnGameModeInit
SetTimer("RandomClientMessage",240000,1);

new Advertisement[][] = //RandomTimerClientMessages
{

{"message1"},
{"message2"},
{"message3"}

};

//Announcer/Advertisement Timer
forward RandomClientMessage();
public RandomClientMessage()
{
new randommessage = random(sizeof(Advertisement));
new Advertisementstring[140];
format(Advertisementstring, sizeof(Advertisementstring),"%s",Advertisement[randommessage]);
SendClientMessageToAll(0xFFFF00FF, Advertisementstring);
}
hope this helps.

regards...


Re: Settimer - Ironboy - 14.02.2011

ok ty very much


Re: Settimer - BlackWolf120 - 14.02.2011

youre welcome