SA-MP Forums Archive
Random Message fast message - 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 Message fast message (/showthread.php?tid=559676)



Random Message fast message - bigboy81 - 24.01.2015

I have problem about random message.
Messages work normal with normal speed,but when player death random messages changing to fast.
my randommessage timer is under onplayerspawn

ChangeMessage = SetTimer("ChangeMessage", 100, true);

i think i need set under onplayerdeath killtimer for ChangeMessage and start timer again..

Who help me i give R+


Re: Random Message fast message - nezo2001 - 24.01.2015

100 = one hunder millisecond = 1 over 10 second !!


Re: Random Message fast message - bigboy81 - 24.01.2015

Quote:
Originally Posted by nezo2001
Посмотреть сообщение
100 = one hunder millisecond = 1 over 10 second !!
Never mind i increase now the timer,but again messages going to fast if player are death..

SetTimer("RandomMessage",8000,1);


Re: Random Message fast message - Ironboy - 24.01.2015

You should create a separate callback for random message rather than putting it under onplayerdeath or spawn and put the timer under OnGameModeinit.


Re: Random Message fast message - bigboy81 - 24.01.2015

Can you give me the example?


Re: Random Message fast message - Ironboy - 24.01.2015

pawn Код:
//Under OnGameModeInit
SetTimer("RandomMessage",60000,1); //1 minute period

forward RandomMessage();
public RandomMessage() {
    new mrand =random(2); //no of messages
    if(mrand == 1) {
       SendMessageToAll(COLOR_YELLOW,"Random message 1");}
    if(mrand == 2) {
        SendMessageToAll(COLOR_YELLOW,"Random message 2");}
    return 1;}