Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion addons/sourcemod/scripting/VIP_Core.sp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <clientprefs>

#if !defined VIP_VERSION
#define VIP_VERSION "3.1.4 R"
#define VIP_VERSION "3.1.5 R"
#endif


Expand Down
50 changes: 25 additions & 25 deletions addons/sourcemod/scripting/vip/API.sp
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -1033,7 +1033,7 @@ public int Native_SetClientFeatureStatus(Handle hPlugin, int iNumParams)
if (iNumParams > 4 && GetNativeCell(5))
{
IntToString(view_as<int>(eNewStatus), SZF(szFeature));
SetClientCookie(iClient, view_as<Handle>(GetArrayCell(hArray, FEATURES_COOKIE)), szFeature);
view_as<Cookie>(hArray.Get(FEATURES_COOKIE)).Set(iClient, szFeature);
}
return true;
}
Expand Down
12 changes: 6 additions & 6 deletions addons/sourcemod/scripting/vip/Clients.sp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -373,9 +373,9 @@ void Clients_LoadFeature(int iClient, const char[] szFeature)
if (view_as<VIP_FeatureType>(hArray.Get(FEATURES_ITEM_TYPE)) == TOGGLABLE)
{
static char szBuffer[4];
static Handle hCookie;
hCookie = view_as<Handle>(hArray.Get(FEATURES_COOKIE));
GetClientCookie(iClient, hCookie, SZF(szBuffer));
static Cookie hCookie;
hCookie = view_as<Cookie>(hArray.Get(FEATURES_COOKIE));
hCookie.Get(iClient, SZF(szBuffer));
eStatus = view_as<VIP_ToggleState>(StringToInt(szBuffer));
DBG_Clients("GetFeatureCookie: '%s'", szBuffer);
if (szBuffer[0] == '\0' || !Features_IsValidStatus(eStatus))
Expand All @@ -388,7 +388,7 @@ void Clients_LoadFeature(int iClient, const char[] szFeature)
}

IntToString(view_as<int>(eStatus), SZF(szBuffer));
SetClientCookie(iClient, hCookie, szBuffer);
hCookie.Set(iClient, szBuffer);
// Features_SaveStatus(iClient, szFeature, hCookie, eStatus);
}
}
Expand Down
2 changes: 0 additions & 2 deletions addons/sourcemod/scripting/vip/Configs.sp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ void ReadSortingMenu()
if (g_hSortArray != null)
{
delete g_hSortArray;
g_hSortArray = null;
}

char szFeature[PMP];
Expand Down Expand Up @@ -77,7 +76,6 @@ void ReadSortingMenu()
if (g_hSortArray.Length == 0)
{
delete g_hSortArray;
g_hSortArray = null;
}
}

Expand Down
4 changes: 2 additions & 2 deletions addons/sourcemod/scripting/vip/Features.sp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion addons/sourcemod/scripting/vip/Info.sp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion addons/sourcemod/scripting/vip/UTIL.sp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ void UTIL_CloseHandleEx(Handle &hValue)
if (hValue != null)
{
delete hValue;
hValue = null;
}
}

Expand Down
2 changes: 1 addition & 1 deletion addons/sourcemod/scripting/vip/VipMenu.sp
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ public int Handler_VIPMenu(Menu hMenu, MenuAction action, int iClient, int iOpti
{
Features_SetStatus(iClient, szItemInfo, eNewStatus);
IntToString(view_as<int>(eNewStatus), SZF(szBuffer));
SetClientCookie(iClient, view_as<Handle>(GetArrayCell(hBuffer, FEATURES_COOKIE)), szBuffer);
view_as<Cookie>(hBuffer.Get(FEATURES_COOKIE)).Set(iClient, szBuffer);
}
}

Expand Down
2 changes: 1 addition & 1 deletion addons/sourcemod/scripting/vip/adminmenu/Del.sp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading