View Single Post
Author Message
ozrich
AlliedModders Donor
Join Date: Oct 2015
Old 03-14-2019 , 23:18   Help with plugin not using correct time
Reply With Quote #1

Hey,

I have a plugin to shutdown the server, however, it's shutting down at the wrong time. The relevant code is below. Do I need to perhaps get the timezone first?

PHP Code:
public OnPluginStart() {
    
PrintToServer("ScheduledShutdown loaded successfully.");
    
CreateConVar("sm_scheduledshutdown_version"PL_VERSION"ScheduledShutdown version."FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
    
g_hEnabledHintCreateConVar("sm_scheduledshutdown_hintsay""1""Sets whether messages are shown in the hint area");
    
g_hEnabledChatCreateConVar("sm_scheduledshutdown_chatsay""1""Sets whether messages are shown in chat");
    
g_hEnabledCenter CreateConVar("sm_scheduledshutdown_centersay""1""Sets whether messages are shown in the center of the screen");
    
g_hEnabled CreateConVar("sm_scheduledshutdown""1""Enable ScheduledShutdown."FCVAR_PLUGIN);
    
g_hTime CreateConVar("sm_scheduledshutdown_time""0600""Time to shutdown server."FCVAR_PLUGIN);
    
HookConVarChange(g_hEnabledCvar_enabled);
    
HookConVarChange(g_hTimeCvar_time);
}
public 
OnMapStart() {
    
CreateTimer(60.0CheckTime0TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
}
public 
OnConfigsExecuted() {
    
g_bEnabled GetConVarBool(g_hEnabled);
    
decl String:iTime[8];
    
GetConVarString(g_hTimeiTimesizeof(iTime));
    
g_iTime StringToInt(iTime);
}
public 
Cvar_enabled(Handle:convar, const String:oldValue[], const String:newValue[]) {
    
g_bEnabled GetConVarBool(g_hEnabled);
}
public 
Cvar_time(Handle:convar, const String:oldValue[], const String:newValue[]) {
    
decl String:iTime[8];
    
GetConVarString(g_hTimeiTimesizeof(iTime));
    
g_iTime StringToInt(iTime);

__________________
ozrich is offline