diff --git a/addons/sourcemod/scripting/VIP_Core.sp b/addons/sourcemod/scripting/VIP_Core.sp index c0d7f85..f219e6c 100644 --- a/addons/sourcemod/scripting/VIP_Core.sp +++ b/addons/sourcemod/scripting/VIP_Core.sp @@ -7,7 +7,7 @@ #include #if !defined VIP_VERSION -#define VIP_VERSION "3.1.4 R" +#define VIP_VERSION "3.1.5 R" #endif diff --git a/addons/sourcemod/scripting/vip/API.sp b/addons/sourcemod/scripting/vip/API.sp index f48c36b..ab74334 100644 --- a/addons/sourcemod/scripting/vip/API.sp +++ b/addons/sourcemod/scripting/vip/API.sp @@ -1,31 +1,31 @@ -static Handle g_hGlobalForward_OnVIPLoaded; +static GlobalForward g_hGlobalForward_OnVIPLoaded; static Handle g_hGlobalForward_OnClientPreLoad; -static Handle g_hGlobalForward_OnClientLoaded; -static Handle g_hGlobalForward_OnVIPClientLoaded; -static Handle g_hGlobalForward_OnVIPClientAdded; -static Handle g_hGlobalForward_OnVIPClientRemoved; -static Handle g_hGlobalForward_OnPlayerSpawn; -static Handle g_hGlobalForward_OnShowClientInfo; -static Handle g_hGlobalForward_OnFeatureToggle; -static Handle g_hGlobalForward_OnFeatureRegistered; -static Handle g_hGlobalForward_OnFeatureUnregistered; -static Handle g_hGlobalForward_OnClientDisconnect; +static GlobalForward g_hGlobalForward_OnClientLoaded; +static GlobalForward g_hGlobalForward_OnVIPClientLoaded; +static GlobalForward g_hGlobalForward_OnVIPClientAdded; +static GlobalForward g_hGlobalForward_OnVIPClientRemoved; +static GlobalForward g_hGlobalForward_OnPlayerSpawn; +static GlobalForward g_hGlobalForward_OnShowClientInfo; +static GlobalForward g_hGlobalForward_OnFeatureToggle; +static GlobalForward g_hGlobalForward_OnFeatureRegistered; +static GlobalForward g_hGlobalForward_OnFeatureUnregistered; +static GlobalForward g_hGlobalForward_OnClientDisconnect; void API_SetupForwards() { // Global Forwards - g_hGlobalForward_OnClientPreLoad = CreateGlobalForward("VIP_OnClientPreLoad", ET_Hook, Param_Cell); - g_hGlobalForward_OnVIPLoaded = CreateGlobalForward("VIP_OnVIPLoaded", ET_Ignore); - g_hGlobalForward_OnClientLoaded = CreateGlobalForward("VIP_OnClientLoaded", ET_Ignore, Param_Cell, Param_Cell); - g_hGlobalForward_OnVIPClientLoaded = CreateGlobalForward("VIP_OnVIPClientLoaded", ET_Ignore, Param_Cell); - g_hGlobalForward_OnVIPClientAdded = CreateGlobalForward("VIP_OnVIPClientAdded", ET_Ignore, Param_Cell, Param_Cell); - g_hGlobalForward_OnVIPClientRemoved = CreateGlobalForward("VIP_OnVIPClientRemoved", ET_Ignore, Param_Cell, Param_String, Param_Cell); - g_hGlobalForward_OnPlayerSpawn = CreateGlobalForward("VIP_OnPlayerSpawn", ET_Ignore, Param_Cell, Param_Cell, Param_Cell); - g_hGlobalForward_OnShowClientInfo = CreateGlobalForward("VIP_OnShowClientInfo", ET_Hook, Param_Cell, Param_String, Param_String, Param_Cell); - g_hGlobalForward_OnFeatureToggle = CreateGlobalForward("VIP_OnFeatureToggle", ET_Hook, Param_Cell, Param_String, Param_Cell, Param_CellByRef); - g_hGlobalForward_OnFeatureRegistered = CreateGlobalForward("VIP_OnFeatureRegistered", ET_Ignore, Param_String); - g_hGlobalForward_OnFeatureUnregistered = CreateGlobalForward("VIP_OnFeatureUnregistered", ET_Ignore, Param_String); - g_hGlobalForward_OnClientDisconnect = CreateGlobalForward("VIP_OnClientDisconnect", ET_Ignore, Param_Cell, Param_Cell); + g_hGlobalForward_OnClientPreLoad = new GlobalForward("VIP_OnClientPreLoad", ET_Hook, Param_Cell); + g_hGlobalForward_OnVIPLoaded = new GlobalForward("VIP_OnVIPLoaded", ET_Ignore); + g_hGlobalForward_OnClientLoaded = new GlobalForward("VIP_OnClientLoaded", ET_Ignore, Param_Cell, Param_Cell); + g_hGlobalForward_OnVIPClientLoaded = new GlobalForward("VIP_OnVIPClientLoaded", ET_Ignore, Param_Cell); + g_hGlobalForward_OnVIPClientAdded = new GlobalForward("VIP_OnVIPClientAdded", ET_Ignore, Param_Cell, Param_Cell); + g_hGlobalForward_OnVIPClientRemoved = new GlobalForward("VIP_OnVIPClientRemoved", ET_Ignore, Param_Cell, Param_String, Param_Cell); + g_hGlobalForward_OnPlayerSpawn = new GlobalForward("VIP_OnPlayerSpawn", ET_Ignore, Param_Cell, Param_Cell, Param_Cell); + g_hGlobalForward_OnShowClientInfo = new GlobalForward("VIP_OnShowClientInfo", ET_Hook, Param_Cell, Param_String, Param_String, Param_Cell); + g_hGlobalForward_OnFeatureToggle = new GlobalForward("VIP_OnFeatureToggle", ET_Hook, Param_Cell, Param_String, Param_Cell, Param_CellByRef); + g_hGlobalForward_OnFeatureRegistered = new GlobalForward("VIP_OnFeatureRegistered", ET_Ignore, Param_String); + g_hGlobalForward_OnFeatureUnregistered = new GlobalForward("VIP_OnFeatureUnregistered", ET_Ignore, Param_String); + g_hGlobalForward_OnClientDisconnect = new GlobalForward("VIP_OnClientDisconnect", ET_Ignore, Param_Cell, Param_Cell); } // Global Forwards @@ -771,7 +771,7 @@ public int Native_RegisterFeature(Handle hPlugin, int iNumParams) bool bRegisterCookie = (eType == SELECTABLE && iNumParams > 7 && (bCookie != false)); if (eType == TOGGLABLE || bRegisterCookie) { - hCookie = RegClientCookie(szFeature, szFeature, CookieAccess_Private); + hCookie = new Cookie(szFeature, szFeature, CookieAccess_Private); } hArray.Push(hCookie); @@ -1033,7 +1033,7 @@ public int Native_SetClientFeatureStatus(Handle hPlugin, int iNumParams) if (iNumParams > 4 && GetNativeCell(5)) { IntToString(view_as(eNewStatus), SZF(szFeature)); - SetClientCookie(iClient, view_as(GetArrayCell(hArray, FEATURES_COOKIE)), szFeature); + view_as(hArray.Get(FEATURES_COOKIE)).Set(iClient, szFeature); } return true; } diff --git a/addons/sourcemod/scripting/vip/Clients.sp b/addons/sourcemod/scripting/vip/Clients.sp index d5825e4..f793eb9 100644 --- a/addons/sourcemod/scripting/vip/Clients.sp +++ b/addons/sourcemod/scripting/vip/Clients.sp @@ -238,8 +238,8 @@ void Clients_CreateClientVIPSettings(int iClient, int iExp) g_hFeatures[iClient] = new StringMap(); g_hFeatureStatus[iClient] = new StringMap(); */ - g_hFeatures[iClient] = CreateTrie(); - g_hFeatureStatus[iClient] = CreateTrie(); + g_hFeatures[iClient] = new StringMap(); + g_hFeatureStatus[iClient] = new StringMap(); g_hFeatures[iClient].SetValue(KEY_EXPIRES, iExp); } @@ -373,9 +373,9 @@ void Clients_LoadFeature(int iClient, const char[] szFeature) if (view_as(hArray.Get(FEATURES_ITEM_TYPE)) == TOGGLABLE) { static char szBuffer[4]; - static Handle hCookie; - hCookie = view_as(hArray.Get(FEATURES_COOKIE)); - GetClientCookie(iClient, hCookie, SZF(szBuffer)); + static Cookie hCookie; + hCookie = view_as(hArray.Get(FEATURES_COOKIE)); + hCookie.Get(iClient, SZF(szBuffer)); eStatus = view_as(StringToInt(szBuffer)); DBG_Clients("GetFeatureCookie: '%s'", szBuffer); if (szBuffer[0] == '\0' || !Features_IsValidStatus(eStatus)) @@ -388,7 +388,7 @@ void Clients_LoadFeature(int iClient, const char[] szFeature) } IntToString(view_as(eStatus), SZF(szBuffer)); - SetClientCookie(iClient, hCookie, szBuffer); + hCookie.Set(iClient, szBuffer); // Features_SaveStatus(iClient, szFeature, hCookie, eStatus); } } diff --git a/addons/sourcemod/scripting/vip/Configs.sp b/addons/sourcemod/scripting/vip/Configs.sp index cd5808e..1a4cfe5 100644 --- a/addons/sourcemod/scripting/vip/Configs.sp +++ b/addons/sourcemod/scripting/vip/Configs.sp @@ -48,7 +48,6 @@ void ReadSortingMenu() if (g_hSortArray != null) { delete g_hSortArray; - g_hSortArray = null; } char szFeature[PMP]; @@ -77,7 +76,6 @@ void ReadSortingMenu() if (g_hSortArray.Length == 0) { delete g_hSortArray; - g_hSortArray = null; } } diff --git a/addons/sourcemod/scripting/vip/Features.sp b/addons/sourcemod/scripting/vip/Features.sp index 8d7bb56..6b72a14 100644 --- a/addons/sourcemod/scripting/vip/Features.sp +++ b/addons/sourcemod/scripting/vip/Features.sp @@ -47,7 +47,7 @@ void Features_TurnOnAll(int iClient) for(int i = 0; i < iFeatures; ++i) { - GetArrayString(g_hFeaturesArray, i, SZF(szFeature)); + g_hFeaturesArray.GetString(i, SZF(szFeature)); if(!GLOBAL_TRIE.GetValue(szFeature, hArray)) continue; @@ -71,7 +71,7 @@ void Features_TurnOnAll(int iClient) void Features_SetStatus(int iClient, const char[] szFeature, VIP_ToggleState eStatus) { DebugMessage("Features_SetStatus: %N (%i) -> Feature: %s, eStatus: %i", iClient, iClient, szFeature, eStatus); - SetTrieValue(g_hFeatureStatus[iClient], szFeature, eStatus); + g_hFeatureStatus[iClient].SetValue(szFeature, eStatus); } VIP_ToggleState Features_GetStatus(const int &iClient, const char[] szFeature) diff --git a/addons/sourcemod/scripting/vip/Info.sp b/addons/sourcemod/scripting/vip/Info.sp index f87d7b4..61f8601 100644 --- a/addons/sourcemod/scripting/vip/Info.sp +++ b/addons/sourcemod/scripting/vip/Info.sp @@ -29,7 +29,7 @@ void DisplayInfo(int iClient, const char[] szEvent, const char[] szType, char[] if (g_hInfo.JumpToKey(szEvent) && g_hInfo.JumpToKey(szType)) { KeyValues hKeyValues = new KeyValues(szType); - KvCopySubkeys(g_hInfo, hKeyValues); + hKeyValues.Import(g_hInfo); switch(CreateForward_OnShowClientInfo(iClient, szEvent, szType, hKeyValues)) { case Plugin_Stop, Plugin_Handled: diff --git a/addons/sourcemod/scripting/vip/UTIL.sp b/addons/sourcemod/scripting/vip/UTIL.sp index 6e760b7..54a4e95 100644 --- a/addons/sourcemod/scripting/vip/UTIL.sp +++ b/addons/sourcemod/scripting/vip/UTIL.sp @@ -22,7 +22,6 @@ void UTIL_CloseHandleEx(Handle &hValue) if (hValue != null) { delete hValue; - hValue = null; } } diff --git a/addons/sourcemod/scripting/vip/VipMenu.sp b/addons/sourcemod/scripting/vip/VipMenu.sp index 58b0a74..adde137 100644 --- a/addons/sourcemod/scripting/vip/VipMenu.sp +++ b/addons/sourcemod/scripting/vip/VipMenu.sp @@ -299,7 +299,7 @@ public int Handler_VIPMenu(Menu hMenu, MenuAction action, int iClient, int iOpti { Features_SetStatus(iClient, szItemInfo, eNewStatus); IntToString(view_as(eNewStatus), SZF(szBuffer)); - SetClientCookie(iClient, view_as(GetArrayCell(hBuffer, FEATURES_COOKIE)), szBuffer); + view_as(hBuffer.Get(FEATURES_COOKIE)).Set(iClient, szBuffer); } } diff --git a/addons/sourcemod/scripting/vip/adminmenu/Del.sp b/addons/sourcemod/scripting/vip/adminmenu/Del.sp index a14d946..8527e5d 100644 --- a/addons/sourcemod/scripting/vip/adminmenu/Del.sp +++ b/addons/sourcemod/scripting/vip/adminmenu/Del.sp @@ -21,7 +21,7 @@ public int MenuHandler_DeleteVipPlayerMenu(Menu hMenu, MenuAction action, int iC { switch (action) { - case MenuAction_End: CloseHandle(hMenu); + case MenuAction_End: delete hMenu; case MenuAction_Cancel: { if (iItem == MenuCancel_ExitBack) ShowTargetInfoMenu(iClient);