sapphonie / StAC-tf2

steph's anticheat (StAC). a built-from-scratch sourcemod based solution to cheating in Team Fortress 2.
https://sappho.io
GNU General Public License v3.0
120 stars 23 forks source link

[Feature Request] Cvar for allowing the plugin to be used on sv_cheats 1 servers. #115

Closed Gamecube762 closed 1 year ago

Gamecube762 commented 2 years ago

Many custom maps require sv_cheats 1 to work properly, having a cvar to enable the anti-cheat(even with limited feature set) would be very appreciated.

sapphonie commented 2 years ago

Fuck i forgot abt this, gimme a bit

sapphonie commented 2 years ago

@Gamecube762 #118

Gamecube762 commented 2 years ago

Many thanks

ghost commented 2 years ago
ConVarRef replay_enabled doesn't point to an existing ConVar
[StAC]

----> StAC version [5.4.1] loaded

ConVarRef room_type doesn't point to an existing ConVar
Executing dedicated server config file server.cfg
Using map cycle file 'cfg/mapcycle_default.txt'.  ('cfg/mapcycle.txt' was not found.)
Set motd from file 'cfg/motd_default.txt'.  ('cfg/motd.txt' was not found.)
Set motd_text from file 'cfg/motd_text_default.txt'.  ('cfg/motd_text.txt' was not found.)
SV_ActivateServer: setting tickrate to 66.7
Connection to game coordinator established.
'pl_badwater.cfg' not present; not executing.
Server is hibernating
Connection to Steam servers successful.
   Public IP to Steam is [].
Assigned anonymous gameserver Steam ID [A:1:3492844553:20991].
VAC secure mode is activated.
Received 6077649 bytes item schema version 4B7F92F6 direct data; update is queued.
sm plugins list
[SM] Listing 18 plugins:
  01 <Failed> "Steph's AntiCheat [StAC]" (5.4.1) by https://sappho.io
  02 "Reserved Slots" (1.11.0.6911) by AlliedModders LLC
  03 "Basic Info Triggers" (1.11.0.6911) by AlliedModders LLC
  04 "Sound Commands" (1.11.0.6911) by AlliedModders LLC
  05 "Anti-Flood" (1.11.0.6911) by AlliedModders LLC
  06 "Basic Votes" (1.11.0.6911) by AlliedModders LLC
  07 "Nextmap" (1.11.0.6911) by AlliedModders LLC
  08 "Basic Chat" (1.11.0.6911) by AlliedModders LLC
  09 "Basic Comm Control" (1.11.0.6911) by AlliedModders LLC
  10 "Client Preferences" (1.11.0.6911) by AlliedModders LLC
  11 "Admin Menu" (1.11.0.6911) by AlliedModders LLC
  12 "Admin File Reader" (1.11.0.6911) by AlliedModders LLC
  13 "Admin Help" (1.11.0.6911) by AlliedModders LLC
  14 "Fun Votes" (1.11.0.6911) by AlliedModders LLC
  15 "Basic Ban Commands" (1.11.0.6911) by AlliedModders LLC
  16 "Basic Commands" (1.11.0.6911) by AlliedModders LLC
  17 "Fun Commands" (1.11.0.6911) by AlliedModders LLC
  18 "Player Commands" (1.11.0.6911) by AlliedModders LLC
