AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   VIP Core (by R1KO) module implementation sample (https://forums.alliedmods.net/showthread.php?t=335597)

Dragokas 12-17-2021 04:37

VIP Core (by R1KO) module implementation sample
 
1 Attachment(s)
Somebody asked me to show a minimal but fully safe example of template to implement VIP Core by R1KO to any custom plugin to become a module of it.

So, here it is.

Features:
  • VIP Core is fully optional (you can compile with or without vip_core.inc).
  • Safely tracking dynamic Core library loading/unloading.
  • Tracking VIP Player loading/unloading/adding/removing.
  • Supports listening for VIP internal "sm_reload_vip_cfg" command to populate data according to contents of groups.ini file.
  • Translation support.

Spoiler



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. 

Good luck!

thewintersoldier97 12-17-2021 10:56

Re: VIP Core (by R1KO) module implementation sample
 
Thank you! I will absolutely need a lot of luck now to try and implement some module lol :D

BDuck 09-05-2022 05:55

Re: VIP Core (by R1KO) module implementation sample
 
do you also know how to implement VIP with the plugin that already using flag like
https://forums.alliedmods.net/showthread.php?p=1721580
or
https://forums.alliedmods.net/showthread.php?p=2640836

Dragokas 09-05-2022 11:19

Re: VIP Core (by R1KO) module implementation sample
 
Same way.

Code:

g_bVipFeatureEnabled[MAXPLAYERS+1]; // g_bVipFeatureEnabled is a final variable telling you whether client has access to a feature.
or if you don't care if player enabled feature or not:
Code:

if (VIP_IsClientVIP(client)) {...}

Grey83 09-06-2022 06:20

Re: VIP Core (by R1KO) module implementation sample
 
PHP Code:

void UpdatePlayerFeatureVIP(int client)
{
    if( 
g_bVipAvail )
    {
        if( 
VIP_IsClientVIP(client) )
        {
            
g_bVipFeatureEnabled[client] = VIP_IsClientFeatureUse(clientVIP_FEATURE_NAME);
        }
        else {
            
g_bVipFeatureEnabled[client] = false;
        }
    }


equals to this
PHP Code:

void UpdatePlayerFeatureVIP(int client)
{
    
g_bVipFeatureEnabled[client] = g_bVipAvail && VIP_IsClientVIP(client) && VIP_IsClientFeatureUse(clientVIP_FEATURE_NAME)




All times are GMT -4. The time now is 01:29.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.