Skocz do zawartości

Nowy szablon forum

mygo.pl

Stworzyliśmy dla Was nowy wygląd forum. Z pewnością znajdziesz rzeczy, które wg Ciebie mogą zostać zmienione - wspomnij o tym w specjalnym wątku.

Czytaj więcej

Jak założyć własną sieć

serwerów CS

Zastanawiasz się nad prowadzeniem własnej sieci serwerów? Przeczytaj podstawowe informacje, na które należy zwrócić uwagę, przy takim projekcie.

Czytaj więcej

Tworzymy spis sieci

dodaj swoją

Dodaj sieć do której należysz, pozwoli to na promocję i budowę ogólnopolskiej bazy sieci CS.

Czytaj więcej

RSS[ANY] Player Watchlist


MYGO.pl
 Udostępnij

Rekomendowane odpowiedzi

  • RSSy
About:
Provides a super simple alert when certain players join or leave your server. Requires MySQL and the Discord/Slack API by zipcore.

It's pretty meh truth be told, I made this because someone wanted to be alerted when a suspected cheater joined my server so they could spectate them and remove all doubt. I want to make it more configurable where you can select which notifications go out, but I nearly did my head in with warnings in the compiler. Happy to take feedback though.

Installation
  1. The very first step is to setup a database and a login for that database. You can do this however you like, the specific method will be different depending on your setup.
  2. Install the Discord/Slack API.
  3. Upload the SMX file to your addons/sourcemod/plugins directory on your server.
  4. Upload the default watchlist.cfg file to your cfg/sourcemod directory
  5. Modify the watchlist.cfg file to your liking. The default settings should be good, but they won't reflect your server's IP or hostname.
  6. Modify the databases.cfg file in addons/sourcemod/configs, and add a database entry for "watchlist" (see examples below)
  7. Modify the discord.cfg file in the same location and add a webhook for your discord server. Click here for more info on making a webhook. Don't forget to add /slack to the end.
  8. Restart your server.

Usage
  • watchlist_add <STEAMID> <reason> - Adds a Steam ID to the watchlist. An alert will go out to discord when you do this. Can be used from client console as long as you have KICK permissions
  • watchlist_remove <STEAMID> - Removes a Steam ID from the watchlist. An alert will go out to discord when you do this. Can be used from client console as long as you have KICK permissions
  • watchlist_migrate_database - Untested command that SHOULD setup the database table itself, but if it doesn't, I've included a script that will do it for you.

How it looks in Discord
Adding a user
68747470733a2f2f692e696d6775722e636f6d2f

User Joining/Leaving
68747470733a2f2f692e696d6775722e636f6d2f

Removing a user
68747470733a2f2f692e696d6775722e636f6d2f

Default watchlist.cfg
PHP Code:

// ConVars for plugin "watchlist.smx"


// Use this convar to mention a role or user in the Discord notification. Use @everyone to mention everyone, or mention a specific role with <@&roleid>
// -
// Default: ""
watchlist_mention "@everyone"

// IP address of the server, will be used to craft a connect string or link in the notification.
// -
// Default: "127.0.0.1:27015"
watchlist_server_ip "127.0.0.1.27015"

// Name of the server as it should show in the Discord notification
// -
// Default: "My TF2 Server"
watchlist_server_name "My TF2 Server"

// Configuration for the SQL database
// -
// Default: "watchlist"
watchlist_sqlconfig "watchlist"

// Player Watchlist
// -
// Default: "1.0"
watchlist_version "1.0"

// Webhook config in discord.cfg to send the Discord notification to.
// -
// Default: ""
watchlist_webhook "watchlist" 

Example Database Configuration
PHP Code:

    "watchlist"
    
{
        
"driver"            "mysql"
        "host"                "12.34.56.78"
        "database"            "database"
        "user"                "username"
        "pass"                "secretPassword"
        
//"timeout"            "0"
        
"port"            "3306"
    


Example Discord Configuration
PHP Code:

    "watchlist"
    
{
        
"url"   "https://discord.com/api/webhooks/numbers/lotsOfRandomLetters/slack"
    


SQL script to make the table (incase something goes wrong)
Code:

CREATE TABLE IF NOT EXISTS `watchlist` (
  `steamid` varchar(24) NOT NULL,
  `watched_since` varchar(32) NOT NULL,
  `watched_by` varchar(100) NOT NULL,
  `reason` varchar(250) DEFAULT NULL
)

Things that are out of scope for this
  • Steam/Pushbullet/Any other platform - Not particularly interested, sorry. Source code is there, it wouldn't be too hard to adapt it to pushbullet, but interacting with Steam is a hell I'd wish upon nobody. Good luck if you wanna do this.
  • Watch by IP - I thought about this for a while, and I came to the conclusion that while there is a use case to be argued for tracking an IP address, there's so much abuse that could be had from that. I won't enable it. (Also for my own setup I have another method of connecting IPs to alt accounts)

Things that are probably coming soon if I don't have a smooth brain moment
  • Customized Embeds - Mostly color or title...
  • Toggle which notifications you see - so maybe the ability to turn off Disconnect notifications, or watchlist changes..
  • Support for seperate webhooks for change notifications - Not too hard to do really, it's just a matter of adding another ConVar.

Code:

CHANGELOG:
NEWEST VERSION IS ALWAYS AT THE TOP

1.0 - Release

... everybody laugh at my terrible code.

(Shoutouts to the AlliedModders discord for helping me out with remembering regex is a thing and everything they've taught me to date)

Attached Files
File Type: sp Get Plugin or Get Source (watchlist.sp - 21.4 KB)
File Type: smx watchlist.smx (10.2 KB)

Wyświetl pełny artykuł

Odnośnik do komentarza
Udostępnij na innych stronach

Gość
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.
 Udostępnij

  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...