#define VIP_FEATURE_NAME "YOUR_FEATURE_ALIAS" // change it into unique alias and place it in vip groups.ini file #define CVAR_FLAGS FCVAR_NOTIFY
public Plugin myinfo = { name = "VIP Core (by R1KO) optional implementation template example", author = "Alex Dragokas", description = "Provides a snippet to check whether current player has a VIP feature enabled considering all the access checks.", version = PLUGIN_VERSION, url = "https://forums.alliedmods.net/member.php?u=282667" };
bool g_bLateload, g_bVipFeatureEnabled[MAXPLAYERS+1]; // g_bVipFeatureEnabled is a final variable telling you whether client has access to a feature.
#if defined _vip_core_included bool g_bVipAvail; #else #pragma unused g_bLateload #endif
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max) { g_bLateload = late; return APLRes_Success; }
public void OnPluginStart() { LoadTranslations("vip_sample.phrases"); // you must provide appropriate translations for "VIP_Feature_Title"
RegConsoleCmd("sm_check", CmdCheck, "Answers are VIP feature enabled for you");
"Phrases"
{
"Enabled"
{
"en" "Enabled"
"ru" "Включено"
}
"Disabled"
{
"en" "Disabled"
"ru" "Выключено"
}
"VIP_Feature_Title"
{
"en" "Title of your test feature"
"ru" "Заголовок тестовой фичи"
}
}
Installation:
- Install VIP Core by R1KO: https://github.com/R1KO/VIP-Core
- Compile the sample plugin (Note: vip_core.inc file must be located in "include" dir of your local compiler in order to make the plugin be a module of VIP Core.
- Specify line:
Code:
"YOUR_FEATURE_ALIAS" "1"
in the file /addons/sourcemod/data/vip/cfg/groups.ini for the appropriate VIP Group.
- Enter in console sm_reload_vip_cfg or reboot the server.
Internal VIP commands:
PHP Code:
!vip // opens a VIP Core menu to select/unselect your favorite VIP features.
// e.t.c., read VIP own's documentation in the inc file.
Sample commands:
PHP Code:
!check // Answers, are VIP feature enabled for you, considering all the access checks and your preferables.