RSSy MYGO.pl Opublikowano Czerwiec 5, 2022 o 18:57 RSSy Udostępnij Opublikowano Czerwiec 5, 2022 o 18:57 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. InstallationThe 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. Install the Discord/Slack API. Upload the SMX file to your addons/sourcemod/plugins directory on your server. Upload the default watchlist.cfg file to your cfg/sourcemod directory 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. Modify the databases.cfg file in addons/sourcemod/configs, and add a database entry for "watchlist" (see examples below) 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. Restart your server. Usagewatchlist_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 User Joining/Leaving Removing a user 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 thisSteam/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 momentCustomized 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 Get Plugin or Get Source (watchlist.sp - 21.4 KB) watchlist.smx (10.2 KB) Wyświetl pełny artykuł Odnośnik do komentarza Udostępnij na innych stronach Więcej opcji udostępniania...
Rekomendowane odpowiedzi