Skip to content

Repository files navigation

Vip

A modular VIP system for ModSharp (CS2) — group tiers, an extensible perk API, and admin grant/revoke management.

ModSharp CS2 Stars


Vip gives players VIP status via configurable group tiers (e.g. default / gold / diamond), each tier exposing a set of feature gates and tunable values. Perks themselves are pluggable: other plugins register their own perks against the published IVipPerkRegistry, and VIPs toggle/configure them through an in-game menu. VIP records persist through a pluggable database backend (LiteDB out of the box, or MySQL/PostgreSQL/SQLite via SqlSugar).

The repo ships two ModSharp modules:

Module Role
Vip.Core The VIP system: groups, perk registry, menu, admin commands, and the public IVipShared API.
Vip.Database Storage backend. Publishes IDatabaseProvider and selects LiteDB or a SQL engine from config.

🚀 Install

Copy the build output into your ModSharp install (<sharp> = your sharp directory):

From To
.build/modules/Vip.Core/ <sharp>/modules/Vip.Core/
.build/modules/Vip.Database/ <sharp>/modules/Vip.Database/
.build/shared/Vip.Shared/ <sharp>/shared/Vip.Shared/
.build/shared/Vip.Database.Shared/ <sharp>/shared/Vip.Database.Shared/

Restart the server (or change map) to load. Config files are written with defaults on first run.

Optional ModSharp modules enhance functionality when present (all are resolved null-safe): AdminManager (permission checks), TargetingManager (player targeting in admin commands), MenuManager (the !vip perk menu — falls back to chat list if absent), ClientPreferences (per-player perk settings), LocalizerManager, and the AdminPanel plugin (registers grant/revoke actions in its panel when installed).

⌨️ Commands

Player command:

Command Description
vip Opens the VIP perk menu (VIPs only). Lists registered perks and per-perk settings; without MenuManager it prints the list to chat.

Admin commands (each gated by a permission, configurable in vip.json):

Command Usage Permission Description
vip_grant vip_grant <target> [days] [flags] vip:grant Grant VIP to a player. Omit days for lifetime.
vip_revoke vip_revoke <target> vip:revoke Remove a player's VIP.
vip_list vip_list [page] vip:list Paginated list of active VIPs (10 per page).
vip_check vip_check <target> vip:list Show a player's VIP status, expiry, and flags.
vip_setgroup vip_setgroup <target> <groupName> vip:setgroup Change a VIP's group tier.

Permissions are registered with AdminManager under the Vip manifest, so * resolves them for root admins.

⚙️ Configuration

All config lives under <sharp>/configs/vip/ and is generated with defaults on first run.

vip.json — core settings:

Setting Default Meaning
hotReloadIntervalSeconds 300 Interval for periodic refresh.
defaultExpirationDays 30 Default VIP duration when not specified.
adminPermissionGrant vip:grant Permission required for vip_grant.
adminPermissionRevoke vip:revoke Permission required for vip_revoke.
adminPermissionList vip:list Permission required for vip_list / vip_check.

groups.json — VIP tiers and their feature gates/values. Ships with default, gold, and diamond examples. Each group maps feature keys (e.g. armor, health, money, speed, defuseKit, antiFlash, reservedSlotsGate) to an enabled flag plus an optional custom value that perk plugins read.

vip.database.jsonc — storage backend:

Setting Default Meaning
Database.Type litedb litedb, mysql, postgresql, or sqlite.
Database.Host localhost SQL host (ignored for LiteDB).
Database.Port 3306 SQL port.
Database.Database vip Database / file name.
Database.User root SQL user.
Database.Password (empty) SQL password.

With litedb, data is stored at <sharp>/data/<Database>.db. SQL backends use SqlSugar and persist to the vip_members table.

🔧 How it works

Vip.Database resolves its backend from vip.database.jsonc and publishes IDatabaseProvider. Vip.Core loads its groups and config, exposes IVipShared for status queries plus grant/revoke, and IVipPerkRegistry for perk registration. At load, optional managers are resolved without hard dependencies — missing ones simply disable the related feature rather than failing the plugin. A VIP's group determines which registered perks appear in their menu (only features present in the group's config are shown), and per-perk choices persist via ClientPreferences cookies.

🧩 Public API

Other plugins consume these interfaces (resolve in OnAllModulesLoaded):

  • IVipShared — query VIP status (IsVip, Get, HasFlag, group lookups), grant/revoke, and subscribe to OnVipGranted / OnVipRevoked / OnVipExpired events.
  • IVipPerkRegistry — register a custom IVipPerk (id, display name, settings, preference callback) so it shows up in the VIP menu.
  • IDatabaseProvider (from Vip.Database.Shared) — backend-agnostic data access.
var vip = sharpModuleManager
    .GetOptionalSharpModuleInterface<IVipShared>(IVipShared.Identity)?.Instance;

var perks = sharpModuleManager
    .GetOptionalSharpModuleInterface<IVipPerkRegistry>(IVipPerkRegistry.Identity)?.Instance;
perks?.Register(new MyPerk());

📦 Build

dotnet build -c Release

Outputs the module DLLs to .build/modules/Vip.Core/ and .build/modules/Vip.Database/, and the shared API DLLs to .build/shared/Vip.Shared/ and .build/shared/Vip.Database.Shared/.


Made with ❤️ by yappershq

⭐ Star this repo if you find it useful!

About

VIP framework for CS2 with groups, a perk registry and admin-panel integration.

Topics

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages