[Tutorial] sSiddhant Tutorial 1# Random Messages
#1

sSiddhant Tutorial 1# Random Messages


Hey guys, this is my first Tutorial on samp forum. I have played alot of servers and many of them are using this Random Message feature to send tips and information to the users. So today I am gonna post a simple tutorial on Hot to make your own Random Messages!!

First of all, Lets Create those messages

Quote:

new sRMSG[][] =
{
"How are you?",
"I am fine",
"So what's your plan?",
"more...."
};

So this code is an array, which stores all your messages. Now we have to create timer..

Quote:

SetTimer("sMSG", 45000, true);

OK! So this Timer is of 45000 milliseconds that is 45 seconds..Hope you know this
OK! Now we are gonna create a function or you can say a Callback.
This Callback will be called when the timer ends and We will also forward this function.
Remember Every Timer Callback has to be forwarded.

Quote:

forward sMSG);
public sMSG()
{
}

Ok! Now we are gonna create Commands which will send those messages

Quote:

new sRMessage = random(sizeof(sRMSG));//This is the First Command
SendClientMessageToAll(-1, sRMSG[sRMessage]); // This is the Second Command

The First line gets a random string value from the array sRMSG which we created and stores it in a variable
The Second line sends all user message which is stored in the variable sRMessage and you have to specify the color, I have used -1 which is white.

Now At the end your callback should look Something like this

Quote:

public sMSG()
{
new sRMessage = random(sizeof(sRMSG));
SendClientMessageToAll(-1, sRMSG[sRMessage]);
}

This is it for today, I will post more tutorial soon..Please Comment and Give you suggestions..and please Remember this is my first Tutorial
Reply
#2

So, I have posted my first Tutorial..Please give me more ideas to post the tutorials on..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)