Promover servidor

Initial release 1.0.0

Browse Source
1.0.0 — Initial release.
 * Config-driven advert rotation (csb_adverts.ini)
 * Configurable interval and prefix
 * Skips broadcasting on empty servers
Daemon666 committed commit 3bc925514627dbe03dfdd12c3a95eae88a745343
14 changed files with 222 additions and 0 deletions
+6 -0 CHANGELOG.md A
@@ -0,0 +1,6 @@
1 +## 1.0.0 (2025-05-20)
2 +
3 +1.0.0 — Initial release.
4 + * Config-driven advert rotation (csb_adverts.ini)
5 + * Configurable interval and prefix
6 + * Skips broadcasting on empty servers
+1 -0 README.md A
@@ -0,0 +1 @@
1 +<p><strong>CSB Server Adverts</strong> rotates a list of messages into your server chat on a timer. Use it to announce your website, Discord, rules, or VIP perks without nagging players every round.</p><h2>Features</h2><ul><li>Unlimited messages from a simple <code>csb_adverts.ini</code> config (up to 32 loaded).</li><li>Configurable interval and prefix via CVARs.</li><li>Colour codes supported (<code>^x04</code> green, <code>^x03</code> team, <code>^x01</code> default).</li><li>Skips broadcasting when the server is empty — no wasted messages.</li><li><code>say /adverts</code> lists the loaded adverts for admins.</li></ul><h2>Installation</h2><ol><li>Compile the plugin (or grab the ready <code>.amxx</code> above).</li><li>Drop <code>adverts.amxx</code> into <code>addons/amxmodx/plugins/</code>.</li><li>Add <code>adverts.amxx</code> to <code>addons/amxmodx/configs/plugins.ini</code>.</li><li>Create <code>addons/amxmodx/configs/csb_adverts.ini</code> with one message per line.</li><li>Change the map or restart the server.</li></ol>
+8 -0 addons/amxmodx/configs/csb_adverts.ini A
@@ -0,0 +1,8 @@
1 +; CSB Server Adverts — one message per line.
2 +; Colour codes: ^x04 = green, ^x03 = team colour, ^x01 = normal.
3 +; Lines starting with ';' or '//' are ignored.
4 +
5 +Welcome to our server! Visit counter-strike-boost.com for more CS 1.6 servers.
6 +Type ^x04/rules^x01 to read the server rules.
7 +Want VIP? Ask an admin or check our website.
8 +Join our Discord to report cheaters and suggest maps.
+115 -0 addons/amxmodx/scripting/adverts.sma A
@@ -0,0 +1,115 @@
1 +/* CSB Server Adverts — rotating chat/HUD announcements for CS 1.6.
2 + *
3 + * Copyright (C) 2026 counter-strike-boost.com
4 + * Based on the classic AMX Mod X adverts pattern (GPL).
5 + *
6 + * This program is free software; you can redistribute it and/or modify it
7 + * under the terms of the GNU General Public License as published by the
8 + * Free Software Foundation; either version 3 of the License, or (at your
9 + * option) any later version.
10 + */
11 +
12 +#include <amxmodx>
13 +#include <amxmisc>
14 +
15 +#define PLUGIN "CSB Server Adverts"
16 +#define VERSION "1.0.0"
17 +#define AUTHOR "daemon666"
18 +
19 +#define MAX_ADVERTS 32
20 +#define MAX_ADVERT_LEN 192
21 +
22 +new g_Adverts[MAX_ADVERTS][MAX_ADVERT_LEN]
23 +new g_AdvertCount
24 +new g_Current
25 +
26 +new g_pInterval
27 +new g_pEnabled
28 +new g_pPrefix
29 +
30 +public plugin_init()
31 +{
32 + register_plugin(PLUGIN, VERSION, AUTHOR)
33 +
34 + g_pEnabled = register_cvar("csb_adverts_enabled", "1")
35 + g_pInterval = register_cvar("csb_adverts_interval", "90.0")
36 + g_pPrefix = register_cvar("csb_adverts_prefix", "[INFO]")
37 +
38 + register_clcmd("say /adverts", "cmd_list_adverts", ADMIN_CFG)
39 +
40 + load_adverts()
41 +
42 + new Float:interval = get_pcvar_float(g_pInterval)
43 + if (interval < 10.0)
44 + interval = 10.0
45 +
46 + set_task(interval, "task_advert", 0, "", 0, "b")
47 +}
48 +
49 +/* Reads addons/amxmodx/configs/csb_adverts.ini — one message per line,
50 + * ';' and '//' start a comment. Colour codes: !g green, !t team, !y yellow. */
51 +load_adverts()
52 +{
53 + new path[128]
54 + get_configsdir(path, charsmax(path))
55 + format(path, charsmax(path), "%s/csb_adverts.ini", path)
56 +
57 + g_AdvertCount = 0
58 +
59 + new file = fopen(path, "rt")
60 + if (!file)
61 + {
62 + log_amx("[CSB Adverts] Config not found: %s — no adverts loaded.", path)
63 + return
64 + }
65 +
66 + new line[MAX_ADVERT_LEN]
67 +
68 + while (!feof(file) && g_AdvertCount < MAX_ADVERTS)
69 + {
70 + fgets(file, line, charsmax(line))
71 + trim(line)
72 +
73 + if (!line[0] || line[0] == ';' || (line[0] == '/' && line[1] == '/'))
74 + continue
75 +
76 + copy(g_Adverts[g_AdvertCount], charsmax(g_Adverts[]), line)
77 + g_AdvertCount++
78 + }
79 +
80 + fclose(file)
81 +
82 + log_amx("[CSB Adverts] Loaded %d advert(s).", g_AdvertCount)
83 +}
84 +
85 +public task_advert()
86 +{
87 + if (!get_pcvar_num(g_pEnabled) || !g_AdvertCount)
88 + return
89 +
90 + if (!get_playersnum())
91 + return
92 +
93 + new prefix[32]
94 + get_pcvar_string(g_pPrefix, prefix, charsmax(prefix))
95 +
96 + new msg[MAX_ADVERT_LEN + 40]
97 + formatex(msg, charsmax(msg), "^x04%s^x01 %s", prefix, g_Adverts[g_Current])
98 +
99 + client_print_color(0, print_team_default, msg)
100 +
101 + g_Current = (g_Current + 1) % g_AdvertCount
102 +}
103 +
104 +public cmd_list_adverts(id, level, cid)
105 +{
106 + if (!cmd_access(id, level, cid, 1))
107 + return PLUGIN_HANDLED
108 +
109 + console_print(id, "[CSB Adverts] %d advert(s) loaded:", g_AdvertCount)
110 +
111 + for (new i = 0; i < g_AdvertCount; i++)
112 + console_print(id, " %d. %s", i + 1, g_Adverts[i])
113 +
114 + return PLUGIN_HANDLED
115 +}
+47 -0 csb.json A
@@ -0,0 +1,47 @@
1 +{
2 + "name": "CSB Server Adverts",
3 + "category": "hud-info",
4 + "tags": "adverts, announcements, chat, amxmodx, hud",
5 + "image": "",
6 + "original_author": "counter-strike-boost.com",
7 + "original_url": "",
8 + "license": "GPL-3.0",
9 + "title": "CSB Server Adverts",
10 + "short_desc": "Rotating chat announcements for your CS 1.6 server — timed, coloured, and config-driven.",
11 + "version": "1.0.0",
12 + "amxx_min": "1.9",
13 + "amxx_compile_default": "1.9",
14 + "rehlds_ok": true,
15 + "hlds_ok": true,
16 + "regamedll_required": false,
17 + "metamod_flavor": "any",
18 + "reapi_required": false,
19 + "modules": "",
20 + "install_notes": "1. Put adverts.amxx in addons/amxmodx/plugins/\n2. Add 'adverts.amxx' to addons/amxmodx/configs/plugins.ini\n3. Create addons/amxmodx/configs/csb_adverts.ini (see csb_adverts.ini below)\n4. Change map or restart the server\n\nRequires AMX Mod X 1.9 or newer (1.8.2 is NOT supported — it lacks client_print_color).",
21 + "known_conflicts": "Disable other advert/announcement plugins to avoid duplicate chat spam.",
22 + "cvars": [
23 + {
24 + "name": "csb_adverts_enabled",
25 + "default": "1",
26 + "description": "Enable (1) or disable (0) the advert rotation."
27 + },
28 + {
29 + "name": "csb_adverts_interval",
30 + "default": "90.0",
31 + "description": "Seconds between adverts. Minimum 10."
32 + },
33 + {
34 + "name": "csb_adverts_prefix",
35 + "default": "[INFO]",
36 + "description": "Prefix shown before every advert."
37 + }
38 + ],
39 + "commands": [
40 + {
41 + "name": "say /adverts",
42 + "access": "ADMIN_CFG",
43 + "description": "List the loaded adverts in console."
44 + }
45 + ],
46 + "main": "addons/amxmodx/scripting/adverts.sma"
47 +}
+5 -0 i18n/bg.md A
@@ -0,0 +1,5 @@
1 +---
2 +title: "CSB Server Adverts"
3 +short_desc: "Ротиращи се съобщения в чата на вашия CS 1.6 сървър — с таймер, цветове и конфигурация."
4 +---
5 +<p><strong>CSB Server Adverts</strong> ротира списък от съобщения в чата на сървъра. Рекламирайте сайта, Discord, правилата или VIP предимствата, без да дразните играчите всеки рунд.</p><h2>Функции</h2><ul><li>Съобщения от прост файл <code>csb_adverts.ini</code> (до 32).</li><li>Интервал и префикс, настройвани чрез CVAR.</li><li>Поддръжка на цветови кодове (<code>^x04</code> зелено, <code>^x03</code> отбор, <code>^x01</code> нормално).</li><li>Не изпраща нищо при празен сървър.</li><li><code>say /adverts</code> показва списъка на админите.</li></ul><h2>Инсталация</h2><ol><li>Компилирайте плъгина (или изтеглете готовия <code>.amxx</code>).</li><li>Копирайте <code>adverts.amxx</code> в <code>addons/amxmodx/plugins/</code>.</li><li>Добавете го в <code>addons/amxmodx/configs/plugins.ini</code>.</li><li>Създайте <code>addons/amxmodx/configs/csb_adverts.ini</code>.</li><li>Сменете картата или рестартирайте сървъра.</li></ol>
+5 -0 i18n/de.md A
@@ -0,0 +1,5 @@
1 +---
2 +title: "CSB Server Adverts"
3 +short_desc: "Rotierende Chat-Ankündigungen für deinen CS 1.6 Server — getaktet, farbig und konfigurierbar."
4 +---
5 +<p><strong>CSB Server Adverts</strong> rotiert eine Liste von Nachrichten im Server-Chat. Kündige deine Website, Discord, Regeln oder VIP-Vorteile an, ohne Spieler jede Runde zu nerven.</p><h2>Funktionen</h2><ul><li>Nachrichten aus einer einfachen <code>csb_adverts.ini</code> (bis zu 32).</li><li>Intervall und Präfix über CVARs einstellbar.</li><li>Farbcodes werden unterstützt (<code>^x04</code> grün, <code>^x03</code> Team, <code>^x01</code> normal).</li><li>Sendet nichts, wenn der Server leer ist.</li><li><code>say /adverts</code> listet die Ankündigungen für Admins.</li></ul><h2>Installation</h2><ol><li>Plugin kompilieren (oder die fertige <code>.amxx</code> oben laden).</li><li><code>adverts.amxx</code> nach <code>addons/amxmodx/plugins/</code> kopieren.</li><li>In <code>addons/amxmodx/configs/plugins.ini</code> eintragen.</li><li><code>addons/amxmodx/configs/csb_adverts.ini</code> anlegen.</li><li>Map wechseln oder Server neu starten.</li></ol>
+5 -0 i18n/es.md A
@@ -0,0 +1,5 @@
1 +---
2 +title: "CSB Server Adverts"
3 +short_desc: "Anuncios rotativos en el chat de tu servidor CS 1.6 — temporizados, con color y configurables."
4 +---
5 +<p><strong>CSB Server Adverts</strong> rota una lista de mensajes en el chat del servidor. Anuncia tu web, Discord, reglas o ventajas VIP sin molestar a los jugadores cada ronda.</p><h2>Características</h2><ul><li>Mensajes desde un simple <code>csb_adverts.ini</code> (hasta 32).</li><li>Intervalo y prefijo configurables por CVAR.</li><li>Soporta códigos de color (<code>^x04</code> verde, <code>^x03</code> equipo, <code>^x01</code> normal).</li><li>No envía nada si el servidor está vacío.</li><li><code>say /adverts</code> lista los anuncios para admins.</li></ul><h2>Instalación</h2><ol><li>Compila el plugin (o descarga el <code>.amxx</code> de arriba).</li><li>Copia <code>adverts.amxx</code> a <code>addons/amxmodx/plugins/</code>.</li><li>Añádelo a <code>addons/amxmodx/configs/plugins.ini</code>.</li><li>Crea <code>addons/amxmodx/configs/csb_adverts.ini</code>.</li><li>Cambia de mapa o reinicia el servidor.</li></ol>
+5 -0 i18n/fr.md A
@@ -0,0 +1,5 @@
1 +---
2 +title: "CSB Server Adverts"
3 +short_desc: "Annonces rotatives dans le chat de votre serveur CS 1.6 — minutées, colorées et configurables."
4 +---
5 +<p><strong>CSB Server Adverts</strong> fait tourner une liste de messages dans le chat du serveur. Annoncez votre site, Discord, règles ou avantages VIP sans harceler les joueurs à chaque round.</p><h2>Fonctionnalités</h2><ul><li>Messages depuis un simple <code>csb_adverts.ini</code> (jusqu'à 32).</li><li>Intervalle et préfixe configurables via CVAR.</li><li>Codes couleur pris en charge (<code>^x04</code> vert, <code>^x03</code> équipe, <code>^x01</code> normal).</li><li>N'envoie rien si le serveur est vide.</li><li><code>say /adverts</code> liste les annonces pour les admins.</li></ul><h2>Installation</h2><ol><li>Compilez le plugin (ou téléchargez le <code>.amxx</code> ci-dessus).</li><li>Copiez <code>adverts.amxx</code> dans <code>addons/amxmodx/plugins/</code>.</li><li>Ajoutez-le à <code>addons/amxmodx/configs/plugins.ini</code>.</li><li>Créez <code>addons/amxmodx/configs/csb_adverts.ini</code>.</li><li>Changez de map ou redémarrez le serveur.</li></ol>
+5 -0 i18n/pl.md A
@@ -0,0 +1,5 @@
1 +---
2 +title: "CSB Server Adverts"
3 +short_desc: "Rotacyjne ogłoszenia na czacie serwera CS 1.6 — z timerem, kolorami i konfiguracją."
4 +---
5 +<p><strong>CSB Server Adverts</strong> wyświetla na czacie serwera listę wiadomości w odstępach czasu. Reklamuj stronę, Discorda, zasady lub przywileje VIP bez męczenia graczy w każdej rundzie.</p><h2>Funkcje</h2><ul><li>Wiadomości z prostego pliku <code>csb_adverts.ini</code> (do 32).</li><li>Interwał i prefiks konfigurowane przez CVAR-y.</li><li>Obsługa kodów kolorów (<code>^x04</code> zielony, <code>^x03</code> drużyna, <code>^x01</code> zwykły).</li><li>Nie wysyła nic, gdy serwer jest pusty.</li><li><code>say /adverts</code> pokazuje listę adminom.</li></ul><h2>Instalacja</h2><ol><li>Skompiluj plugin (lub pobierz gotowy <code>.amxx</code>).</li><li>Skopiuj <code>adverts.amxx</code> do <code>addons/amxmodx/plugins/</code>.</li><li>Dodaj wpis do <code>addons/amxmodx/configs/plugins.ini</code>.</li><li>Utwórz <code>addons/amxmodx/configs/csb_adverts.ini</code>.</li><li>Zmień mapę lub zrestartuj serwer.</li></ol>
+5 -0 i18n/pt.md A
@@ -0,0 +1,5 @@
1 +---
2 +title: "CSB Server Adverts"
3 +short_desc: "Anúncios rotativos no chat do seu servidor CS 1.6 — temporizados, coloridos e configuráveis."
4 +---
5 +<p><strong>CSB Server Adverts</strong> alterna uma lista de mensagens no chat do servidor. Divulgue seu site, Discord, regras ou vantagens VIP sem incomodar os jogadores a cada round.</p><h2>Recursos</h2><ul><li>Mensagens de um simples <code>csb_adverts.ini</code> (até 32).</li><li>Intervalo e prefixo configuráveis por CVAR.</li><li>Suporta códigos de cor (<code>^x04</code> verde, <code>^x03</code> time, <code>^x01</code> normal).</li><li>Não envia nada com o servidor vazio.</li><li><code>say /adverts</code> lista os anúncios para admins.</li></ul><h2>Instalação</h2><ol><li>Compile o plugin (ou baixe o <code>.amxx</code> acima).</li><li>Copie <code>adverts.amxx</code> para <code>addons/amxmodx/plugins/</code>.</li><li>Adicione em <code>addons/amxmodx/configs/plugins.ini</code>.</li><li>Crie <code>addons/amxmodx/configs/csb_adverts.ini</code>.</li><li>Troque o mapa ou reinicie o servidor.</li></ol>
+5 -0 i18n/ro.md A
@@ -0,0 +1,5 @@
1 +---
2 +title: "CSB Server Adverts"
3 +short_desc: "Anunțuri rotative în chat pentru serverul tău de CS 1.6 — cronometrate, colorate și configurabile."
4 +---
5 +<p><strong>CSB Server Adverts</strong> rotește o listă de mesaje în chat-ul serverului la un interval fix. Folosește-l pentru a anunța site-ul, Discord-ul, regulile sau beneficiile VIP fără să deranjezi jucătorii în fiecare rundă.</p><h2>Funcții</h2><ul><li>Mesaje dintr-un fișier simplu <code>csb_adverts.ini</code> (până la 32 încărcate).</li><li>Interval și prefix configurabile prin CVAR-uri.</li><li>Suportă coduri de culoare (<code>^x04</code> verde, <code>^x03</code> echipă, <code>^x01</code> normal).</li><li>Nu trimite mesaje când serverul este gol.</li><li><code>say /adverts</code> listează anunțurile pentru admini.</li></ul><h2>Instalare</h2><ol><li>Compilează pluginul (sau descarcă <code>.amxx</code>-ul de mai sus).</li><li>Pune <code>adverts.amxx</code> în <code>addons/amxmodx/plugins/</code>.</li><li>Adaugă <code>adverts.amxx</code> în <code>addons/amxmodx/configs/plugins.ini</code>.</li><li>Creează <code>addons/amxmodx/configs/csb_adverts.ini</code> cu un mesaj pe linie.</li><li>Schimbă harta sau repornește serverul.</li></ol>
+5 -0 i18n/ru.md A
@@ -0,0 +1,5 @@
1 +---
2 +title: "CSB Server Adverts"
3 +short_desc: "Ротация сообщений в чате вашего сервера CS 1.6 — по таймеру, с цветом и настройкой."
4 +---
5 +<p><strong>CSB Server Adverts</strong> по таймеру выводит в чат список сообщений. Рекламируйте сайт, Discord, правила или VIP-привилегии, не раздражая игроков каждый раунд.</p><h2>Возможности</h2><ul><li>Сообщения из простого файла <code>csb_adverts.ini</code> (до 32).</li><li>Интервал и префикс настраиваются через CVAR.</li><li>Поддержка цветовых кодов (<code>^x04</code> зелёный, <code>^x03</code> команда, <code>^x01</code> обычный).</li><li>Не отправляет сообщения на пустом сервере.</li><li><code>say /adverts</code> показывает список админам.</li></ul><h2>Установка</h2><ol><li>Скомпилируйте плагин (или скачайте готовый <code>.amxx</code>).</li><li>Поместите <code>adverts.amxx</code> в <code>addons/amxmodx/plugins/</code>.</li><li>Добавьте строку в <code>addons/amxmodx/configs/plugins.ini</code>.</li><li>Создайте <code>addons/amxmodx/configs/csb_adverts.ini</code>.</li><li>Смените карту или перезапустите сервер.</li></ol>
+5 -0 i18n/tr.md A
@@ -0,0 +1,5 @@
1 +---
2 +title: "CSB Server Adverts"
3 +short_desc: "CS 1.6 sunucunuz için dönüşümlü sohbet duyuruları — zamanlayıcılı, renkli ve yapılandırılabilir."
4 +---
5 +<p><strong>CSB Server Adverts</strong> sunucu sohbetinde bir mesaj listesini belirli aralıklarla döndürür. Web sitenizi, Discord'unuzu, kurallarınızı veya VIP ayrıcalıklarınızı her raundda oyuncuları rahatsız etmeden duyurun.</p><h2>Özellikler</h2><ul><li>Basit bir <code>csb_adverts.ini</code> dosyasından mesajlar (en fazla 32).</li><li>CVAR'lar ile ayarlanabilir aralık ve önek.</li><li>Renk kodu desteği (<code>^x04</code> yeşil, <code>^x03</code> takım, <code>^x01</code> normal).</li><li>Sunucu boşken mesaj göndermez.</li><li><code>say /adverts</code> yöneticilere listeyi gösterir.</li></ul><h2>Kurulum</h2><ol><li>Eklentiyi derleyin (veya yukarıdaki <code>.amxx</code> dosyasını indirin).</li><li><code>adverts.amxx</code> dosyasını <code>addons/amxmodx/plugins/</code> içine koyun.</li><li><code>addons/amxmodx/configs/plugins.ini</code> dosyasına ekleyin.</li><li><code>addons/amxmodx/configs/csb_adverts.ini</code> oluşturun.</li><li>Haritayı değiştirin veya sunucuyu yeniden başlatın.</li></ol>
0 6