open.mp forum
[Filterscript] Random Message - Printable Version

+ open.mp forum (https://forum.open.mp)
-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
--- Forum: Releases (https://forum.open.mp/forumdisplay.php?fid=13)
---- Forum: Filterscripts (https://forum.open.mp/forumdisplay.php?fid=30)
---- Thread: [Filterscript] Random Message (/showthread.php?tid=4347)



Random Message - Engkq - 2026-07-27

📌 Description
This lightweight filterscript automatically broadcasts random informational messages, server rules, and announcements to all connected players at a set interval. It helps keep your community informed without manual admin work.



⚙️ Features
  • Sends random messages to all online players periodically.
  • Easily customizable interval and message list.
  • Built with y_hooks (YSI) for maximum performance.
  • Only shows messages to logged-in players.
  • Includes credits for the author, Engkq.



📥 Installation
  1. Add the source code below to your filterscript or create a new .inc file.
  2. Add randommessage to your filterscripts line in server.cfg.
  3. Compile and restart your server.



⚙️ Configuration
You can adjust two things easily :
  • #define RANDOM_MESSAGE_INTERVAL 180000 → Change the delay (in milliseconds). Example: 60000 = 1 minute.
  • static const RandomMessages[][] = { ... }; → Add or remove any messages you like.



📝 Source Code
Copy the code below :

#include <YSI_Coding\y_hooks>

#define RANDOM_MESSAGE_INTERVAL  180000

static const RandomMessages[][] = {
    "Join our official Discord server for the latest news and community events!",
    "Connect with other players on Discord and share your experiences!",
    "Check out our Discord for giveaways, announcements, and support.",
    "This random message system is maintained by Engkq. For support, contact them!",
    "Link : https://dsc.gg/chroniclesroleplay | Created by Engkq. All rights reserved.",
    "Please follow the server rules to ensure a fair and enjoyable experience for everyone.",
    "Use /report to alert staff about any rule-breakers or bugs you encounter.",
    "Respect all players and staff members. Toxicity will not be tolerated.",
    "Keep your account safe! Never share your password with anyone, including staff.",
    "Remember to create your Chronicle Identity on Discord to link your character!",
    "Need help? Type /help to see a full list of available commands.",
    "Use /starterpack to claim your beginner's package when you first join.",
    "Contact staff in-game or on Discord if you have any questions or issues.",
    "Explore San Andreas! Discover hidden spots and unique locations.",
    "Participate in weekly events for a chance to win exclusive rewards!",
    "Stay updated on new features and updates that enhance your gameplay.",
    "Team up with other players and make new friends in the community!",
    "Save your money! You can deposit your cash at any bank to keep it safe.",
    "Find a job to start earning money and build your character's story.",
    "Join a faction to experience the full depth of roleplay on the server."
};

forward SendRandomMessage();
public SendRandomMessage()
{
    new rand = random(sizeof(RandomMessages));

    new str[256];
    format(str, sizeof(str), "(Info) {ffffff}: %s", RandomMessages[rand]);

    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && pDataEngkq[i][isLogin])
        {
            SendClientMessage(i, 0x008FFDFF, str);
        }
    }
    return 1;
}

hook OnGameModeInit()
{
    SetTimer("SendRandomMessage", RANDOM_MESSAGE_INTERVAL, true);
    return 1;
}



⚠️ Note
This script uses pDataEngkq[i][isLogin] to check login status. If your gamemode uses a different variable, simply replace it to match your system.



🙏 Credits
  • Author: Engkq
  • Server: Chronicles Roleplay
  • Copyright © 2026 Chronicles Roleplay. All rights reserved.



Enjoy! Feel free to reply if you have any questions.