HappyHour: Neon wants methods

This commit is contained in:
Dogan 2019-06-06 01:05:55 +02:00
parent 6891b469bc
commit cbd705650a

View File

@ -41,20 +41,19 @@ public void OnPluginStart()
ConVar cvar; ConVar cvar;
HookConVarChange((cvar = CreateConVar("sm_happyhour_morning_start", "1000", "starttime of happy hour in the morning (timezone UTC+1 in summer, UTC+2 in winter)")), g_cvMorningStart); HookConVarChange((cvar = CreateConVar("sm_happyhour_morning_start", "1000", "starttime of happy hour in the morning (timezone UTC+1 in summer, UTC+2 in winter)")), g_cvMorningStart);
g_iMorningStart = GetConVarInt(cvar); g_iMorningStart = cvar.IntValue;
HookConVarChange((cvar = CreateConVar("sm_happyhour_morning_end", "1400", "endtime of happy hour in the morning/afternoon (timezone UTC+1 in summer, UTC+2 in winter)")), g_cvMorningEnd); HookConVarChange((cvar = CreateConVar("sm_happyhour_morning_end", "1400", "endtime of happy hour in the morning/afternoon (timezone UTC+1 in summer, UTC+2 in winter)")), g_cvMorningEnd);
g_iMorningStart = GetConVarInt(cvar); g_iMorningEnd = cvar.IntValue;
HookConVarChange((cvar = CreateConVar("sm_happyhour_night_start", "2300", "starttime of happy hour in the night (timezone UTC+1 in summer, UTC+2 in winter)")), g_cvNightStart); HookConVarChange((cvar = CreateConVar("sm_happyhour_night_start", "2300", "starttime of happy hour in the night (timezone UTC+1 in summer, UTC+2 in winter)")), g_cvNightStart);
g_iNightStart = GetConVarInt(cvar); g_iNightStart = cvar.IntValue;
HookConVarChange((cvar = CreateConVar("sm_happyhour_night_end", "0300", "endtime of happy hour in the night (timezone UTC+1 in summer, UTC+2 in winter)")), g_cvNightEnd); HookConVarChange((cvar = CreateConVar("sm_happyhour_night_end", "0300", "endtime of happy hour in the night (timezone UTC+1 in summer, UTC+2 in winter)")), g_cvNightEnd);
g_iNightEnd = GetConVarInt(cvar); g_iNightEnd = cvar.IntValue;
HookConVarChange((cvar = CreateConVar("sm_happyhour_message_interval", "60.0", "interval for repetetive message of happy hour in chat")), g_cvMessageTimer); HookConVarChange((cvar = CreateConVar("sm_happyhour_message_interval", "60.0", "interval for repetetive message of happy hour in chat")), g_cvMessageTimer);
g_fMessageTimer = GetConVarFloat(cvar); g_fMessageTimer = cvar.FloatValue;
CloseHandle(cvar); CloseHandle(cvar);
RegConsoleCmd("sm_hh", Command_DisplayHappyHour, "Shows if happy hour is currently enabled or not"); RegConsoleCmd("sm_hh", Command_DisplayHappyHour, "Shows if happy hour is currently enabled or not");
@ -66,27 +65,27 @@ public void OnPluginStart()
public void g_cvMorningStart(ConVar convar, const char[] oldValue, const char[] newValue) public void g_cvMorningStart(ConVar convar, const char[] oldValue, const char[] newValue)
{ {
g_iMorningStart = GetConVarInt(convar); g_iMorningStart = convar.IntValue;
} }
public void g_cvMorningEnd(ConVar convar, const char[] oldValue, const char[] newValue) public void g_cvMorningEnd(ConVar convar, const char[] oldValue, const char[] newValue)
{ {
g_iMorningEnd = GetConVarInt(convar); g_iMorningEnd = convar.IntValue;
} }
public void g_cvNightStart(ConVar convar, const char[] oldValue, const char[] newValue) public void g_cvNightStart(ConVar convar, const char[] oldValue, const char[] newValue)
{ {
g_iNightStart = GetConVarInt(convar); g_iNightStart = convar.IntValue;
} }
public void g_cvNightEnd(ConVar convar, const char[] oldValue, const char[] newValue) public void g_cvNightEnd(ConVar convar, const char[] oldValue, const char[] newValue)
{ {
g_iNightEnd = GetConVarInt(convar); g_iNightEnd = convar.IntValue;
} }
public void g_cvMessageTimer(ConVar convar, const char[] oldValue, const char[] newValue) public void g_cvMessageTimer(ConVar convar, const char[] oldValue, const char[] newValue)
{ {
g_fMessageTimer = GetConVarFloat(convar); g_fMessageTimer = convar.FloatValue;
if (g_h_MessageTimer != INVALID_HANDLE && CloseHandle(g_h_MessageTimer)) if (g_h_MessageTimer != INVALID_HANDLE && CloseHandle(g_h_MessageTimer))
g_h_MessageTimer = INVALID_HANDLE; g_h_MessageTimer = INVALID_HANDLE;