open.mp icon indicating copy to clipboard operation
open.mp copied to clipboard

Two critical behavior diffs which break ac checks

Open NexiusTailer opened this issue 1 year ago • 2 comments

Describe the bug There are a couple of problems in omp server behavior which produce false detections for the server-side anticheat and actually can be (and should be) fixed on the side of omp server itself.

  • [ ] The first issue appears when the player was in spectating mode and leaves from it, the server instantly sets him PLAYER_STATE_NONE which must not be used anywhere except as a bare "just-after-connection" state (when no any other state were set before), because this is the only documented behavior in samp server for this state. Setting it between two other states while playing leads to ruining anticheat logic if it tries to make sane checks (like checks for skipping PLAYER_STATE_SPAWNED, when cheaters send onfoot sync just after connection). The place where this kludge is located is probably here.
  • [x] The second issue was found recently, but seems it persist for a long time too, it's when the server gives a player any non-bullet weapon (for example, brass knuckles or any melee like chainsaw, flowers etc) with ammo set to 0. After player received such weapon in hands, he can switch his current weapon to any other slot and then switch back to new weapon to hold it again. Just after these actions GetPlayerWeapon, GetPlayerAmmo and other functions will return 0 as server cleared the whole slot from both weapon and ammo, probably because ammo was already 0 so it considers the weapon also disappeared and thus can be cleared from data, but it's not.

To reproduce the first issue

  1. Toggle a player spectating mode, set some other player for him to spec on
  2. Toggle it off by the server or wait until the one he's spectating on will left the game, so our player will be spawned
  3. Log OnPlayerStateChange, it usually show that his state was changed to 0 and only then to the real one after it

To reproduce the second issue

  1. Give player some non-bullet weapon with ammo 0:
GivePlayerWeapon(playerid, 9, 0); // Chainsaw
  1. Let him switch his holding weapon back and forth
  2. Obtain values from GetPlayerWeapon and GetPlayerAmmo

Release version Latest v1.3.1.2748, but both issues also exist on older builds

NexiusTailer avatar Oct 20 '24 11:10 NexiusTailer