Raised This Month: $32 Target: $400
 8% 

VIP Core (by R1KO) module implementation sample


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 12-17-2021 , 04:37   VIP Core (by R1KO) module implementation sample
Reply With Quote #1

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!
Attached Files
File Type: zip vip_impl_sample.zip (6.4 KB, 195 views)
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]

Last edited by Dragokas; 12-17-2021 at 11:50.
Dragokas is offline
thewintersoldier97
Senior Member
Join Date: Aug 2021
Location: Vietnam
Old 12-17-2021 , 10:56   Re: VIP Core (by R1KO) module implementation sample
Reply With Quote #2

Thank you! I will absolutely need a lot of luck now to try and implement some module lol
__________________

Looking for some fun!

Last edited by thewintersoldier97; 12-17-2021 at 10:56.
thewintersoldier97 is offline
BDuck
New Member
Join Date: Sep 2022
Old 09-05-2022 , 05:55   Re: VIP Core (by R1KO) module implementation sample
Reply With Quote #3

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
BDuck is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 09-05-2022 , 11:19   Re: VIP Core (by R1KO) module implementation sample
Reply With Quote #4

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)) {...}
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 09-06-2022 , 06:20   Re: VIP Core (by R1KO) module implementation sample
Reply With Quote #5

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)

__________________
Grey83 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:20.


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