HostnameManager: small update

This commit is contained in:
Dogan 2019-11-29 20:18:15 +01:00
parent e6a067ad60
commit 5c73e2a773

View File

@ -34,7 +34,7 @@ public Plugin myinfo =
public void OnPluginStart()
{
g_cvHostname = FindConVar("hostname");
g_cvFormattedHostname = CreateConVar("sm_hostname_format", "{HH}UNLOZE | {GM} | NoSteam{SD}", "HH = HappyHour, , GM = GameMode, SD = StageDisplay");
g_cvFormattedHostname = CreateConVar("sm_hostname_format", "{HH}UNLOZE | {GM} | LagCompensation | NoSteam{SD}", "HH = HappyHour, , GM = GameMode, SD = StageDisplay");
CreateTimer(60.0, TimerRepeat, INVALID_HANDLE, TIMER_REPEAT);
@ -135,6 +135,17 @@ public void RefreshHostname()
else
ReplaceString(sFormattedHostname, sizeof(sFormattedHostname), "{GM}", "Zombie Escape", true);
int iLength = strlen(sFormattedHostname);
if(iLength > 55)
{
if (g_bHHLoaded && HH_IsItHappyHour()) //first trim hh if hh
ReplaceString(sFormattedHostname, sizeof(sFormattedHostname), "[HappyHour] ", "", true);
}
iLength = strlen(sFormattedHostname);
if(iLength > 55) //check if its still too long and trim LagCompensation
ReplaceString(sFormattedHostname, sizeof(sFormattedHostname), "LagCompensation | ", "", true);
g_cvHostname.SetString(sFormattedHostname, false, false);
}