10.09.2011, 04:28
How do I make a simple SendClientMessage server wide on a time loop?
Simple let I am kinda new to this.
Help please.
Simple let I am kinda new to this.
Help please.
// ongamemodeinit
SetTimer("SendMSG",60000); // set for every 1 minute
// bottom of script
public SendMSG() // will send all messages from the RandomMSG array we created below every 1 minute
{
new randMSG = random(sizeof(RandomMSG)); //calculates the size of RandomMSG
SendClientMessageToAll(0x33CCFFAA, RandomMSG[randMSG]); // Replace the "color" with your defined color.
return 1;
}
// top of script
new RandomMSG[][] =
{
"message 1 here",
"message 2 here",
"message 3 here",
"etc..."
};
#include <a_samp>
//On top of script:
new AnnouncementMessages[][] =
{
{"** Use /report if you notice rulebreakers!"},
{"** Please respect other players!"},
{"** Do not use hacks, cheats or any kind of unfair advantages!"},
{"** Use /help /cmds if you are new!!"},
{"** I'm tired of writing more messages :P"}
};
public OnFilterScriptInit() //Or OnGameModeInit depending on your script.
{
SetTimer("Announce", 1000 * 60 * 2, true); // 2 minutes
return true;
}
forward Announce();
public Announce()
{
SendClientMessageToAll(0x00FFFFFF, AnnouncementMessages[random(sizeof AnnouncementMessages)]);
return true;
}
public OnFilterScriptInit() //Or OnGameModeInit depending on your script.
{
SetTimer("Announce", 1000 * 60 * 2, true); // 2 minutes
return true;
}
forward Announce();
public Announce()
{
switch(random(4))
{
case 0: SendClientMessageToAll(0x00FFFFFF,"** Use /report if you notice rulebreakers!");
case 1: SendClientMessageToAll(0x00FFFFFF,"** Do not use hacks, cheats or any kind of unfair advantages!");
case 2: SendClientMessageToAll(0x00FFFFFF,"** Use /help /cmds if you are new!!");
case 3: SendClientMessageToAll(0x00FFFFFF,"** I'm tired of writing more messages :P");
}
return 1;
}