Skip to content

Commit

Permalink
Fix GameCMS limits
Browse files Browse the repository at this point in the history
  • Loading branch information
ArKaNeMaN committed Mar 14, 2023
1 parent b9e75aa commit 85c4b9b
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions amxmodx/scripting/VipM-L-GameCMS.sma
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
#include <gamecms5>
#include "VipM/Utils"

#if !defined GCMS_GROUP_NAME_MAX_LEN
#define GCMS_GROUP_NAME_MAX_LEN (MAX_NAME_LENGTH * 2)
#endif

#pragma semicolon 1
#pragma compress 1

Expand All @@ -12,7 +16,7 @@ public stock const PluginAuthor[] = "ArKaNeMaN";
public stock const PluginURL[] = _VIPM_PLUGIN_URL;
public stock const PluginDescription[] = "[VipModular] Access by GameCMS services";

public VipM_OnInitModules(){
public VipM_OnInitModules() {
RegisterPluginByVars();

VipM_Limits_RegisterType("GCMS-Service", true, false);
Expand All @@ -28,25 +32,25 @@ public VipM_OnInitModules(){
VipM_Limits_RegisterTypeEvent("GCMS-Member", Limit_OnCheck, "@OnMemberCheck");
}

@OnMemberCheck(const Trie:Params, const UserId){
new sGroupName[64];
new iGroupId = cmsapi_get_user_group(UserId, sGroupName, charsmax(sGroupName));
@OnMemberCheck(const Trie:Params, const UserId) {
new sUserGroupName[GCMS_GROUP_NAME_MAX_LEN];
new iGroupId = cmsapi_get_user_group(UserId, sUserGroupName, charsmax(sUserGroupName));
if (!iGroupId) {
return false;
}

new spGroupName[64];
new sGroupName[GCMS_GROUP_NAME_MAX_LEN];
VipM_Params_GetStr(Params, "Group", sGroupName, charsmax(sGroupName));
if (!sGroupName[0]) {
return true;
}

return equali(sGroupName, spGroupName);
return equali(sUserGroupName, sGroupName);
}

@OnServiceCheck(const Trie:Params, const UserId){
new Service[32];
TrieGetString(Params, "Service", Service, charsmax(Service));
@OnServiceCheck(const Trie:Params, const UserId) {
new sServiceName[32];
VipM_Params_GetStr(Params, "Service", sServiceName, charsmax(sServiceName));

return (cmsapi_get_user_services(UserId, "", Service) != Invalid_Array);
return cmsapi_service_timeleft(UserId, .srvName=sServiceName, .part=false) > TIME_TRACKING_STOPPED;
}

0 comments on commit 85c4b9b

Please sign in to comment.