citizenfx / fivem

The source code for the Cfx.re modification frameworks, such as FiveM, RedM and LibertyM, as well as FXServer.
https://cfx.re/
3.55k stars 2.09k forks source link

Spawning a motorcycle server-side will result in a wrong vehicle being spawned and ... #2145

Closed Keyinator closed 1 year ago

Keyinator commented 1 year ago

Additionally, our anticheat (not a sold one, self-developed) will trigger since the equipped weapon while in the wrong vehicle will yield a WeaponHash of 0. (This does not happen with other vehicles)

System-Specs (Server):

OS: Ubuntu 22.04 LTS Server-Artifact: 6594 and 6622 (latest) Note: We do not attribute this issue on the server since the issue appeared today with artifact 6594 and no changes done to either the server or code.

Code:

Server-Side vehicle-spawning:

int veh = SpawnVehicle(GetHashKey(frakCarName), spawn.x, spawn.y, spawn.z, spawn.heading);

Client-Side code invoking the ban:

int currentWeapon = GetSelectedPedWeapon(PlayerPedId());
bool triggered = !allowedWeapons.Contains((uint)currentWeapon) && currentWeapon != -1569615261;

if (triggered) {
  //BAN PLAYER
}

Further info

The issue appears on any of the client update-channels and seems to appear for any user. I assume that the WeaponHash of 0 is somehow introduced by the wrong model being spawned. The server is in EntityLockdownMode strict. Video of the issue: https://www.youtube.com/watch?v=j4imo-zMBdk (You can view the supposed model and picture in the ui)

Assumptions / Attribution

The degradation might have been introduced by: https://github.com/citizenfx/fivem/commit/be6154a9974321187f641ab72707771a67bcc6a8 due to the time-correlation if it has already been published to the client. This is a very rough guess. I am assuming that either the server obtains a faulty hashkey in the above code and/or the client wrongly interprets information obtained by the server.

Keyinator commented 1 year ago

Update: With https://github.com/citizenfx/fivem/pull/2144 the issue seems to have been found. I will update with results once this has been pushed to the client.

Keyinator commented 1 year ago

Update: Tested this with client on latest and the issues do not appear anymore.