v1.2.3: PrintHintText + PrintCenterText вместо ShowHudText (для CSGO)
ShowHudText в CSGO не работает (это HL2-функция). Используем PrintHintText (угол со звуком) + PrintCenterText (центр) с повторами на 2/4/6 сек таймерами.
This commit is contained in:
@@ -104,10 +104,14 @@ addons/sourcemod/logs/custom_rounds.log
|
|||||||
|
|
||||||
## Версия
|
## Версия
|
||||||
|
|
||||||
`1.2.2` — Автор: deidara.dev
|
`1.2.3` — Автор: deidara.dev
|
||||||
|
|
||||||
### Changelog
|
### Changelog
|
||||||
|
|
||||||
|
- **1.2.3**
|
||||||
|
- Замена `ShowHudText` (для HL2, не работал в CSGO) на надёжные `PrintHintText` + `PrintCenterText`
|
||||||
|
- Уведомление о кастомном раунде показывается всем игрокам тремя способами одновременно: MOTD-картинка, hint-text в углу со звуком, большой центральный текст
|
||||||
|
- Центральный текст повторяется таймерами на 2/4/6 секундах чтобы держать сообщение видимым на протяжении всего freezetime
|
||||||
- **1.2.2**
|
- **1.2.2**
|
||||||
- Фикс лога: переход с `LogToFileEx(absolute_path)` на `OpenFile("addons/sourcemod/logs/custom_rounds.log", "a")`. На MyArena `LogToFileEx` с absolute путём от `BuildPath` молча не создавал файл.
|
- Фикс лога: переход с `LogToFileEx(absolute_path)` на `OpenFile("addons/sourcemod/logs/custom_rounds.log", "a")`. На MyArena `LogToFileEx` с absolute путём от `BuildPath` молча не создавал файл.
|
||||||
- Фикс MOTD: используется стандартный `ShowMOTDPanel` (правильно сериализует KeyValues с типом как строкой)
|
- Фикс MOTD: используется стандартный `ShowMOTDPanel` (правильно сериализует KeyValues с типом как строкой)
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public Plugin myinfo =
|
|||||||
name = "ArcaneGame Custom Rounds Core",
|
name = "ArcaneGame Custom Rounds Core",
|
||||||
author = "deidara.dev",
|
author = "deidara.dev",
|
||||||
description = "Core plugin for custom rounds with AG Coin integration",
|
description = "Core plugin for custom rounds with AG Coin integration",
|
||||||
version = "1.2.2",
|
version = "1.2.3",
|
||||||
url = "https://deidara.dev"
|
url = "https://deidara.dev"
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1216,15 +1216,53 @@ void GetRoundUrlSlug(CustomRoundType roundType, char[] buffer, int maxlen)
|
|||||||
|
|
||||||
void ShowFreezeImageToAll(CustomRoundType mode)
|
void ShowFreezeImageToAll(CustomRoundType mode)
|
||||||
{
|
{
|
||||||
|
char title[64], description[128];
|
||||||
|
GetRoundDisplayName(mode, title, sizeof(title));
|
||||||
|
GetRoundDescription(mode, description, sizeof(description));
|
||||||
|
|
||||||
char slug[32];
|
char slug[32];
|
||||||
GetRoundUrlSlug(mode, slug, sizeof(slug));
|
GetRoundUrlSlug(mode, slug, sizeof(slug));
|
||||||
if (slug[0] == '\0')
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
char url[256];
|
char url[256];
|
||||||
Format(url, sizeof(url), "%s%s.html", CR_MOTD_BASE_URL, slug);
|
if (slug[0] != '\0')
|
||||||
|
{
|
||||||
|
Format(url, sizeof(url), "%s%s.html", CR_MOTD_BASE_URL, slug);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 1; i <= MaxClients; i++)
|
||||||
|
{
|
||||||
|
if (!IsClientInGame(i) || IsFakeClient(i))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1) MOTD URL — для тех у кого включён HTML MOTD на клиенте
|
||||||
|
if (slug[0] != '\0')
|
||||||
|
{
|
||||||
|
ShowMOTDPanel(i, title, url, MOTDPANEL_TYPE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2) PrintHintText — уведомление в правом нижнем углу со звуком
|
||||||
|
PrintHintText(i, "★ КАСТОМНЫЙ РАУНД ★\n%s\n\n%s", title, description);
|
||||||
|
|
||||||
|
// 3) PrintCenterText — большой текст в центре экрана (первый показ)
|
||||||
|
PrintCenterText(i, "★ %s ★\n%s", title, description);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Повторяем PrintCenterText на 2-й, 4-й, 6-й секундах чтобы держать сообщение видимым
|
||||||
|
// на протяжении freezetime (в CSGO он обычно 6-15 сек)
|
||||||
|
CreateTimer(2.0, Timer_RepeatOverlay, view_as<int>(mode), TIMER_FLAG_NO_MAPCHANGE);
|
||||||
|
CreateTimer(4.0, Timer_RepeatOverlay, view_as<int>(mode), TIMER_FLAG_NO_MAPCHANGE);
|
||||||
|
CreateTimer(6.0, Timer_RepeatOverlay, view_as<int>(mode), TIMER_FLAG_NO_MAPCHANGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Action Timer_RepeatOverlay(Handle timer, any modeRaw)
|
||||||
|
{
|
||||||
|
CustomRoundType mode = view_as<CustomRoundType>(modeRaw);
|
||||||
|
if (mode != g_CurrentRound)
|
||||||
|
{
|
||||||
|
return Plugin_Stop;
|
||||||
|
}
|
||||||
|
|
||||||
char title[64], description[128];
|
char title[64], description[128];
|
||||||
GetRoundDisplayName(mode, title, sizeof(title));
|
GetRoundDisplayName(mode, title, sizeof(title));
|
||||||
@@ -1236,15 +1274,10 @@ void ShowFreezeImageToAll(CustomRoundType mode)
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
PrintCenterText(i, "★ %s ★\n%s", title, description);
|
||||||
// 1) Попытка показать MOTD-картинку (требует cl_disablehtmlmotd 0 на клиенте)
|
|
||||||
ShowMOTDPanel(i, title, url, MOTDPANEL_TYPE_URL);
|
|
||||||
|
|
||||||
// 2) Гарантированный визуальный fallback — большой текст в центре экрана
|
|
||||||
// Покажется даже если у клиента отключён HTML MOTD
|
|
||||||
SetHudTextParams(-1.0, 0.18, 6.0, 255, 140, 0, 100, 0, 0.3, 0.3, 0.5);
|
|
||||||
ShowHudText(i, -1, "★ КАСТОМНЫЙ РАУНД ★\n%s\n\n%s", title, description);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return Plugin_Stop;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetRoundDescription(CustomRoundType roundType, char[] buffer, int maxlen)
|
void GetRoundDescription(CustomRoundType roundType, char[] buffer, int maxlen)
|
||||||
|
|||||||
Reference in New Issue
Block a user