View Single Post
Author Message
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Location: The Netherlands
Old 02-27-2008 , 10:15   Execute Configs 1.0 (Updated 2020/08/05)
Reply With Quote #1

This plugin executes configs when there are either a certain amount of clients on, a certain event occurs, a certain round starts or when there are a certain amount of minutes left on the map. You can use this to disable alltalk above x clients, or to change the map when the timelimit hits, etc. The configs of course go into the cfg folder and the console variables are as follows:

sm_executeconfigs_enabled (0/1, def 1)
Enable/disable executing configs. The plugin will keep counting the rounds and timeleft when it's disabled, but it will only actually execute the configs when it's enabled.

sm_executeconfigs_include_bots
(0/1, def. 1)
Enable/disable including bots when counting number of clients. This will allow you to disable counting fake clients as normal clients.

sm_executeconfigs_include_spec
(0/1, def. 1)
Enable/disable including spectators when counting number of clients. This will allow you to disable counting spectators as normal clients.

sm_executeconfigs_reload
Server command to reload the configs from executeconfigs.txt.


To customize which configs get executed, put the attached executeconfigs.txt in the configs folder. It contains some examples of which I'll explain one here:

Code:
"Configs"
{
    "*"
    {
        "clients:0"    "10:emptyserver.cfg"
    }
}
This means that for all maps, when there are 0 clients on, emptyserver.cfg will get executed after 10 seconds. The delay is for when someone joins within those 10 seconds, it will look for a config for when there is 1 client on, and if found it will execute that line. If it wasn't found it will continue to execute emptyserver.cfg, so if you're changing the map in emptyserver.cfg, make sure it will stop doing that by creating an empty config for clients:1.

I've tested this on TF2, I'm sure it works on others too but bug reports are always welcome

Changelog
  • 1.0
    • Rewrote most of the code to allow for easier additions.
    • Added support for map specific configs.
    • Added sm_executeconfigs_reload.
  • 0.5.3
    • Fixed invalid timer handle errors.
  • 0.5.2
    • Removed a stray LogMessage.
  • 0.5.1
    • Small fix when counting number of clients.
  • 0.5
    • Fixed timer errors.
    • Added sm_executeconfigs_include_spec.
    • Does not execute the found config if it is the last config that was executed.
  • 0.4
    • Initial public release.
Attached Files
File Type: sp Get Plugin or Get Source (executeconfigs.sp - 1203 views - 6.7 KB)
File Type: txt executeconfigs.txt (375 Bytes, 3927 views)
__________________
Advertisements | REST in Pawn - HTTP client for JSON REST APIs
Please do not PM me with questions. Post in the plugin thread.

Last edited by DJ Tsunami; 08-05-2020 at 05:10.
DJ Tsunami is offline