From f403485b38ea7a612488f671ae17556cd1d3c137 Mon Sep 17 00:00:00 2001 From: Greyscale Date: Mon, 15 Jun 2009 20:57:40 -0700 Subject: [PATCH] Fixed error in zmarket caused by disconnection twice before the client was put in game (rapid map changing), fixed sky not disabling properly. --- src/zr/visualeffects/visualambience.inc | 11 ++++++++--- src/zr/weapons/zmarket.inc | 7 ++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/zr/visualeffects/visualambience.inc b/src/zr/visualeffects/visualambience.inc index 56152e4..1594fd4 100644 --- a/src/zr/visualeffects/visualambience.inc +++ b/src/zr/visualeffects/visualambience.inc @@ -35,9 +35,6 @@ new String:g_VAmbienceDefaultSky[PLATFORM_MAX_PATH]; */ VAmbienceLoad() { - // Apply all visual effects now - VAmbienceApplyAll(); - // Find map's default sky. new Handle:hSkyname = FindConVar("sv_skyname"); if (hSkyname != INVALID_HANDLE) @@ -45,6 +42,13 @@ VAmbienceLoad() // Store map's default sky before applying new one. GetConVarString(hSkyname, g_VAmbienceDefaultSky, sizeof(g_VAmbienceDefaultSky)); } + else + { + LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_VEffects, "Sky Caching", "Couldn't find handle to cvar: \"sv_skyname\""); + } + + // Apply all visual effects now + VAmbienceApplyAll(); // If sky is disabled, then stop. new bool:sky = GetConVarBool(g_hCvarsList[CVAR_VEFFECTS_SKY]); @@ -246,6 +250,7 @@ VAmbienceApplySky(bool:disable = false) // If default, then set to default sky. if (disable) { + PrintToServer("+===============+++++ %s", g_VAmbienceDefaultSky); if (g_VAmbienceDefaultSky[0]) { SetConVarString(hSkyname, g_VAmbienceDefaultSky, true); diff --git a/src/zr/weapons/zmarket.inc b/src/zr/weapons/zmarket.inc index b227aa4..c772d28 100644 --- a/src/zr/weapons/zmarket.inc +++ b/src/zr/weapons/zmarket.inc @@ -114,7 +114,12 @@ ZMarketClientInit(client) ZMarketOnClientDisconnect(client) { // Destroy ZMarket array data for client. - CloseHandle(g_hZMarketPurchaseCount[client]); + if (g_hZMarketPurchaseCount[client] != INVALID_HANDLE) + { + CloseHandle(g_hZMarketPurchaseCount[client]); + } + + // Reset handle. g_hZMarketPurchaseCount[client] = INVALID_HANDLE; }