Welcome to LegendCS – With grace, in your face !

 
Last Updated: 02-17-2025, 09:24 AM
Name: [Plugin CS2] VIPCore
Category: Plugins
by: Berserk
Downloads: 0
Views: 65
MD5: bdd6c6354c223f416585b49594bf3932
Your rating: N/A
Average rating: N/A
 
Description:
Description :  VIP API for other VIP plugins.

Author: partiusfabaa 

Installation:

  1. Install CounterStrike Sharp, Metamod:Source
  2. Download VIPCore
  3. Unpack the archive and upload it to the game server (example path: addons/counterstrikesharp/plugins)
Put the modules in this path  addons/counterstrikesharp/plugins

Configs: Located in the folder addons/counterstrikesharp/configs/plugins/VIPCore

Core.json
PHP Code: 
{
  "TimeMode"0,           // 0 - seconds | 1 - minutes | 2 - hours | 3 - days)
  "ServerId"0,           // SERVER ID
  "UseCenterHtmlMenu"true,       //If `true`, the menu will be in the center, if `false`, it will be in the chat. Note that if you have another plugin that uses `CenterHtml`, server crashes may occur
  "ServerIP""0.0.0.0",        // default ip
  "ServerPort"27015,            // default port
  "ReOpenMenuAfterItemClick"true,//Whether to reopen the menu after selecting an item | true - yes | false - no
  "VipLogging"true,              //Whether to log VIPCore | true - yes | false - no
  "Connection": {
    
"Host":     "host",
    
"Database""database",
    
"User":     "user",
    
"Password""password",
    
"Port"3306
  
}




vip.json
PHP Code: 
{
  "Delay"2.0
  
"Groups": {
    "VIP1": {
      "Values": {
        "feature1"value1,
    
"feature2"value2
      
}
    }
  }


Example Module

PHP Code: 
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core.Attributes.Registration;
using CounterStrikeSharp.API.Modules.Commands;
using VipCoreApi;

namespace 
VIPMyModule;

public class 
VIPMyModule BasePlugin
{
    public override string ModuleAuthor => "Author";
    public override string ModuleName => "[VIP] My Module";
    public override string ModuleVersion => "1.0.0";

    private MyPlugin _myPlugin;

    private IVipCoreApi_api;
    private PluginCapability<IVipCoreApiPluginCapability get; } = new("vipcore:core");

    public override void OnAllPluginsLoaded(bool hotReload)
    {
        _api PluginCapability.Get();
        if (_api == null) return;

        _api.OnCoreReady += () =>
        {
            _myPlugin = new MyPlugin(this_api);
            _api.RegisterFeature(_myPlugin);
        };
    }

    public override void Unload(bool hotReload)
    {
        _api?.UnRegisterFeature(_myPlugin);
    }
}

public class 
MyPlugin VipFeatureBase
{
    public override string Feature => "MyFeature";
    private TestConfig _config;

    public MyPlugin(VIPMyModule vipMyModuleIVipCoreApi api) : base(api)
    {
        vipMyModule.AddCommand("css_viptestcommand"""OnCmdVipCommand);
        _config LoadConfig<TestConfig>("VIPMyModule");
    }

    public override void OnPlayerSpawn(CCSPlayerController player)
    {
        if (PlayerHasFeature(player))
        {
            PrintToChat(player, $"VIP player - {player.PlayerName} has spawned");
        }
    }

    public override void OnSelectItem(CCSPlayerController playerIVipCoreApi.FeatureState state)
    {
        if (state == IVipCoreApi.FeatureState.Enabled)
        {
            PrintToChat(player"Enabled");
        }
        else
        {
            PrintToChat(player"Disabled");
        }
    }
    
    
public void OnCmdVipCommand(CCSPlayerControllerplayerCommandInfo info)
    {
        if (player == null) return;

        if (IsClientVip(player) && PlayerHasFeature(player))
        {
            PrintToChat(player, $"{player.PlayerName} is a VIP player");
            return;
        }

        PrintToChat(player, $"{player.PlayerName} not a VIP player");
    }
}

public class 
TestConfig
{
    public int Test1 getset; } = 50;
    public bool Test2 getset; } = true;
    public string Test3 getset; } = "TEST";
    public float Test4 getset; } = 30.0f;


[-]
Leave a comment
To leave a comment you must log in.