MantisBT - Zandronum
View Issue Details
0004153Zandronum[All Projects] Suggestionpublic2023-08-11 06:572024-03-23 06:25
Fused 
 
normalminorN/A
resolvedfixed 
3.1 
3.23.2 
0004153: Provide a way to apply (mild) timed bans on players through ACS
As per the conversation I had yesterday, a big feature I personally look for is the ability to punish players that sabotage mods by allowing the game to apply temporary bans to these players when it notices certain players misbehaving in a match.
This is especially useful in competitive game modes, such as Zombie Horde which could benefit from this by punishing players who spectate as a Zombie after being chosen/infected into one.

I noticed that there was a lot of positive and negative feedback to this, and the biggest drawback I heard of this is that the ability to permanently ban players through ACS is too much power for a mod to have. I agree, and therefore my suggestion is to introduce a milder form which only allows timed bans of up to half an hour, or less if desired. Personally I am seeking a minimum of 10 minutes as was done back in the day with Grandvoid, which was very effective.

I understand the severity of these type of functions and the fact that they are prone to abuse in one way or another, but I have to admit that I see little reason to draw the bar here when there are so many existing ACS methods that could "alter" the player's state (think of soft muting players with the chat ACS script, or recursively forcing players to spectate with ACS using `kickfromgame`).
Related:
'https://zandronum.com/tracker/view.php?id=2554 [^]'
No tags attached.
related to 0002554closed  New ACS functions for server administration 
patch BanFromGame.patch (3,709) 2024-01-24 21:52
/tracker/file_download.php?file_id=2891&type=bug
patch BanFromGame_2.patch (3,104) 2024-01-25 16:24
/tracker/file_download.php?file_id=2893&type=bug
patch BanFromGame_3.patch (3,105) 2024-01-28 22:00
/tracker/file_download.php?file_id=2898&type=bug
Issue History
2023-08-11 06:57FusedNew Issue
2023-08-11 08:52KaminskyRelationship addedrelated to 0002554
2023-08-11 08:54KaminskyProduct Version4.0-beta => 3.1
2024-01-24 21:52BinaryCodeFile Added: BanFromGame.patch
2024-01-24 21:52BinaryCodeNote Added: 0023001
2024-01-25 16:06KaminskyNote Added: 0023006
2024-01-25 16:06KaminskyStatusnew => needs review
2024-01-25 16:06KaminskyTarget Version => 3.2
2024-01-25 16:07KaminskyNote Edited: 0023006bug_revision_view_page.php?bugnote_id=23006#r14052
2024-01-25 16:08KaminskyNote Edited: 0023006bug_revision_view_page.php?bugnote_id=23006#r14053
2024-01-25 16:24BinaryCodeFile Added: BanFromGame_2.patch
2024-01-25 16:27BinaryCodeNote Added: 0023007
2024-01-28 21:51KaminskyNote Added: 0023024
2024-01-28 22:00BinaryCodeFile Added: BanFromGame_3.patch
2024-01-28 22:00BinaryCodeNote Added: 0023025
2024-01-28 22:08Torr SamahoNote Added: 0023026
2024-01-28 22:08Torr SamahoStatusneeds review => needs testing
2024-02-26 01:03TrillsterNote Added: 0023089
2024-03-02 15:54KaminskyNote Added: 0023252
2024-03-02 15:54KaminskyStatusneeds testing => needs review
2024-03-03 13:44KaminskyNote Added: 0023291
2024-03-03 13:44KaminskyStatusneeds review => needs testing
2024-03-23 06:25Ru5tK1ngNote Added: 0023473
2024-03-23 06:25Ru5tK1ngFixed in Version => 3.2
2024-03-23 06:25Ru5tK1ngStatusneeds testing => resolved
2024-03-23 06:25Ru5tK1ngResolutionopen => fixed

Notes
(0023001)
BinaryCode   
2024-01-24 21:52   
I have uploaded a .patch file that adds BanFromGame(PlayerNumber, Time[, Duration]), which should work as described here, as well as a CVar (sv_allowacsbanfunction) to disable the functionality as needed by server hosts.

If the CVar is off, the function will not work, and the time (in minutes) can only go up to 60, or an hour.
(0023006)
Kaminsky   
2024-01-25 16:06   
(edited on: 2024-01-25 16:08)
A few comments on your patch:

1. It would be better to define "sv_allowacsbanfunction" inside "p_acs.cpp", rather than defining it in "c_cmds.cpp" (not an appropriate place to put it in) and then adding an extern in the only file that you need to use it in. I also recommend putting its definition above:

//
// [TP] Overridable system time property
//
CVAR( Int, acstimestamp, 0, CVAR_ARCHIVE | CVAR_NOSETBYACS )

2. You should move "#include "sv_ban.h"" (without the comment) underneath all the extra includes listed under "// [BB] New #includes."

3. You should also move "case ACSF_BanFromGame:" underneath "case ACSF_LumpClose:" to follow proper case ordering.

4. You can ditch both instances of "else return 0;" and replace the "break;" statement at the end of the case block with "return 0;". The function is guaranteed to return 1 if all conditions are true and will hit to the end of the case block anyways if they aren't.

(0023007)
BinaryCode   
2024-01-25 16:27   
I have uploaded an updated patch that addresses those issues.
(0023024)
Kaminsky   
2024-01-28 21:51   
Another point that I didn't bring up earlier: from a previous discussion, we agreed that banning players via ACS should be an opt-in system for security reasons. Therefore, the default value of "sv_allowacsbanfunction" needs to be changed to false.
(0023025)
BinaryCode   
2024-01-28 22:00   
Uploaded another patch that sets it to false by default.
(0023026)
Torr Samaho   
2024-01-28 22:08   
Thanks! I rebased the updated patch to the current head of our repo and added it.
(0023089)
Trillster   
2024-02-26 01:03   
I think rather than a boolean `sv_allowacsbanfunction` CVAR, it would be preferable to have a `sv_maxacsbanduration` CVAR with a default of 0.

This would allow server hosts the ability to clamp any mod-supplied ban durations to a lower amount than the current hard-coded internal value if desired. It would also allow mods to specify longer spanning bans that will only see action if the server host opts into a longer duration via CVAR.
(0023252)
Kaminsky   
2024-03-02 15:54   
In response to the feedback above, I created a new MR to replace the "sv_allowacsbanfunction" CVar with "sv_maxacsbanduration":'https://foss.heptapod.net/zandronum/zandronum-stable/-/merge_requests/37 [^]'
(0023291)
Kaminsky   
2024-03-03 13:44   
The aforementioned changes have been pushed into the default branch of our repository:'https://foss.heptapod.net/zandronum/zandronum-stable/-/commit/f15955f77fdfcdfd230348bb405b1c8df8004bb1 [^]'
(0023473)
Ru5tK1ng   
2024-03-23 06:25   
Tested the latest build of 3.2 and the ban function seemed to work fine. Considering I don't have a means to mass test this, reopen the ticket if necessary.