{"id":1474,"date":"2025-07-20T23:52:16","date_gmt":"2025-07-20T22:52:16","guid":{"rendered":"https:\/\/grimms3dworlds.ddns.net\/?page_id=1474"},"modified":"2025-07-25T20:47:32","modified_gmt":"2025-07-25T19:47:32","slug":"cod1-server-messaging-script","status":"publish","type":"page","link":"https:\/\/grimms3dworlds.ddns.net\/index.php\/cod1-server-messaging-script\/","title":{"rendered":"CoD1 Server Messaging script"},"content":{"rendered":"\n<div style=\"font-family: 'Segoe UI', Arial, sans-serif; max-width: 900px; margin: 0 auto; padding: 20px; background: #ffffff; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.1);\">\n\n    <script>\n    function copyCode(button) {\n        const pre = button.previousElementSibling;\n        const code = pre.querySelector('code');\n        const text = code.innerText;\n        navigator.clipboard.writeText(text).then(() => {\n            button.textContent = 'Copied!';\n            button.style.background = '#28a745';\n            setTimeout(() => {\n                button.textContent = 'Copy';\n                button.style.background = '#007bff';\n            }, 2000);\n        }).catch(err => {\n            console.error('Failed to copy: ', err);\n        });\n    }\n    <\/script>\n\n    <h1 style=\"color: #1a3c5e; margin-bottom: 15px; border-bottom: 2px solid #e0e6ed; padding-bottom: 8px;\">Call of Duty 1 Message System Mod<\/h1>\n\n    <h2 style=\"color: #1a3c5e; margin-bottom: 15px; border-bottom: 2px solid #e0e6ed; padding-bottom: 8px;\">Overview<\/h2>\n    <p style=\"color: #4a4a4a; line-height: 1.6;\">The Call of Duty 1 Message System Mod is a server-side script for Call of Duty 1 (CoD1) that displays customizable messages to all players in multiplayer games. Messages are controlled via server cvars, allowing admins to configure content, timing, display style, and behavior without modifying scripts. The system supports sequential or random message order, configurable display types (chat area or bold\/centered), message repetition for visibility, and debug logging for troubleshooting.<\/p>\n    <p style=\"color: #4a4a4a; line-height: 1.6;\">This mod integrates with gametype scripts (dm.gsc, tdm.gsc, sd.gsc, re.gsc, bel.gsc, hq.gsc) to work across all CoD1 multiplayer gametypes. It is lightweight, robust, and optimized for CoD1\u2019s scripting limitations.<\/p>\n\n    <h2 style=\"color: #1a3c5e; margin-bottom: 15px; border-bottom: 2px solid #e0e6ed; padding-bottom: 8px;\">Features<\/h2>\n    <ul style=\"color: #4a4a4a; padding-left: 20px;\">\n        <li style=\"margin-bottom: 8px;\">Customizable Messages: Define messages via cvars (svr_message1, svr_message2, etc.).<\/li>\n        <li style=\"margin-bottom: 8px;\">Enable\/Disable: Toggle the system with svr_messages_init (0 = off, 1 = on).<\/li>\n        <li style=\"margin-bottom: 8px;\">Message Count: Set the number of messages with svr_messages_count (up to 50).<\/li>\n        <li style=\"margin-bottom: 8px;\">Prefix Support: Add a prefix (e.g., [Admin]) with svr_message_prefix.<\/li>\n        <li style=\"margin-bottom: 8px;\">Timing Control: Configure intervals between messages (svr_message_interval) and delays between loops (svr_message_delay).<\/li>\n        <li style=\"margin-bottom: 8px;\">Random Order: Enable random message display with svr_messages_random.<\/li>\n        <li style=\"margin-bottom: 8px;\">Display Options: Choose between chat area (iprintln) or bold\/centered (iprintlnbold) with svr_message_display.<\/li>\n        <li style=\"margin-bottom: 8px;\">Message Repetition: Repeat messages for visibility with svr_message_repeat.<\/li>\n        <li style=\"margin-bottom: 8px;\">Debug Logging: Toggle debug logs with svr_messages_debug to monitor script behavior.<\/li>\n        <li style=\"margin-bottom: 8px;\">Dynamic Updates: Change cvars via RCON for real-time configuration without server restarts.<\/li>\n        <li style=\"margin-bottom: 8px;\">Error Handling: Validates cvar values to prevent crashes and logs issues when debug is enabled.<\/li>\n    <\/ul>\n\n    <h2 style=\"color: #1a3c5e; margin-bottom: 15px; border-bottom: 2px solid #e0e6ed; padding-bottom: 8px;\">Requirements<\/h2>\n    <ul style=\"color: #4a4a4a; padding-left: 20px;\">\n        <li style=\"margin-bottom: 8px;\">Game: Call of Duty 1 (vanilla or modded server).<\/li>\n        <li style=\"margin-bottom: 8px;\">Server Access: Ability to modify server files and configuration (server.cfg).<\/li>\n        <li style=\"margin-bottom: 8px;\">File Structure: A .pk3 file to package the scripts.<\/li>\n        <li style=\"margin-bottom: 8px;\">Gametype Scripts: Integration with gametype scripts (e.g., dm.gsc, tdm.gsc) or a mod\u2019s custom gametype scripts.<\/li>\n    <\/ul>\n\n    <h2 style=\"color: #1a3c5e; margin-bottom: 15px; border-bottom: 2px solid #e0e6ed; padding-bottom: 8px;\">Installation<\/h2>\n    <p style=\"background: #e7f3fe; border: 1px solid #b6d4fe; padding: 15px; color: #0c5460; border-radius: 5px; margin-bottom: 20px;\">\n        <strong>Note:<\/strong> Ensure all gametype scripts (e.g., dm.gsc, tdm.gsc) include the message system initialization to avoid compatibility issues, especially when combining with other mods.\n    <\/p>\n    <ol style=\"color: #4a4a4a; padding-left: 20px;\">\n        <li style=\"margin-bottom: 8px;\"><strong>Create the Mod Structure:<\/strong>\n            <ul style=\"color: #4a4a4a; padding-left: 20px;\">\n                <li style=\"margin-bottom: 8px;\">Create a folder structure for the .pk3 file:\n                    <ul style=\"color: #4a4a4a; padding-left: 20px;\">\n                        <li style=\"margin-bottom: 8px;\">zzz_mymod.pk3<\/li>\n                        <li style=\"margin-bottom: 8px;\">maps<\/li>\n                        <li style=\"margin-bottom: 8px;\">mp<\/li>\n                        <li style=\"margin-bottom: 8px;\">gametypes<\/li>\n                        <li style=\"margin-bottom: 8px;\">_message_system.gsc<\/li>\n                        <li style=\"margin-bottom: 8px;\">dm.gsc (and other gametype scripts as needed)<\/li>\n                    <\/ul>\n                <\/li>\n                <li style=\"margin-bottom: 8px;\">Note: If combining with another mod, merge the message system initialization into the mod\u2019s gametype scripts.<\/li>\n            <\/ul>\n        <\/li>\n        <li style=\"margin-bottom: 8px;\"><strong>Add Scripts:<\/strong>\n            <ul style=\"color: #4a4a4a; padding-left: 20px;\">\n                <li style=\"margin-bottom: 8px;\">Place _message_system.gsc in maps\/mp\/gametypes\/.<\/li>\n                <li style=\"margin-bottom: 8px;\">Modify gametype scripts (e.g., dm.gsc, tdm.gsc) to include the message system initialization.<\/li>\n                <li style=\"margin-bottom: 8px;\">Example for dm.gsc:\n                    <ul style=\"color: #4a4a4a; padding-left: 20px;\">\n                        <li style=\"margin-bottom: 8px;\">Add the line: thread maps\\mp\\gametypes\\_message_system::init();<\/li>\n                        <li style=\"margin-bottom: 8px;\">Place this in the main() function of each gametype script.<\/li>\n                    <\/ul>\n                <\/li>\n                <li style=\"margin-bottom: 8px;\">If using another mod, merge the initialization call into the mod\u2019s gametype scripts (e.g., combine with existing main() functions).<\/li>\n            <\/ul>\n        <\/li>\n        <li style=\"margin-bottom: 8px;\"><strong>_message_system.gsc:<\/strong>\n            <ul style=\"color: #4a4a4a; padding-left: 20px;\">\n                <li style=\"margin-bottom: 8px;\">Copy the following code to a text file and call it _message_system.gsc <\/li>\n                <div style=\"position: relative; margin-bottom: 20px;\">\n                    <pre style=\"background: #1e1e1e; color: #ffffff; padding: 15px; border-radius: 5px; font-size: 14px; line-height: 1.4; max-height: 400px; overflow-y: auto; overflow-x: auto;\"><code>\n\/\/ Grimms message script for Call of Duty 1\n\/\/ Modified to ensure the script runs only once and fix syntax error\n\n\/\/ cvars for config file\n\/* \nset sv_gametype \"dm\"             \/\/ Ensure valid gametype\nset svr_messages_init 1          \/\/ Enable the message system\nset svr_messages_count 3         \/\/ Number of messages\nset svr_message_prefix \"[Admin]\"  \/\/ Message prefix\nset svr_message_interval 5       \/\/ 5 seconds between messages\nset svr_message_delay 15         \/\/ 15 seconds between loops\nset svr_messages_random 0        \/\/ Random message order\nset svr_message_display 0        \/\/ Use iprintlnbold (1) or iprintln (0) be aware iprintlnbold would be annoying\nset svr_message_repeat 0         \/\/ Repeat each message to keep messages on screen longer (rec values 0 1 2)\nset svr_messages_debug 0         \/\/ Disable debug logs requires developer\nset svr_message1 \"Welcome to the server!\"\nset svr_message2 \"Follow the rules and have fun!\"\nset svr_message3 \"Visit our website at example.com!\"\n *\/\n\ninit()\n{\n    \/\/ Check if the script has already been initialized\n    if (isDefined(level.messageSystemInitialized) && level.messageSystemInitialized)\n    {\n        if (getCvarInt(\"svr_messages_debug\") == 1)\n            print(\"Message system: Already initialized, skipping.\\n\");\n        return;\n    }\n\n    \/\/ Set the flag to indicate the script is initialized\n    level.messageSystemInitialized = true;\n\n    \/\/ Initialize cvars with default values if not set\n    if (!isDefined(getCvar(\"svr_messages_init\")))\n        setCvar(\"svr_messages_init\", \"0\"); \/\/ Disabled by default\n    if (!isDefined(getCvar(\"svr_messages_count\")))\n        setCvar(\"svr_messages_count\", \"0\"); \/\/ No messages by default\n    if (!isDefined(getCvar(\"svr_message_prefix\")))\n        setCvar(\"svr_message_prefix\", \"\"); \/\/ Empty prefix by default\n    if (!isDefined(getCvar(\"svr_message_interval\")))\n        setCvar(\"svr_message_interval\", \"10\"); \/\/ 10 seconds between messages\n    if (!isDefined(getCvar(\"svr_message_delay\")))\n        setCvar(\"svr_message_delay\", \"30\"); \/\/ 30 seconds between loops\n    if (!isDefined(getCvar(\"svr_messages_random\")))\n        setCvar(\"svr_messages_random\", \"0\"); \/\/ Sequential order by default\n    if (!isDefined(getCvar(\"svr_message_display\")))\n        setCvar(\"svr_message_display\", \"0\"); \/\/ 0 for iprintln, 1 for iprintlnbold\n    if (!isDefined(getCvar(\"svr_message_repeat\")))\n        setCvar(\"svr_message_repeat\", \"1\"); \/\/ Repeat each message once\n    if (!isDefined(getCvar(\"svr_messages_debug\")))\n        setCvar(\"svr_messages_debug\", \"1\"); \/\/ Debug enabled by default\n\n    \/\/ Debug log\n    if (getCvarInt(\"svr_messages_debug\") == 1)\n        print(\"Message system: Initializing...\\n\");\n\n    \/\/ Check if message system is enabled\n    if (getCvarInt(\"svr_messages_init\") == 1)\n    {\n        if (getCvarInt(\"svr_messages_debug\") == 1)\n            print(\"Message system: Starting message loop\\n\");\n        thread messageLoop();\n    }\n}\n\nmessageLoop()\n{\n    \/\/ Cap maximum messages to prevent performance issues\n    maxMessages = 50;\n\n    while (getCvarInt(\"svr_messages_init\") == 1)\n    {\n        \/\/ Get cvars each loop to allow dynamic updates\n        messageCount = getCvarInt(\"svr_messages_count\");\n        prefix = getCvar(\"svr_message_prefix\");\n        interval = getCvarFloat(\"svr_message_interval\");\n        delay = getCvarFloat(\"svr_message_delay\");\n        randomOrder = getCvarInt(\"svr_messages_random\");\n        displayType = getCvarInt(\"svr_message_display\");\n        repeatCount = getCvarInt(\"svr_message_repeat\");\n        debug = getCvarInt(\"svr_messages_debug\");\n\n        \/\/ Validate message count\n        if (messageCount <= 0 || messageCount > maxMessages)\n        {\n            if (debug == 1)\n                print(\"Message system: svr_messages_count is invalid (\" + messageCount + \"). Must be 1 to \" + maxMessages + \". Stopping.\\n\");\n            return;\n        }\n\n        \/\/ Validate timing values\n        if (interval < 1)\n        {\n            if (debug == 1)\n                print(\"Message system: svr_message_interval is too low (< 1). Setting to 1 second.\\n\");\n            interval = 1;\n        }\n        if (delay < 0)\n        {\n            if (debug == 1)\n                print(\"Message system: svr_message_delay is negative. Setting to 0 seconds.\\n\");\n            delay = 0;\n        }\n        if (repeatCount < 1)\n        {\n            if (debug == 1)\n                print(\"Message system: svr_message_repeat is too low (< 1). Setting to 1.\\n\");\n            repeatCount = 1;\n        }\n\n        \/\/ Create message index array for random or sequential order\n        messageIndices = [];\n        for (i = 0; i < messageCount; i++)\n            messageIndices[i] = i + 1;\n\n        \/\/ Shuffle indices if random order is enabled\n        if (randomOrder == 1)\n        {\n            for (i = 0; i < messageCount; i++)\n            {\n                j = i + randomInt(messageCount - i); \/\/ Simple shuffle\n                temp = messageIndices[i];\n                messageIndices[i] = messageIndices[j];\n                messageIndices[j] = temp;\n            }\n        }\n\n        \/\/ Cycle through messages\n        for (i = 0; i < messageCount; i++)\n        {\n            \/\/ Get message index (sequential or random)\n            index = messageIndices[i];\n            cvarName = \"svr_message\" + index;\n            message = getCvar(cvarName);\n\n            \/\/ Check if the message cvar exists and is not empty\n            if (isDefined(message) &#038;&#038; message != \"\")\n            {\n                \/\/ Combine prefix and message if prefix is defined\n                displayMessage = message; \/\/ Default to message only\n                if (isDefined(prefix) &#038;&#038; prefix != \"\")\n                {\n                    displayMessage = prefix + \" \" + message;\n                }\n\n                \/\/ Repeat message based on svr_message_repeat\n                for (j = 0; j < repeatCount; j++)\n                {\n                    if (displayType == 1)\n                        iprintlnbold(displayMessage); \/\/ Bold, centered\n                    else\n                        iprintln(displayMessage); \/\/ Chat area\n                    wait 1; \/\/ Short wait between repeats to simulate longer visibility\n                }\n            }\n            else if (debug == 1)\n            {\n                print(\"Message system: \" + cvarName + \" is undefined or empty.\\n\");\n            }\n\n            \/\/ Wait for the interval between messages\n            wait interval;\n\n            \/\/ Recheck if the system is still enabled\n            if (getCvarInt(\"svr_messages_init\") == 0)\n                return;\n        }\n\n        \/\/ Wait for the delay between loops\n        wait delay;\n    }\n}\n                    <\/code><\/pre>\n                    <button style=\"position: absolute; top: 10px; right: 10px; background: #007bff; color: #ffffff; border: none; padding: 8px 12px; border-radius: 4px; cursor: pointer; font-size: 12px;\" onclick=\"copyCode(this)\">Copy<\/button>\n                <\/div>\n            <\/ul>\n        <\/li>\n        <li style=\"margin-bottom: 8px;\"><strong>Package the Mod:<\/strong>\n            <ul style=\"color: #4a4a4a; padding-left: 20px;\">\n                <li style=\"margin-bottom: 8px;\">Zip the maps\/ folder into a .pk3 file (e.g., zzz_mymod.pk3).<\/li>\n                <li style=\"margin-bottom: 8px;\">Place the .pk3 in the main\/ directory of your CoD1 server.<\/li>\n            <\/ul>\n        <\/li>\n        <li style=\"margin-bottom: 8px;\"><strong>Configure the Server:<\/strong>\n            <ul style=\"color: #4a4a4a; padding-left: 20px;\">\n                <li style=\"margin-bottom: 8px;\">Edit server.cfg (in main\/ or your mod folder) to include the message system cvars. Example:<\/li>\n                <div style=\"position: relative; margin-bottom: 20px;\">\n                    <pre style=\"background: #1e1e1e; color: #ffffff; padding: 15px; border-radius: 5px; font-size: 14px; line-height: 1.4; max-height: 400px; overflow-y: auto; overflow-x: auto;\"><code>\nset sv_gametype \"dm\"\nset svr_messages_init 1\nset svr_messages_count 3\nset svr_message_prefix \"[Admin]\"\nset svr_message_interval 5\nset svr_message_delay 15\nset svr_messages_random 1\nset svr_message_display 1\nset svr_message_repeat 2\nset svr_messages_debug 0\nset svr_message1 \"Welcome to the server!\"\nset svr_message2 \"Follow the rules and have fun!\"\nset svr_message3 \"Visit our website at example.com!\"\n                    <\/code><\/pre>\n                    <button style=\"position: absolute; top: 10px; right: 10px; background: #007bff; color: #ffffff; border: none; padding: 8px 12px; border-radius: 4px; cursor: pointer; font-size: 12px;\" onclick=\"copyCode(this)\">Copy<\/button>\n                <\/div>\n            <\/ul>\n        <\/li>\n        <li style=\"margin-bottom: 8px;\"><strong>Start the Server:<\/strong>\n            <ul style=\"color: #4a4a4a; padding-left: 20px;\">\n                <li style=\"margin-bottom: 8px;\">Launch the CoD1 server with your modded .pk3 loaded.<\/li>\n                <li style=\"margin-bottom: 8px;\">Join as a client to verify messages display correctly.<\/li>\n            <\/ul>\n        <\/li>\n    <\/ol>\n\n    <h2 style=\"color: #1a3c5e; margin-bottom: 15px; border-bottom: 2px solid #e0e6ed; padding-bottom: 8px;\">Configuration<\/h2>\n    <p style=\"background: #e7f3fe; border: 1px solid #b6d4fe; padding: 15px; color: #0c5460; border-radius: 5px; margin-bottom: 20px;\">\n        <strong>Note:<\/strong> Modify the configuration as needed, especially sv_hostname, rconpassword (set via command line for security), and map rotation settings, in addition to the message system cvars.\n    <\/p>\n    <p style=\"color: #4a4a4a; line-height: 1.6;\">The message system is controlled via cvars in server.cfg or RCON. Below is a list of all cvars and their descriptions:<\/p>\n    <table style=\"width: 100%; border-collapse: collapse; margin-bottom: 20px;\">\n        <tr style=\"background: #f8f9fa; color: black;\">\n            <th style=\"border: 1px solid #ddd; padding: 8px; text-align: left;color: black;\">Cvar<\/th>\n            <th style=\"border: 1px solid #ddd; padding: 8px; text-align: left;color: black;\">Type<\/th>\n            <th style=\"border: 1px solid #ddd; padding: 8px; text-align: left;color: black;\">Default<\/th>\n            <th style=\"border: 1px solid #ddd; padding: 8px; text-align: left;color: black;\">Description<\/th>\n        <\/tr>\n        <tr>\n            <td style=\"border: 1px solid #ddd; padding: 8px;color: black;\">svr_messages_init<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 8px;color: black;\">Integer<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 8px;color: black;\">0<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 8px;color: black;\">Enable (1) or disable (0) the message system.<\/td>\n        <\/tr>\n        <tr>\n            <td style=\"border: 1px solid #ddd; padding: 8px;color: black;\">svr_messages_count<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 8px;color: black;\">Integer<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 8px;color: black;\">0<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 8px;color: black;\">Number of messages to display (1 to 50).<\/td>\n        <\/tr>\n        <tr>\n            <td style=\"border: 1px solid #ddd; padding: 8px;color: black;\">svr_message_prefix<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 8px;color: black;\">String<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 8px;color: black;\">\"\"<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 8px;color: black;\">Prefix for messages (e.g., [Admin]). Empty for no prefix.<\/td>\n        <\/tr>\n        <tr>\n            <td style=\"border: 1px solid #ddd; padding: 8px;color: black;\">svr_message_interval<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 8px;color: black;\">Float<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 8px;color: black;\">10<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 8px;color: black;\">Seconds between messages (minimum 1).<\/td>\n        <\/tr>\n        <tr>\n            <td style=\"border: 1px solid #ddd; padding: 8px;color: black;\">svr_message_delay<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 8px;color: black;\">Float<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 8px;color: black;\">30<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 8px;color: black;\">Seconds between message loops (minimum 0).<\/td>\n        <\/tr>\n        <tr>\n            <td style=\"border: 1px solid #ddd; padding: 8px;color: black;\">svr_messages_random<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 8px;color: black;\">Integer<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 8px;color: black;\">0<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 8px;color: black;\">Display messages in random order (1) or sequential (0).<\/td>\n        <\/tr>\n        <tr>\n            <td style=\"border: 1px solid #ddd; padding: 8px;color: black;\">svr_message_display<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 8px;color: black;\">Integer<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 8px;color: black;\">0<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 8px;color: black;\">Display type: 0 = iprintln (chat area), 1 = iprintlnbold (bold, centered).<\/td>\n        <\/tr>\n        <tr>\n            <td style=\"border: 1px solid #ddd; padding: 8px;color: black;\">svr_message_repeat<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 8px;color: black;\">Integer<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 8px;color: black;\">1<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 8px;color: black;\">Number of times to repeat each message (minimum 1).<\/td>\n        <\/tr>\n        <tr>\n            <td style=\"border: 1px solid #ddd; padding: 8px;\">svr_messages_debug<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 8px;\">Integer<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 8px;\">1<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 8px;\">Enable (1) or disable (0) debug logs in the server console.<\/td>\n        <\/tr>\n        <tr>\n            <td style=\"border: 1px solid #ddd; padding: 8px;color: black;\">svr_message1, svr_message2, etc.<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 8px;color: black;\">String<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 8px;color: black;\">\"\"<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 8px;color: black;\">Message text for each message (e.g., svr_message1 \"Hello!\").<\/td>\n        <\/tr>\n    <\/table>\n\n    <h3 style=\"color: #1a3c5e; margin-bottom: 15px; border-bottom: 1px solid #e0e6ed; padding-bottom: 8px;\">Example RCON Commands<\/h3>\n    <p style=\"color: #4a4a4a; line-height: 1.6;\">Use RCON to dynamically adjust settings without restarting the server:<\/p>\n    <ul style=\"color: #4a4a4a; padding-left: 20px;\">\n        <li style=\"margin-bottom: 8px;\">rcon set svr_messages_init 1<\/li>\n        <li style=\"margin-bottom: 8px;\">rcon set svr_message_prefix \"[Server]\"<\/li>\n        <li style=\"margin-bottom: 8px;\">rcon set svr_messages_random 1<\/li>\n        <li style=\"margin-bottom: 8px;\">rcon set svr_message_display 0<\/li>\n        <li style=\"margin-bottom: 8px;\">rcon set svr_message_repeat 3<\/li>\n        <li style=\"margin-bottom: 8px;\">rcon set svr_message1 \"New message!\"<\/li>\n        <li style=\"margin-bottom: 8px;\">rcon set svr_messages_debug 1<\/li>\n    <\/ul>\n\n    <h2 style=\"color: #1a3c5e; margin-bottom: 15px; border-bottom: 2px solid #e0e6ed; padding-bottom: 8px;\">Usage<\/h2>\n    <ul style=\"color: #4a4a4a; padding-left: 20px;\">\n        <li style=\"margin-bottom: 8px;\"><strong>Message Display:<\/strong> When svr_messages_init is 1, messages (svr_message1, svr_message2, etc.) are displayed to all players at the specified svr_message_interval. After all messages are shown, the system waits for svr_message_delay before looping.<\/li>\n        <li style=\"margin-bottom: 8px;\"><strong>Random Order:<\/strong> If svr_messages_random is 1, messages are displayed in a random order each loop.<\/li>\n        <li style=\"margin-bottom: 8px;\"><strong>Display Style:<\/strong> Messages appear in the chat area (iprintln) or centered and bold (iprintlnbold) based on svr_message_display.<\/li>\n        <li style=\"margin-bottom: 8px;\"><strong>Repetition:<\/strong> Each message is repeated svr_message_repeat times with a 1-second delay between repeats to enhance visibility.<\/li>\n        <li style=\"margin-bottom: 8px;\"><strong>Debugging:<\/strong> Set svr_messages_debug to 1 to log initialization, errors, and message status to the server console (games_mp.log).<\/li>\n    <\/ul>\n\n    <h3 style=\"color: #1a3c5e; margin-bottom: 15px; border-bottom: 1px solid #e0e6ed; padding-bottom: 8px;\">Example Output<\/h3>\n    <p style=\"color: #4a4a4a; line-height: 1.6;\">With the sample server.cfg above:<\/p>\n    <ul style=\"color: #4a4a4a; padding-left: 20px;\">\n        <li style=\"margin-bottom: 8px;\">At 0 seconds: [Admin] Welcome to the server! (repeated twice, 1-second apart)<\/li>\n        <li style=\"margin-bottom: 8px;\">At 5 seconds: [Admin] Follow the rules and have fun! (repeated twice)<\/li>\n        <li style=\"margin-bottom: 8px;\">At 10 seconds: [Admin] Visit our website at example.com! (repeated twice)<\/li>\n        <li style=\"margin-bottom: 8px;\">At 15 seconds: Wait for svr_message_delay (15 seconds)<\/li>\n        <li style=\"margin-bottom: 8px;\">At 30 seconds: Next loop starts (random order if svr_messages_random 1)<\/li>\n    <\/ul>\n\n    <h2 style=\"color: #1a3c5e; margin-bottom: 15px; border-bottom: 2px solid #e0e6ed; padding-bottom: 8px;\">Combining with Other Mods<\/h2>\n    <p style=\"background: #e7f3fe; border: 1px solid #b6d4fe; padding: 15px; color: #0c5460; border-radius: 5px; margin-bottom: 20px;\">\n        <strong>Note:<\/strong> When combining with other mods, carefully merge the message system initialization into the mod\u2019s gametype scripts to avoid conflicts, and test thoroughly to ensure compatibility.\n    <\/p>\n    <p style=\"color: #4a4a4a; line-height: 1.6;\">If using another mod that modifies gametype scripts (e.g., dm.gsc, tdm.gsc):<\/p>\n    <ul style=\"color: #4a4a4a; padding-left: 20px;\">\n        <li style=\"margin-bottom: 8px;\">Merge the message system initialization (thread maps\\mp\\gametypes\\_message_system::init();) into the mod\u2019s gametype scripts.<\/li>\n        <li style=\"margin-bottom: 8px;\">Example for a mod\u2019s dm.gsc:\n            <ul style=\"color: #4a4a4a; padding-left: 20px;\">\n                <li style=\"margin-bottom: 8px;\">Find the main() function.<\/li>\n                <li style=\"margin-bottom: 8px;\">Add: thread maps\\mp\\gametypes\\_message_system::init();<\/li>\n                <li style=\"margin-bottom: 8px;\">Ensure the path matches your .pk3 structure (e.g., use maps\\mp\\gametypes\\message_system::init(); if the file is message_system.gsc).<\/li>\n            <\/ul>\n        <\/li>\n        <li style=\"margin-bottom: 8px;\">Repackage the combined scripts into a new .pk3, including both the mod\u2019s files and _message_system.gsc.<\/li>\n        <li style=\"margin-bottom: 8px;\">Test to ensure no conflicts (e.g., duplicate initializations or cvar clashes).<\/li>\n    <\/ul>\n\n    <h2 style=\"color: #1a3c5e; margin-bottom: 15px; border-bottom: 2px solid #e0e6ed; padding-bottom: 8px;\">Troubleshooting<\/h2>\n    <p style=\"background: #e7f3fe; border: 1px solid #b6d4fe; padding: 15px; color: #0c5460; border-radius: 5px; margin-bottom: 20px;\">\n        <strong>Note:<\/strong> Debug logs require developer 1 and logfile 1 in server.cfg to appear in games_mp.log. Always enable these settings during testing to diagnose issues.\n    <\/p>\n    <ul style=\"color: #4a4a4a; padding-left: 20px;\">\n        <li style=\"margin-bottom: 8px;\"><strong>Messages Not Displaying:<\/strong>\n            <ul style=\"color: #4a4a4a; padding-left: 20px;\">\n                <li style=\"margin-bottom: 8px;\">Verify svr_messages_init is 1 and svr_messages_count is greater than 0.<\/li>\n                <li style=\"margin-bottom: 8px;\">Check that svr_message1, svr_message2, etc., are set in server.cfg or via RCON.<\/li>\n                <li style=\"margin-bottom: 8px;\">Ensure the message system is initialized in all relevant gametype scripts (e.g., dm.gsc).<\/li>\n                <li style=\"margin-bottom: 8px;\">Enable svr_messages_debug 1 and check games_mp.log for errors.<\/li>\n            <\/ul>\n        <\/li>\n        <li style=\"margin-bottom: 8px;\"><strong>Debug Messages Not Showing:<\/strong>\n            <ul style=\"color: #4a4a4a; padding-left: 20px;\">\n                <li style=\"margin-bottom: 8px;\">CoD1\u2019s print function requires developer mode. Add to server.cfg:<\/li>\n                <div style=\"position: relative; margin-bottom: 20px;\">\n                    <pre style=\"background: #1e1e1e; color: #ffffff; padding: 15px; border-radius: 5px; font-size: 14px; line-height: 1.4; max-height: 400px; overflow-y: auto; overflow-x: auto;\"><code>\nset developer 1\nset logfile 1\n                    <\/code><\/pre>\n                    <button style=\"position: absolute; top: 10px; right: 10px; background: #007bff; color: #ffffff; border: none; padding: 8px 12px; border-radius: 4px; cursor: pointer; font-size: 12px;\" onclick=\"copyCode(this)\">Copy<\/button>\n                <\/div>\n                <li style=\"margin-bottom: 8px;\">Check games_mp.log in the main\/ or mod folder for logs.<\/li>\n                <li style=\"margin-bottom: 8px;\">Ensure svr_messages_debug is 1.<\/li>\n                <li style=\"margin-bottom: 8px;\">If using a modded server (e.g., CoD4x), verify console output settings.<\/li>\n            <\/ul>\n        <\/li>\n        <li style=\"margin-bottom: 8px;\"><strong>Gametype Error (e.g., couldn\u2019t load GameType description file):<\/strong>\n            <ul style=\"color: #4a4a4a; padding-left: 20px;\">\n                <li style=\"margin-bottom: 8px;\">Ensure sv_gametype is set to a valid gametype (dm, tdm, sd, re, bel, hq) in server.cfg.<\/li>\n                <li style=\"margin-bottom: 8px;\">Check for typos in scripts or configs (e.g., message_systemt or maps\/,p\/gametypes).<\/li>\n                <li style=\"margin-bottom: 8px;\">Verify .pk3 structure: maps\/mp\/gametypes\/_message_system.gsc.<\/li>\n            <\/ul>\n        <\/li>\n        <li style=\"margin-bottom: 8px;\"><strong>Performance Issues:<\/strong>\n            <ul style=\"color: #4a4a4a; padding-left: 20px;\">\n                <li style=\"margin-bottom: 8px;\">Keep svr_messages_count below 50 and svr_message_interval above 1 second.<\/li>\n                <li style=\"margin-bottom: 8px;\">Avoid excessive svr_message_repeat values (e.g., >5).<\/li>\n            <\/ul>\n        <\/li>\n        <li style=\"margin-bottom: 8px;\"><strong>Mod Conflicts:<\/strong>\n            <ul style=\"color: #4a4a4a; padding-left: 20px;\">\n                <li style=\"margin-bottom: 8px;\">If combining with another mod, ensure the message system initialization is added to the mod\u2019s gametype scripts.<\/li>\n                <li style=\"margin-bottom: 8px;\">Check for conflicting cvars or script calls in the mod\u2019s .pk3.<\/li>\n            <\/ul>\n        <\/li>\n    <\/ul>\n\n    <h2 style=\"color: #1a3c5e; margin-bottom: 15px; border-bottom: 2px solid #e0e6ed; padding-bottom: 8px;\">Limitations<\/h2>\n    <ul style=\"color: #4a4a4a; padding-left: 20px;\">\n        <li style=\"margin-bottom: 8px;\"><strong>CoD1 Scripting Constraints:<\/strong>\n            <ul style=\"color: #4a4a4a; padding-left: 20px;\">\n                <li style=\"margin-bottom: 8px;\">No support for custom HUD elements.<\/li>\n                <li style=\"margin-bottom: 8px;\">String length is limited (~1024 characters), so keep messages and prefixes short.<\/li>\n                <li style=\"margin-bottom: 8px;\">Minimum wait time is 0.05 seconds; svr_message_interval is capped at 1 second for readability.<\/li>\n            <\/ul>\n        <\/li>\n        <li style=\"margin-bottom: 8px;\"><strong>Randomization:<\/strong> Uses a simple shuffle algorithm due to CoD1\u2019s limited randomInt function.<\/li>\n        <li style=\"margin-bottom: 8px;\"><strong>Message Visibility:<\/strong> iprintln and iprintlnbold messages fade after a fixed time (not configurable in CoD1). Use svr_message_repeat to simulate longer visibility.<\/li>\n        <li style=\"margin-bottom: 8px;\"><strong>Debug Logging:<\/strong> Requires developer 1 and logfile 1 in server.cfg to ensure logs appear in games_mp.log.<\/li>\n    <\/ul>\n\n    \n\n    <h2 style=\"color: #1a3c5e; margin-bottom: 15px; border-bottom: 2px solid #e0e6ed; padding-bottom: 8px;\">License<\/h2>\n    <p style=\"color: #4a4a4a; line-height: 1.6;\">This mod is provided as-is for use in Call of Duty 1 servers. Feel free to modify and distribute, but please credit the original author (Grimm) for the message system script.<\/p>\n\n    <h2 style=\"color: #1a3c5e; margin-bottom: 15px; border-bottom: 2px solid #e0e6ed; padding-bottom: 8px;\">Credits<\/h2>\n    <ul style=\"color: #4a4a4a; padding-left: 20px;\">\n        <li style=\"margin-bottom: 8px;\"><strong>Author:<\/strong> Grimm<\/li>\n        <li style=\"margin-bottom: 8px;\"><strong>Purpose:<\/strong> Created to enhance CoD1 multiplayer servers with a flexible message system.<\/li>\n        <li style=\"margin-bottom: 8px;\"><strong>Version:<\/strong> 1.0 (as of July 20, 2025)<\/li>\n    <\/ul>\n\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>function copyCode(button) { const pre = button.previousElementSibling; const code = pre.querySelector(&#8216;code&#8217;); const text = code.innerText; navigator.clipboard.writeText(text).then(() => { button.textContent = &#8216;Copied!&#8217;; button.style.background = &#8216;#28a745&#8217;; setTimeout(() => { button.textContent = &#8216;Copy&#8217;; button.style.background = &#8216;#007bff&#8217;; }, 2000); }).catch(err => { console.error(&#8216;Failed to copy: &#8216;, err); }); } Call of Duty 1 Message System Mod Overview The Call [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1474","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/grimms3dworlds.ddns.net\/index.php\/wp-json\/wp\/v2\/pages\/1474","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/grimms3dworlds.ddns.net\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/grimms3dworlds.ddns.net\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/grimms3dworlds.ddns.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/grimms3dworlds.ddns.net\/index.php\/wp-json\/wp\/v2\/comments?post=1474"}],"version-history":[{"count":8,"href":"https:\/\/grimms3dworlds.ddns.net\/index.php\/wp-json\/wp\/v2\/pages\/1474\/revisions"}],"predecessor-version":[{"id":1489,"href":"https:\/\/grimms3dworlds.ddns.net\/index.php\/wp-json\/wp\/v2\/pages\/1474\/revisions\/1489"}],"wp:attachment":[{"href":"https:\/\/grimms3dworlds.ddns.net\/index.php\/wp-json\/wp\/v2\/media?parent=1474"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}