HostnameManager: small update
This commit is contained in:
		
							parent
							
								
									e6a067ad60
								
							
						
					
					
						commit
						5c73e2a773
					
				@ -34,7 +34,7 @@ public Plugin myinfo =
 | 
				
			|||||||
public void OnPluginStart()
 | 
					public void OnPluginStart()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	g_cvHostname = FindConVar("hostname");
 | 
						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);
 | 
						CreateTimer(60.0, TimerRepeat, INVALID_HANDLE, TIMER_REPEAT);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -135,6 +135,17 @@ public void RefreshHostname()
 | 
				
			|||||||
	else
 | 
						else
 | 
				
			||||||
		ReplaceString(sFormattedHostname, sizeof(sFormattedHostname), "{GM}", "Zombie Escape", true);
 | 
							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);
 | 
						g_cvHostname.SetString(sFormattedHostname, false, false);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user