Цветное сообщение в чат

Статус
В этой теме нельзя размещать новые ответы.
Сообщения
24
Реакции
-2
Предупреждения
5
Ошибка
Не правильный вывод сообщения в чат
ОС
Linux
Amx Mod X
AMX Mod X 1.9.0.5271 (http://www.amxmodx.org)
Билд
Protocol version 48
Exe version 1.6.3.7/Stdio (cstrike)
ReHLDS version: 3.11.0.767-dev
Build date: 03:13:55 Oct 25 2021 (2753)
Build from: https://github.com/dreamstalker/rehlds/commit/471158b
ReGamedll
Build date: 17:33:16 Oct 25 2021
Версия Metamod
Metamod-r v1.3.0.128, API (5:13)
Metamod-r build: 17:47:54 Aug 24 2018
Список метамодулей
description      stat pend  file                      vers             src  load  unload
[ 1] VoiceTranscoder RUN - VoiceTranscoder.so v2017RC5 ini ANY ANY
[ 2] AMX Mod X RUN - amxmodx_mm_i386.so v1.9.0.5271 ini Start ANY
[ 3] Reunion RUN - reunion_mm_i386.so v0.1.0.92 ini Start Never
[ 4] ReSemiclip RUN - resemiclip_mm_i386.so v2.3.9 ini Chlvl ANY
[ 5] MySQL RUN - mysql_amxx_i386.so v1.9.0.5271 pl2 ANY ANY
[ 6] ReAPI RUN - reapi_amxx_i386.so v5.21.0.248-dev pl2 ANY Never
[ 7] Engine RUN - engine_amxx_i386.so v1.9.0.5271 pl2 ANY ANY
[ 8] FakeMeta RUN - fakemeta_amxx_i386.so v1.9.0.5271 pl2 ANY ANY
[ 9] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.9.0.5271 pl2 ANY ANY
[10] CSX RUN - csx_amxx_i386.so v1.9.0.5271 pl2 ANY ANY
[11] CStrike RUN - cstrike_amxx_i386.so v1.9.0.5271 pl2 ANY ANY
[12] Fun RUN - fun_amxx_i386.so v1.9.0.5271 pl2 ANY ANY
12 plugins, 12 running
Список плагинов
name                    version     author            file             status
[ 1] GameCMS_API 5.5.3 zhorzh78 gamecms_api.amx running
[ 2] GameCMS_GagManager 2.2.7 ReAp zhorzh78 gamecms_gagmana running
[ 3] From Rock to Ban 1.02 Safety1st++ rock2gag.amxx running
[ 4] [190] AMXBans RBS 20.06.06 SKAJIbnEJIb & La amxbans_rbs.amx running
[ 5] [190] Ultimate Weapons 21.03.23 SKAJIbnEJIb ultimate_weapon running
[ 6] [190] Army Ranks Ultim 20.06.06 SKAJIbnEJIb army_ranks_ulti running
[ 7] Menus Front-End 20.06.06 SKAJIbnEJIb & AM amxmodmenu_rbs. running
[ 8] [190] Chat Addons 20.06.06 SKAJIbnEJIb chat_addons.amx running
[ 9] [190] Chat RBS 20.06.06 SKAJIbnEJIb chat_rbs.amxx running
[ 10] [190] VIP RBS 20.07.20 SKAJIbnEJIb vip_rbs.amxx running
[ 11] [190] Ultimate Flags 20.06.06 SKAJIbnEJIb ultimate_flags. running
[ 12] [190] BonusMenu RBS 20.06.06 SKAJIbnEJIb bonusmenu_rbs.a running
[ 13] [190] Screen Player 20.06.06 SKAJIbnEJIb screen_player.a running
[ 14] [190] AdminChat RBS 20.06.06 SKAJIbnEJIb adminchat_rbs.a running
[ 15] [190] Ultimate Informe 21.03.23 SKAJIbnEJIb ultimate_inform running
[ 16] [190] CsStats MySQL 20.06.06 SKAJIbnEJIb csstats_mysql.a running
[ 17] Admin Commands 1.9.0.5271 AMXX Dev Team admincmd.amxx running
[ 18] Admin Help 1.9.0.5271 AMXX Dev Team adminhelp.amxx running
[ 19] Slots Reservation 1.9.0.5271 AMXX Dev Team adminslots.amxx running
[ 20] Multi-Lingual System 1.9.0.5271 AMXX Dev Team multilingual.am running
[ 21] Commands Menu 1.9.0.5271 AMXX Dev Team cmdmenu.amxx running
[ 22] Players Menu 1.9.0.5271 AMXX Dev Team plmenu.amxx running
[ 23] Plugin Menu 1.9.0.5271 AMXX Dev Team pluginmenu.amxx running
[ 24] Anti Flood 1.9.0.5271 AMXX Dev Team antiflood.amxx running
[ 25] Scrolling Message 1.9.0.5271 AMXX Dev Team scrollmsg.amxx running
[ 26] Info. Messages 1.9.0.5271 AMXX Dev Team imessage.amxx running
[ 27] Admin Votes 1.9.0.5271 AMXX Dev Team adminvote.amxx running
[ 28] NextMap 1.9.0.5271 AMXX Dev Team nextmap.amxx running
[ 29] TimeLeft 1.9.0.5271 AMXX Dev Team timeleft.amxx running
[ 30] Pause Plugins 1.9.0.5271 AMXX Dev Team pausecfg.amxx running
[ 31] Stats Configuration 1.9.0.5271 AMXX Dev Team statscfg.amxx running
[ 32] StatsX 1.9.0.5271 AMXX Dev Team statsx.amxx running
[ 33] MultiJump 1.1 twistedeuphoria multijump_admin running
[ 34] AdminMenu 4.0 SkocH admenu.amxx running
[ 35] Auto recording demo 2.0 IzI | Bonaqua (R amx_autodemorec running
[ 36] Maps Menu 1.9.0.5271 AMXX Dev Team mapsmenu.amxx running
[ 37] Parachute 1.3 [email protected]/JTP10181 amx_parachute.a running
[ 38] Tutor Manager 1.0 Dorus tutor_manager.a running
[ 39] Reklama 20.05.2020 mx?! reklama.amxx running
[ 40] M Menu 1.0 Erasus menu.amxx running
[ 41] buy_admin 1.0 sergeychavko buy_admin.amxx running
[ 42] >>>SERVVER BAN<<< 3.0 SLIMSHADY_MOD voteban.amxx running
[ 43] resetscore 1.0 My_StyLe^ resetscore.amxx running
[ 44] Custom Smoke 1.0 xPaw, Justick custom_smoke.am running
[ 45] C4 Timer 1.1 SAMURAI & Remod: c4_timer.amxx running
[ 46] Models Replacement 0.0.2 ConnorMcLeod | V models_replacem running
[ 47] __[ReAPI] Can Revive P 1.0.0 NOLKFUN revive_teammate running
[ 48] [ReAPI] Healthnade 0.0.2 [email protected] reapi_healthnad running
[ 49] Damager 0.0.5 steelzzz damager.amxx running
[ 50] Mode 2x2 2.5re s1lent blockmap.amxx running
[ 51] Frags Exchanger 1.1 ApXuTekToR Frags_Exchanger running
[ 52] FakeFull Original 1.7.6 JTP10181/Freecod fakefull_origin running
[ 53] Snow 1.0 uncO snow.amxx running
[ 54] Tree Spawner 1.0 xPaw TreeSpawner.amx running
[ 55] Christmas Tree Spawn 0.0.1b wopox1337 ChristmasTree.a running
[ 56] Map Manager: Core 3.0.10 Mistrick map_manager_cor running
[ 57] Map Manager: Scheduler 0.1.7 Mistrick map_manager_sch running
[ 58] Map Manager: Rtv 0.1.1 Mistrick map_manager_rtv running
[ 59] Map Manager: Nominatio 0.1.3 Mistrick map_manager_nom running
[ 60] Map Manager: Effects 0.0.10 Mistrick map_manager_eff running
[ 61] Map Manager: Informer 0.0.5 Mistrick map_manager_inf running
[ 62] unknown unknown unknown musloading.amxx running
[ 63] Ultimate Sound 1.5 Dizzy ultimate_sounds running
[ 64] Media Kick/Ban 3.5 Allenwr mediakickban.am running
[ 65] End Round Sound and Pl 2.1 Eriurias EndRoundSound.a running
[ 66] [CS-GSRC.RU] Addon: Mu 0.1 Immortal- (for c AmxMusic.amxx running
[ 67] PromoCode 2.0 DalgaPups promokod_main.a running
[ 68] unknown unknown unknown promokod_bonus. running
[ 69] MultiJump 1.1 twistedeuphoria promo_jump.amxx running
[ 70] Map Manager: BlockList 0.0.3 Mistrick map_manager_blo running
[ 71] Map Manager: Online so 0.0.3 Mistrick map_manager_onl running
71 plugins, 71 running
Автор плагина
Eriurias
Версия плагина
2.1
Исходный код
#include <amxmisc>

#if AMXX_VERSION_NUM < 183
#include <colorchat>
#endif

#pragma semicolon 1
#pragma ctrlchar '\'

#define PLUGIN "End Round Sound and PlayList"
#define VERSION "2.1"
#define DATE "16.10.2015"
#define URL "http://eriurias.ru"
#define AUTHOR "Eriurias"

#define ArrayCharsmax(%1) ArraySize(%1) - 1

#define MAX_ARRAYSIZE 128
#define MAX_STRSIZE 64
#define MAX_PLAYERS 32

#define NAME_PLAYLIST "playlist.ini"
#define NAME_DICTIONARY "playlist.txt"
#define NAME_PREFIX "[ERS]\3"

#define CHECK_VALUES_DELAY 1.5

enum Type
{
NEW_SOUND,
OLD_SOUND
};

enum Cvar_Type
{
PLAYBACK_MODE,
VISIBLE_INFO_NULL,
PLAYBACK_CONNECT,
CHANGE_VOLUME
};

new Array: g_aPlayList, g_nArraySize;
new bool: g_bPlayerPlayback[MAX_PLAYERS + 1] = {true, ...};
new g_nCvarData[Cvar_Type];
new bool: g_bRoundEnded;
new SayText;

public plugin_precache()
{
g_aPlayList = ArrayCreate(MAX_ARRAYSIZE);

new szCfgDir[MAX_STRSIZE], nFile;
get_configsdir(szCfgDir, charsmax(szCfgDir));

formatex(szCfgDir, charsmax(szCfgDir), "%s/%s", szCfgDir, NAME_PLAYLIST);

nFile = fopen(szCfgDir, "rt");

if (!nFile)
{
log_to_error("File (%s) not exists! Plugin stopped!", NAME_PLAYLIST);
pause("d");
}

new szBuffer[MAX_ARRAYSIZE], szSound[MAX_STRSIZE];

while (!feof(nFile))
{
fgets(nFile, szBuffer, charsmax(szBuffer));

trim(szBuffer);

if(szBuffer[0] == ';' || szBuffer[0] == '\0')
continue;

parse(szBuffer, szSound, charsmax(szSound));

if (contain(szSound, ".mp3") != -1)
precache_generic(szSound);
else if (contain(szSound, ".wav") != -1)
precache_sound(szSound);

ArrayPushString(g_aPlayList, szBuffer);
}

if ((g_nArraySize = ArrayCharsmax(g_aPlayList)) == -1)
{
log_to_error("An empty playlist. Plugin stopped!");
pause("d");
}
}

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR/*, DATE, URL*/);

register_logevent("fwdEndRound", 2, "1=Round_End");
register_event("HLTV", "fwdNewRound", "a", "1=0", "2=0");

register_clcmd("say /music", "MusicSwitch");

g_nCvarData[PLAYBACK_MODE] = register_cvar("ers_sound_mode", "0");
g_nCvarData[VISIBLE_INFO_NULL] = register_cvar("ers_show_info_null", "1");
g_nCvarData[PLAYBACK_CONNECT] = register_cvar("ers_playback_connect", "1");
g_nCvarData[CHANGE_VOLUME] = register_cvar("ers_change_volume", "1");

set_task(CHECK_VALUES_DELAY, "CheckCvars");

register_dictionary(NAME_DICTIONARY);
register_cvar("amx_erm_showinfo_delay", "20.0");
SayText = get_user_msgid("SayText");
}

public client_putinserver(id)
{
set_task(get_cvar_float("amx_erm_showinfo_delay"), "showerminfo", id);
}

public CheckCvars()
{
g_nCvarData[PLAYBACK_MODE] = get_pcvar_num(g_nCvarData[PLAYBACK_MODE]);
g_nCvarData[VISIBLE_INFO_NULL] = get_pcvar_num(g_nCvarData[VISIBLE_INFO_NULL]);
g_nCvarData[PLAYBACK_CONNECT] = get_pcvar_num(g_nCvarData[PLAYBACK_CONNECT]);
g_nCvarData[CHANGE_VOLUME] = get_pcvar_num(g_nCvarData[CHANGE_VOLUME]);
}

public MusicSwitch(nClientIndex)
g_bPlayerPlayback[nClientIndex] = !g_bPlayerPlayback[nClientIndex],
client_print_color(nClientIndex, print_team_default, "%s %L", NAME_PREFIX, nClientIndex, g_bPlayerPlayback[nClientIndex] ? "PLAY_SWITCH_ON" : "PLAY_SWITCH_OFF");

public client_connect(nClientIndex)
{
if (g_nCvarData[PLAYBACK_CONNECT])
{
static szSound[MAX_STRSIZE];

get_track(szSound, _, true);

if (contain(szSound, ".mp3") != -1)
client_cmd(nClientIndex, "%s mp3 play %s", g_nCvarData[CHANGE_VOLUME] ? "MP3Volume 1;" : "", szSound);
else if (contain(szSound, ".wav") != -1)
client_cmd(nClientIndex, "%s spk %s", g_nCvarData[CHANGE_VOLUME] ? "volume 1;" : "", szSound);
}
}

public fwdEndRound()
{
if (!g_bRoundEnded)
{
g_bRoundEnded = true;//round repeat ended fix

static szSound[MAX_STRSIZE], szDescription[MAX_STRSIZE],
gPlayers[MAX_PLAYERS], iNum, i, nClientIndex;

get_players(gPlayers, iNum, "ch");

if (!iNum)
return;

get_track(szSound, szDescription);

for (i = 0; i < iNum; i++)
{
nClientIndex = gPlayers[i];

if (!g_bPlayerPlayback[nClientIndex])
continue;

if (contain(szSound, ".mp3") != -1)
client_cmd(nClientIndex, "%s mp3 play %s", g_nCvarData[CHANGE_VOLUME] ? "MP3Volume 1;" : "", szSound);
else if (contain(szSound, ".wav") != -1)
client_cmd(nClientIndex, "%s spk %s", g_nCvarData[CHANGE_VOLUME] ? "volume 1;" : "", szSound);

if (szDescription[0] != '\0')
client_print_color(nClientIndex, print_team_default, "%s %L \1%s", NAME_PREFIX, nClientIndex, "PLAY_INFO", szDescription);
else if (szDescription[0] == '\0' && g_nCvarData[VISIBLE_INFO_NULL])
client_print_color(nClientIndex, print_team_default, "%s %L \1%L", NAME_PREFIX, nClientIndex, "PLAY_INFO", LANG_PLAYER, "PLAY_INFO_NULL");
}

if (szDescription[0] != '\0')
szDescription[0] = '\0';
}
}

public fwdNewRound() g_bRoundEnded = false;

stock get_track(szSound[MAX_STRSIZE], szDescription[MAX_STRSIZE] = "", bool: bConnect = false)
{
static szBuffer[MAX_ARRAYSIZE], nRandomSound[Type];

if (g_nCvarData[PLAYBACK_MODE])
{
while (nRandomSound[NEW_SOUND] == nRandomSound[OLD_SOUND])
nRandomSound[NEW_SOUND] = random(g_nArraySize);

nRandomSound[OLD_SOUND] = nRandomSound[NEW_SOUND];

ArrayGetString(g_aPlayList, nRandomSound[NEW_SOUND], szBuffer, charsmax(szBuffer));
parse(szBuffer, szSound, charsmax(szSound), szDescription, charsmax(szDescription));
}
else
{
static nSoundRound, nSoundConnect;

ArrayGetString(g_aPlayList, bConnect ? nSoundConnect : nSoundRound, szBuffer, charsmax(szBuffer));
parse(szBuffer, szSound, charsmax(szSound), szDescription, charsmax(szDescription));

if (bConnect)
{
if (nSoundConnect == g_nArraySize)
nSoundConnect = 0;
else
nSoundConnect++;
}
else
{
if (nSoundRound == g_nArraySize)
nSoundRound = 0;
else
nSoundRound++;
}
}
}

stock log_to_error(const szMessage[], ...)
{
new szLog[192], szDate[32];
vformat(szLog, charsmax(szLog), szMessage, 2);
get_time("error_%Y%m%d.log", szDate, charsmax(szDate));

log_to_file(szDate, "[%s] Displaying debug trace (plugin \"%s\", version \"%s\")", PLUGIN, PLUGIN, VERSION);
log_to_file(szDate, "[%s] %s", PLUGIN, szLog);
}

public showerminfo(id)
{
green_print(id, "PLAY_INFO_SAY");
}

stock green_print(index, const message[])
{
new finalmsg[192];
formatex(finalmsg, 191, "^x04[ERM MP3] ^x01%L", LANG_PLAYER, message);
message_begin(MSG_ONE, SayText, _, index);
write_byte(index);
write_string(finalmsg);
message_end();
}
Помогите пожалуйста решить проблему с выводом в чат.
В файл №1(оригинал) нужно добавить функцию которая при заходе на сервере через 20 секунд будет показывает цветное сообщение игроку.
Я пробовал вырезать код из файла №2(оригинал). Компилируется без ошибок. До этого ругался на отсутствие ";", поставил где требовал и ошибки пропали. Сообщение показывается, но не цветное, обычном цветом.
Файл №3 это готовый исходник, то что я слепил.

И подскажите еще как сделать префикс чата цветным. А то оно тоже обычного цвета. Буду признателен!
#define NAME_PREFIX "[ERS]\3"
 
В этой теме было размещено решение! Перейти к решению.

Download all Attachments

  • 6.1 KB Просмотры: 7
  • 7.3 KB Просмотры: 8
  • 6.6 KB Просмотры: 10
Последнее редактирование:
Сообщения
24
Реакции
-2
Предупреждения
5
Проблема решена!

Цвета указывались через \


\4
\3
\1
 
Статус
В этой теме нельзя размещать новые ответы.

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу