- Install CounterStrike Sharp, Metamod:Source and CSSModularity
- Download VIPCore
- Unpack the archive and upload it to the game server (example path: addons/counterstrikesharp/plugins/ModularityPlugin/)
addons/counterstrikesharp/plugins/ModularityPlugin/plugins
Command | Description |
---|---|
css_vip_reload or !vip_reload |
Reloads the configuration. (@css/root ) |
css_vip_adduser "steamid" "vipgroup" "time or 0 permanently" |
Adds a VIP player (for server console only) |
css_vip_deleteuser "steamid" |
Allows you to delete a player by SteamID identifier (for server console only) |
css_vip or !vip |
Opens the VIP menu |
{
"TimeMode": 0, // 0 - seconds | 1 - minutes | 2 - hours | 3 - days)
"VipLogging": true //Whether to log VIPCore | true - yes | false - no
}
{
"Groups": {
"VIP1": {
"Values": {
"features": values
}
}
},
"Connection": {
"Host": "host",
"Database": "database",
"User": "user",
"Password": "password"
}
}
- Add the dll from CSSModularity to your project (the dll can be found at this path:
addons/counterstrikesharp/plugins/ModularityPlugin/shared/Modularity/Modularity.dll
) - Add the dll from VipCoreApi to your project (the dll can be found at this path:
addons/counterstrikesharp/plugins/ModularityPlugin/shared/VipCoreApi/VipCoreApi.dll
)
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core.Attributes.Registration;
using CounterStrikeSharp.API.Modules.Commands;
using Modularity;
using VipCoreApi;
namespace VIPMyModule;
public class VIPMyModule : BasePlugin, IModulePlugin
{
public override string ModuleAuthor => "Author";
public override string ModuleName => "[VIP] My Module";
public override string ModuleVersion => "1.0.0";
private static readonly string Feature = "MyFeature";
private IVipCoreApi _api = null!;
private TestConfig _config = null!;
public void LoadModule(IApiProvider provider)
{
_api = provider.Get<IVipCoreApi>();
_api.RegisterFeature(Feature, selectItem: OnSelectItem);
_api.OnPlayerSpawn += OnPlayerSpawn;
_config = _api.LoadConfig<TestConfig>("VIPMyModule");
}
private void OnPlayerSpawn(CCSPlayerController player)
{
if (_api.PlayerHasFeature(player, Feature))
{
_api.PrintToChat(player, $"VIP player - {player.PlayerName} has spawned");
}
}
private void OnSelectItem(CCSPlayerController player, IVipCoreApi.FeatureState state)
{
if (state == IVipCoreApi.FeatureState.Enabled)
{
_api.PrintToChat(player, "Enabled");
}
else
{
_api.PrintToChat(player, "Disabled");
}
}
[ConsoleCommand("css_viptestcommand")]
public void OnCmdVipCommand(CCSPlayerController? player, CommandInfo info)
{
if (player == null) return;
if (_api.IsClientVip(player) && _api.PlayerHasFeature(player, Feature))
{
_api.PrintToChat(player, $"{player.PlayerName} is a VIP player");
return;
}
_api.PrintToChat(player, $"{player.PlayerName} not a VIP player");
}
public override void Unload(bool hotReload)
{
_api.UnRegisterFeature(Feature);
}
}
public class TestConfig
{
public int Test1 { get; set; } = 50;
public bool Test2 { get; set; } = true;
public string Test3 { get; set; } = "TEST";
public float Test4 { get; set; } = 30.0f;
}