remade sql statement for altering table to just run every 10 seconds
This commit is contained in:
		
							parent
							
								
									2c55476ea3
								
							
						
					
					
						commit
						43cb66b2d8
					
				@ -37,6 +37,7 @@ Database g_dDatabase;
 | 
				
			|||||||
Handle hText;
 | 
					Handle hText;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int player_stage[MAXPLAYERS + 1];
 | 
					int player_stage[MAXPLAYERS + 1];
 | 
				
			||||||
 | 
					Handle g_hAlterTableTimer = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public Plugin myinfo = 
 | 
					public Plugin myinfo = 
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@ -66,6 +67,8 @@ public void OnPluginStart()
 | 
				
			|||||||
    HookEntityOutput("trigger_teleport", "OnStartTouch", trigger_teleport);
 | 
					    HookEntityOutput("trigger_teleport", "OnStartTouch", trigger_teleport);
 | 
				
			||||||
    //HUD
 | 
					    //HUD
 | 
				
			||||||
    hText = CreateHudSynchronizer();
 | 
					    hText = CreateHudSynchronizer();
 | 
				
			||||||
 | 
					    //Just constantly reruns the alter table query to handle new zones, less lazy solution would just be adding a forward for when zones were renamed
 | 
				
			||||||
 | 
					    g_hAlterTableTimer = CreateTimer(10.00, Timer_alter_tables, _, TIMER_REPEAT);
 | 
				
			||||||
    //cookies
 | 
					    //cookies
 | 
				
			||||||
    g_hClientCookie = RegClientCookie("hide_timer_cookie", "Hides the timer HUD", CookieAccess_Private);
 | 
					    g_hClientCookie = RegClientCookie("hide_timer_cookie", "Hides the timer HUD", CookieAccess_Private);
 | 
				
			||||||
    for (int i = MaxClients; i > 0; --i)
 | 
					    for (int i = MaxClients; i > 0; --i)
 | 
				
			||||||
@ -77,6 +80,18 @@ public void OnPluginStart()
 | 
				
			|||||||
    g_bDisplaySpecial = unloze_gBSpecialMapDisplay();
 | 
					    g_bDisplaySpecial = unloze_gBSpecialMapDisplay();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public Action Timer_alter_tables(Handle hTimer)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    if (!g_dDatabase)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        Database.Connect(SQL_OnDatabaseConnect, "racetimercss");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        startTimer();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public void trigger_teleport(const char[] output, int entity_index, int client, float delay)
 | 
					public void trigger_teleport(const char[] output, int entity_index, int client, float delay)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (IsValidEdict(entity_index) && IsValidClient(client) && g_bHumansAllowedTime[client])
 | 
					    if (IsValidEdict(entity_index) && IsValidClient(client) && g_bHumansAllowedTime[client])
 | 
				
			||||||
@ -230,7 +245,6 @@ public void OnMapStart()
 | 
				
			|||||||
            g_bEventBool = false;
 | 
					            g_bEventBool = false;
 | 
				
			||||||
        g_bDisplaySpecial = unloze_gBSpecialMapDisplay();
 | 
					        g_bDisplaySpecial = unloze_gBSpecialMapDisplay();
 | 
				
			||||||
        GetCurrentMap(g_cMapname, sizeof(g_cMapname));
 | 
					        GetCurrentMap(g_cMapname, sizeof(g_cMapname));
 | 
				
			||||||
        startTimer();
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    Format(g_cSpecialMapStart, sizeof(g_cSpecialMapStart), "");
 | 
					    Format(g_cSpecialMapStart, sizeof(g_cSpecialMapStart), "");
 | 
				
			||||||
    Format(g_cSpecialMapEnd, sizeof(g_cSpecialMapEnd), "");
 | 
					    Format(g_cSpecialMapEnd, sizeof(g_cSpecialMapEnd), "");
 | 
				
			||||||
@ -242,6 +256,8 @@ public void OnMapStart()
 | 
				
			|||||||
public void OnPluginEnd()
 | 
					public void OnPluginEnd()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    CloseHandle(hText);
 | 
					    CloseHandle(hText);
 | 
				
			||||||
 | 
					    if (g_hAlterTableTimer != null)
 | 
				
			||||||
 | 
					        delete g_hAlterTableTimer;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
//----------------------------------------------------------------------------------------------------
 | 
					//----------------------------------------------------------------------------------------------------
 | 
				
			||||||
// Purpose: 
 | 
					// Purpose: 
 | 
				
			||||||
@ -561,13 +577,6 @@ public void unloze_zoneLeave(int client, char[] zone)
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//----------------------------------------------------------------------------------------------------
 | 
					 | 
				
			||||||
// Purpose:
 | 
					 | 
				
			||||||
//----------------------------------------------------------------------------------------------------
 | 
					 | 
				
			||||||
public void unloze_zoneCreated()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	startTimer();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
//----------------------------------------------------------------------------------------------------
 | 
					//----------------------------------------------------------------------------------------------------
 | 
				
			||||||
// Purpose: 
 | 
					// Purpose: 
 | 
				
			||||||
//----------------------------------------------------------------------------------------------------
 | 
					//----------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user