CS-GEJMERZY / VIP-Plugin

VIP plugin designed to work with CSS framework on cs2 servers.
GNU General Public License v3.0
13 stars 3 forks source link

feat: database support #36

Closed HackerDevs closed 5 months ago

HackerDevs commented 5 months ago

This PR introduces database support for adding vips.

Config changes:

Added support for database in config

"Database": { 
      "Enabled": false, // disabling this will deactivate all features reliant on the database
      "SqlServer": {
        "host": "www.site.com",
        "port": 3306,
        "database": "vip-plugin",
        "username": "user",
        "password": "password"
      }
    },
    "DatabaseVipsConfig": {
      "Enabled": false,
      "Commands": {
        "css_vp_service_enable": {
          "Enabled": true
        },
        "css_vp_service_disable": {
          "Enabled": true
        },
        "css_vp_service_delete": {
          "Enabled": true
        },
        "css_vp_service_info": {
          "Enabled": true
        },
        "css_vp_player_info": {
          "Enabled": true
        },
        "css_vp_player_addflags": {
          "Enabled": true
        },
        "css_vp_player_addgroup ": {
          "Enabled": true
        }
      }
    }

Added 2 fields in VipGroupConfig

"Priority": 1, // if a player has multiple groups, one with higher priority will be chosen
"UniqueId": "vip1" // used for storing services in DB, must be unique

New commands - further described in readme

css_vp_service_enable <service_id>
css_vp_service_disable <service_id>
css_vp_service_delete <service_id>
css_vp_service_info <service_id>
css_vp_player_info <steamid64>
css_vp_player_addflags <steamid64>  <duration_minutes> <flags>
css_vp_player_addgroup <steamid64>  <duration_minutes> <group> 
HackerDevs commented 5 months ago

The code is now in a usable state. I've tested it on my development server, and everything appears to be working smoothly. Any feedback or code review would be greatly appreciated.