[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
#2

easy but useful , thanks
Reply
#3

Thankyou.
Reply
#4

https://sampwiki.blast.hk/wiki/Random_Messages
copied from samp wiki,pathetic.
Reply
#5

You failed to explain the tutorial.Like this part:
pawn Code:
public SendMSG()
{
    new randMSG = random(sizeof(RandomMSG));
    SendClientMessageToAll(-1, RandomMSG[randMSG]);
}
This a tutorial for newbies so newbies would not be able to understand what they just saw.All in all,a bad tutorial.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)