puffserver-rocks / puffdev

container for plugin issues and etc
0 stars 0 forks source link

sm_hookevent #4

Closed thehonker closed 2 years ago

thehonker commented 2 years ago

Take a a cvar of command(s) to execute at round end

> custom/gamemode/dodgeball.cfg
// dodgeball stuff
// enable the plugin
sm_roundend_exec_enabled "1"
// execute custom/disable-something.cfg and custom/defaults.cfg
sm_roundend_exec_command "exec custom/disable-something.cfg; exec custom/defaults.cfg; bot_kick"

>> round ends, disable-something.cfg and everything.cfg are executed

> custom/defaults.cfg:
// end user responsible for disabling the plugin
sm_roundend_exec_enabled "0"
// end user responsible for clearing the cvar / setting it to something else
sm_roundend_exec_command ""

Now that I'm thinking about it more, it'd be really nice if we could hook round start as well.

Stretch goal can be to hook any event.

thehonker commented 2 years ago

big thank https://github.com/tmick0/sm_hookevent Works great on round_end to reset things to defaults, haven't tested further but I don't see why it wouldn't work.

Examples you can put in the readme:

>> commandlist.txt from https://github.com/caxanga334/cvreduxmodified
!knifeonly Rf{r} exec custom/custom-modes/knife_only.cfg; sm_hookevent round_end "exec custom/defaults/default_all.cfg"
>> some_config_file.cfg
bot_quota 10
sm_hookevent round_end "bot_quota 0; bot_kick"
thehonker commented 2 years ago

reopening as updated version w/ repeated hooks requires testing

thehonker commented 2 years ago

tested working well 👍