SendClientMessage Server wide
#1

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

Simple let I am kinda new to this.

Help please.
Reply
#2

SendClientMessageToAll?
Reply
#3

Announcement messages?
Reply
#4

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.
Reply
#5

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..."
};
Reply
#6

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;
}
Reply
#7

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;
}
Reply
#8

Thank you all so much for you help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)