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

Suspected cheating after destroying a dynamic pickup #272

Closed Walter-Correa closed 2 years ago

Walter-Correa commented 2 years ago

I create a dynamic type 1 pickup and when the player picks up this pickup it is destroyed.

The following message appears: [Nex-AC debug] Pickupid: 12, dist: 2980.294677, dist set: 2795.555664, acSet[7]: -1, playerid: 0 [Nex-AC] Suspicion on the ID 0. Reason code: 006 (1)

NexiusTailer commented 2 years ago

Did you include streamer before the anticheat so it could handle dynamic pickups too?

Walter-Correa commented 2 years ago

Did you include streamer before the anticheat so it could handle dynamic pickups too?

Yes, it is included before

Walter-Correa commented 2 years ago

When the player picks up in OnPlayerPickUpDynamicPickup I use the code: DestroyDynamicPickup(pickupid);

NexiusTailer commented 2 years ago

Maybe you're using OnPlayerPickUpDynamicPickup inside a hook in some module which was included before the anticheat, so, it destroys a pickup before it's checked in validation checks for distance to it (in the ac itself)? This could be also due to y_hooks used on this callback so it will have a higher priority to be called there, than by normal ALS hooks.

Walter-Correa commented 2 years ago

I don't use any YSI include! These are the includes before the anti cheat include:

#include <a_samp>
#include <progress2>
#include <strlib>
#include <foreach>
#include <streamer>
#include <YSF>
#include <sscanf2>
#include <Pawn.RakNet>
#include <nex-ac>
Walter-Correa commented 2 years ago

Maybe you're using OnPlayerPickUpDynamicPickup inside a hook in some module which was included before the anticheat, so, it destroys a pickup before it's checked in validation checks for distance to it (in the ac itself)? This could be also due to y_hooks used on this callback so it will have a higher priority to be called there, than by normal ALS hooks.

I tried:

#include <a_samp>
#include <streamer>
#include <nex-ac>

But nothing has changed!

NexiusTailer commented 2 years ago

I think I have found the problem: Dynamic pickups call both callbacks OnPlayerPickUpDynamicPickup as the first and OnPlayerPickUpPickup after this. For this reason, anticheat needs to check if the pickup which has passed in OnPlayerPickUpPickup is not streamer's pickup. Thus, when you have a lot of streamer pickups and pick one of them, it destroys in OnPlayerPickUpDynamicPickup and then, when the deal comes to OnPlayerPickUpPickup, this pickups cannot be identified as a valid dynamic pickup (because it was just destroyed so it's not valid anymore). So, for this reason, every single ac check inside OnPlayerPickUpPickup suggests that it's a regular non-streamer pickup which really exists by coincidence (and this is a completely different pickup).

Meanwhile, the default anticheat settings ignores any kicks for code 006 (it just rejects picking up a pickup which wasn't be picked due to long distance to it, if you return 0 in OnCheatDetected for this code). Keep having this approach prevents any other unwanted code from executing in case the ac code 006 is triggered so you still don't allow cheaters to pick up real pickups from a distance, but at the same time have no kick for that, only the log messages (in case of such a bug).

Walter-Correa commented 2 years ago

I understood! So it is not possible to fix this?

NexiusTailer commented 2 years ago

I understood! So it is not possible to fix this?

Currently I don't see any easy ways