[Tutorial] Random Messages
#1

Okay today I will show you how can you make Random Messages.
Lets Begin!

The first step you will do to make random messages is this.
pawn Code:
new RandomMSG[][] =
{
    "Random Tutorial Message 1",//This is the first message it will send,You ca change it to any thing you want.
    "Random Tutorial Message 2",//Second Message
    "Random Tutorial Message 3",//Third Message
    "Random Tutorial Message 4"//Fourth Message
};
I added 4 messages here you can add as many as you want but after every message you need to make a
Code:
,
and you do not have to do this for last one.

Under on gamemode init you need to set timer like this
pawn Code:
SetTimer("SendMSG", 30000, true);
Timer is in miliseconds so 30000 is 30 seconds for 1 minute you can use 60000 and so on.

You need to forward this to make it work like this.
pawn Code:
forward SendMSG();
Now just you need to add callback of this its just sending the message to player.
pawn Code:
public SendMSG()
{
    new randMSG = random(sizeof(RandomMSG));
    SendClientMessageToAll(-1, RandomMSG[randMSG]);
}
I hope you have learned something from this.
Reply


Messages In This Thread
Random Messages - by Dare Devil..... - 08.09.2012, 15:12
Re: Random Messages - by xMCx - 08.09.2012, 15:15
Re: Random Messages - by Dare Devil..... - 08.09.2012, 15:53
Re: Random Messages - by leonardo1434 - 08.09.2012, 17:58
Re: Random Messages - by TaLhA XIV - 08.09.2012, 20:31

Forum Jump:


Users browsing this thread: 1 Guest(s)