17.08.2015, 19:37
So lets start
Creating Arry for random message and adding messages
Creating Timer
forwarding the Random message
Creating Arry for random message and adding messages
pawn Код:
//on top of script
#define COLOR_GREEN (0x32CD32FF) // Green color used for Random messages
new randomMessages[][] = //here, we're creating the array with the name "randomMessages"
{
"MESSAGE 1 ", //this is the text of your first message ------Change the MESSAGE 1 to your own message
"MESSAGE 2", //this is the text of your second message -------- Change MESSAGE 2 to your own message
"MESSAGE 3" //this is the text of your third message ---------- Change MESSAGE 3 to your own message
};
pawn Код:
OnGameModeInit()
{
SetTimer("RandomMessages", 1000*6, true); //here, you're defining a timer with the name "RandomMessages"
return 1;
pawn Код:
forward RandomMessages();
public RandomMessages()
{
new randomMsg = random(sizeof(randomMessages)); //create a variable "randomMsg" and give it the value of our array we've created ("randomMessages")
//the word "random" is included into PAWN, which will tell the script, to work randomly with the array
SendClientMessageToAll(COLOR_GREEN, randomMessages[randomMsg]); //this will send the content of our array to EVERYBODY on the server
// the content are strings, and we're using our array "randomMessages" with our created variable "randomMsg" again
}