28.08.2016, 06:38
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...." }; |
Quote:
SetTimer("sMSG", 45000, true); |
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() { } |
Quote:
new sRMessage = random(sizeof(sRMSG));//This is the First Command SendClientMessageToAll(-1, sRMSG[sRMessage]); // This is the Second Command |
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]); } |