NexiusTailer / Nex-AC

Anticheat system
https://pawn.wiki/index.php?/topic/27641-nex-ac/
GNU Lesser General Public License v3.0
212 stars 156 forks source link

Help with interference with native SA-MP functions #299

Closed Telzin2k closed 8 months ago

Telzin2k commented 8 months ago

Hello. I'm developing my server from scratch and like every server owner, I also have concerns about hacks, so I decided to test Nex-AC.

I confess that I never took any programming course and everything I learned was on my own in the last 8 years of SA-MP and I'm going to my third project, but this time I don't want a headache with hacks and so I'm betting a lot on Nex-AC , which I have tried to use in the past and never succeeded. But this time I want help on how to proceed with the development of the server without these conflicts with the SA-MP functions itself?

I recorded a short video demonstrating the problem, since I don't know English and for a better explanation, the video itself explains it better than me and my friend Google Translate. lol (laughs).

https://youtu.be/zbqZ1Rqm0qE

NexiusTailer commented 8 months ago

Can you show that place (a piece of code) where you set player spectating when he connects in register/login system? Also, do you use any other filterscripts except main gamemode? If so, each filterscript should be with #define FILTERSCRIPT and anticheat should also be included in it after this define.

Telzin2k commented 8 months ago

Você pode mostrar aquele local (um pedaço de código) onde você define o jogador como espectador quando ele se conecta no sistema de registro/login? Além disso, você usa algum outro script de filtro, exceto o modo de jogo principal? Nesse caso, cada filterscript deve estar com #define FILTERSCRIPTe anticheat também deve ser incluído nele após esta definição.

Here is access to the code, I don't feel bothered to expose it here.

https://github.com/Telzin2k/login_register/blob/main/login_register.inc

There is also another problem, when the player is spawned he is expelled by teleport hack (onfoot).

In line "87" the player is spawned, and then in "SetPlayerLastPosition(playerid)" in line "30" the player's position is defined and as soon as the player goes to his last position that is where he is kicked from the server by teleport hacker.

NexiusTailer commented 8 months ago

Oh, that's probably because you use y_hooks, so the regular ALS hooks from the anticheat comes after yours in the hook chain and their order is wrong in the end. I've seen a couple of reports on this before and there is actually a possible solution from my side (using pre-hooks like weapon-config does now), but there were some problems on production servers with it and I didn't have enough time for their debugging.

At the moment, I suggest to use regular ALS hooks at least for OnPlayerConnect and OnPlayerSpawn, until I find a solution (basically, implement pre-hooks support in the anticheat after I debug and fix issues with it which had appeared earlier).