Errors:
stac.smx (Steph's AntiCheat [StAC]): [StAC] sv_cheats set to 1! Aborting!
stac_work_with_sv_cheats
"stac_work_with_sv_cheats" = "1" ( def. "0" ) min. 0.000000 max. 1.000000
 - [StAC] allow StAC to work when sv_cheats is 1. WARNING; you might get false positives, and I will not provide support for servers running this cvar!
(recommended 0)
sv_cheats
"sv_cheats" = "1" ( def. "0" )
 notify replicated
 - Allow cheats on server
sapphonie commented 2 years ago

Investigating

sapphonie commented 2 years ago
ConVarRef replay_enabled doesn't point to an existing ConVar
[StAC]

----> StAC version [5.4.1] loaded

ConVarRef room_type doesn't point to an existing ConVar
Executing dedicated server config file server.cfg
Using map cycle file 'cfg/mapcycle_default.txt'.  ('cfg/mapcycle.txt' was not found.)
Set motd from file 'cfg/motd_default.txt'.  ('cfg/motd.txt' was not found.)
Set motd_text from file 'cfg/motd_text_default.txt'.  ('cfg/motd_text.txt' was not found.)
SV_ActivateServer: setting tickrate to 66.7
Connection to game coordinator established.
'pl_badwater.cfg' not present; not executing.
Server is hibernating
Connection to Steam servers successful.
   Public IP to Steam is [].
Assigned anonymous gameserver Steam ID [A:1:3492844553:20991].
VAC secure mode is activated.
Received 6077649 bytes item schema version 4B7F92F6 direct data; update is queued.
sm plugins list
[SM] Listing 18 plugins:
  01 <Failed> "Steph's AntiCheat [StAC]" (5.4.1) by https://sappho.io
  02 "Reserved Slots" (1.11.0.6911) by AlliedModders LLC
  03 "Basic Info Triggers" (1.11.0.6911) by AlliedModders LLC
  04 "Sound Commands" (1.11.0.6911) by AlliedModders LLC
  05 "Anti-Flood" (1.11.0.6911) by AlliedModders LLC
  06 "Basic Votes" (1.11.0.6911) by AlliedModders LLC
  07 "Nextmap" (1.11.0.6911) by AlliedModders LLC
  08 "Basic Chat" (1.11.0.6911) by AlliedModders LLC
  09 "Basic Comm Control" (1.11.0.6911) by AlliedModders LLC
  10 "Client Preferences" (1.11.0.6911) by AlliedModders LLC
  11 "Admin Menu" (1.11.0.6911) by AlliedModders LLC
  12 "Admin File Reader" (1.11.0.6911) by AlliedModders LLC
  13 "Admin Help" (1.11.0.6911) by AlliedModders LLC
  14 "Fun Votes" (1.11.0.6911) by AlliedModders LLC
  15 "Basic Ban Commands" (1.11.0.6911) by AlliedModders LLC
  16 "Basic Commands" (1.11.0.6911) by AlliedModders LLC
  17 "Fun Commands" (1.11.0.6911) by AlliedModders LLC
  18 "Player Commands" (1.11.0.6911) by AlliedModders LLC
Errors:
stac.smx (Steph's AntiCheat [StAC]): [StAC] sv_cheats set to 1! Aborting!
stac_work_with_sv_cheats
"stac_work_with_sv_cheats" = "1" ( def. "0" ) min. 0.000000 max. 1.000000
 - [StAC] allow StAC to work when sv_cheats is 1. WARNING; you might get false positives, and I will not provide support for servers running this cvar!
(recommended 0)
sv_cheats
"sv_cheats" = "1" ( def. "0" )
 notify replicated
 - Allow cheats on server

Can you test #131 ( https://github.com/sapphonie/StAC-tf2/raw/8d41f06ca788cc1877bf536577ccdf1099899478/plugins/stac.smx ) and see if this fixes your issue? Thanks

Gamecube762 commented 2 years ago

Can you test https://github.com/sapphonie/StAC-tf2/pull/131 ( https://github.com/sapphonie/StAC-tf2/raw/8d41f06ca788cc1877bf536577ccdf1099899478/plugins/stac.smx ) and see if this fixes your issue? Thanks

[StAC] 

----> StAC version [5.4.2] loaded

ConVarRef room_type doesn't point to an existing ConVar
Executing dedicated server config file server.cfg
Using map cycle file 'cfg/mapcycle_default.txt'.  ('cfg/mapcycle.txt' was not found.)
Set motd from file 'cfg/motd_default.txt'.  ('cfg/motd.txt' was not found.)
Set motd_text from file 'cfg/motd_text_default.txt'.  ('cfg/motd_text.txt' was not found.)
SV_ActivateServer: setting tickrate to 66.7
Connection to game coordinator established.
Current item schema is up-to-date with version 6A365496.

=======server.cfg======= 

L 09/08/2022 - 14:35:40: [SM] Exception reported: [StAC] sv_cheats set to 1! Aborting!
L 09/08/2022 - 14:35:40: [SM] Blaming: external/stac.smx
L 09/08/2022 - 14:35:40: [SM] Call stack trace:
L 09/08/2022 - 14:35:40: [SM]   [0] SetFailState
L 09/08/2022 - 14:35:40: [SM]   [1] Line 592, ./scripting/stac/stac_cvars.sp::GenericCvarChanged

--------------------------------------------------------
sv_pure value unchanged (current value is 0).
--------------------------------------------------------

=======sourcemod/stac.cfg======= 

Server is hibernating
Connection to Steam servers successful.
   Public IP to Steam is Nope.
Assigned anonymous gameserver Steam ID [:::].
VAC secure mode is activated.

=======pvp_enable.cfg======= 

stac_work_with_sv_cheats
"stac_work_with_sv_cheats" = "1" ( def. "0" ) min. 0.000000 max. 1.000000
 - [StAC] allow StAC to work when sv_cheats is 1. WARNING; you might get false positives, and I will not provide support for servers running this cvar!
(recommended 0)
sv_cheats
"sv_cheats" = "1" ( def. "0" )
 - Allow cheats on server

The plugin still aborted itself on my first try, but I found out it's a race-condition. If sv_cheats 1 is ran before stac_work_with_sv_cheats 1 the plugin will abort. cfg/sourcemod/stac.cfg runs very late after server.cfg triggering this race-condition. When testing both Cvars in server.cfg having stac_work_with_sv_cheats 1 before sv_cheats 1 prevents the plugin from aborting.

sapphonie commented 2 years ago

PRs welcome, otherwise I'll fix it tonight

sapphonie commented 1 year ago

Didn't fix it ^ obviously. This is an annoying thing to fix, I'm trying to avoid making race conditions with timers to fix other race conditions