SA-MP Forums Archive
SendClientMessage Server wide - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: SendClientMessage Server wide (/showthread.php?tid=282224)



SendClientMessage Server wide - BrokinJesus - 10.09.2011

How do I make a simple SendClientMessage server wide on a time loop?

Simple let I am kinda new to this.

Help please.


Re: SendClientMessage Server wide - Lorenc_ - 10.09.2011

SendClientMessageToAll?


Re: SendClientMessage Server wide - iPLEOMAX - 10.09.2011

Announcement messages?


Re: SendClientMessage Server wide - BrokinJesus - 10.09.2011

Quote:
Originally Posted by iPLEOMAX
View Post
Announcement messages?
Exactly. That show to the entire server every few minutes.

Ex:
"/report is your best friend...use it!"

But have that pop up on everyones screen every few minutes.


Re: SendClientMessage Server wide - grand.Theft.Otto - 10.09.2011

pawn Code:
// 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..."
};



Re: SendClientMessage Server wide - iPLEOMAX - 10.09.2011

Untested: :P

pawn Code:
#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;
}



Re: SendClientMessage Server wide - =WoR=Varth - 10.09.2011

Saving memory:
pawn Code:
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;
}



Re: SendClientMessage Server wide - BrokinJesus - 10.09.2011

Thank you all so much for you help.