new plugin HostnameManager

This commit is contained in:
neon
2019-06-04 17:39:39 +02:00
parent fd0db97ccd
commit 6a57a998f6
4 changed files with 220 additions and 38 deletions
-19
View File
@@ -17,9 +17,6 @@ ConVar g_cvMorningEnd;
ConVar g_cvNightStart;
ConVar g_cvNightEnd;
ConVar g_cvHostName;
char g_sHostName[128];
public Plugin myinfo =
{
name = "Happy Hour",
@@ -50,8 +47,6 @@ public void OnPluginStart()
g_cvNightStart = CreateConVar("sm_happyhour_night_start", "2300", "starttime of happy hour in the night (timezone UTC+1 in summer, UTC+2 in winter)");
g_cvNightEnd = CreateConVar("sm_happyhour_night_end", "0300", "endtime of happy hour in the night (timezone UTC+1 in summer, UTC+2 in winter)");
g_cvHostName = FindConVar("hostname");
RegConsoleCmd("sm_hh", Command_DisplayHappyHour, "Shows if happy hour is currently enabled or not");
RegAdminCmd("sm_forcehh", AdminCommand_HappyHour, ADMFLAG_GENERIC, "Toggle to enable/disable Happy Hour. Resets after Mapswitch.");
@@ -73,11 +68,6 @@ public void ConVarChange(ConVar convar, char[] oldValue, char[] newValue)
GetConVars();
}
public void OnConfigsExecuted()
{
g_cvHostName.GetString(g_sHostName, sizeof(g_sHostName));
}
public Action Timer_CheckTime(Handle timer)
{
if(g_bHappyHourAdmin)
@@ -165,16 +155,7 @@ public void ToggleHappyHour(int client)
public Action MessageHappyHour(Handle timer)
{
if(g_bHappyHour)
{
CPrintToChatAll("{cyan}[UNLOZE] {red}Happy Hour {cyan}is currently active! Everyone gets 50%% Bonus on most rank points!");
char sBuffer[sizeof(g_sHostName)];
Format(sBuffer, sizeof(sBuffer), "[HappyHour] %s", g_sHostName);
g_cvHostName.SetString(sBuffer);
}
else
{
g_cvHostName.SetString(g_sHostName);
}
return Plugin_Continue;
}