19.06.2014, 06:51
pawn Код:
#define MSG_TIME 120
//This will define the number of seconds between each message. This one is 120 second (2 minute) intervals.
new RandMessages[][128] =
{
"This is my first random message.",
"This is my second random message that will be used to tell them something funny.",
"I'm kind of running out of stuff to write about, but this is my third message to send.",
"Oh why not, let's add a fourth message."
};
//NOTE: You must put a ',' after every message, except for the last one.
public OnGameModeInit() //Called when the gamemode script is loaded
{
SetTimer("SendRandomMessage", MSG_TIME * 1000, true); //Sets a timer for the time defined in 'MSG_TIME' and repeats.
//Rest of your code..
return 1;
}
forward SendRandomMessage(); //This should be the same name as the timer in OnGameModeInit.
public SendRandomMessage()
{
SendClientMessageToAll(0xFF0000FF, RandMessages[random(sizeof(RandMessages))]);
//Send the random message to everyone. '0xFF0000FF' is RED.
return 1;
}