8dcc / hl-cheat

Linux cheat for goldsrc games (HL1/CS 1.6/DoD/TFC)
GNU General Public License v3.0
7 stars 2 forks source link

Attacking teammates. #2

Closed Hhk78 closed 1 year ago

Hhk78 commented 1 year ago

When I set the cv_autochoot variable to 1, it also targets and hits my teammate. The server I play on has set a plugin that damages me when I do friendlfire. How do I turn off teammate damage for cv_autoshoot?

sorry for english. i use translate

8dcc commented 1 year ago

Short answer

Unfortunately, the current method for checking teams is not supported in Half-Life 1, and I choose to use this method to avoid anticheat detection.

Long answer

The cheat checks if an entity is friendly or not using the following function:

https://github.com/8dcc/hl-cheat/blob/29a40f63dabe2e3ca44b0f117d043ee9d6846d11/src/util.c#L34-L64

The method used is by checking the extra_player_info_t struct for each player, but this changes depending on the game (that's why we cast to different structs). For Half-Life 1, the structure should be the same as the one in Team Fortress Classic, but everyone is always fagged as teammate (teamnumber is always the same).

To fix this, because the main gamemode in Half-Life 1 is deathmatch, I decided to always return false (i.e. everyone is an enemy):

https://github.com/8dcc/hl-cheat/blob/29a40f63dabe2e3ca44b0f117d043ee9d6846d11/src/util.c#L60-L62

The other methods used by cheats to check teams (e.g. parsemsg) can be detected by anticheats, and will block you from joining the server.

Hhk78 commented 1 year ago

I said for cs, I don't play Half-Life. I don't understand English very well. With this cheat, is it possible to fulfill my request, that is, turn off shots in teammate mode? I would appreciate it if you could write a short yes or no. :)

sory for english i use translate

8dcc commented 1 year ago

You didn't say the game. In CS 1.6, it should detect teammates automatically, it works for me. I don't know if the server plugins change anything, but I can't do anything about that.