Skip to content

Conversation

@Zangomangu
Copy link
Contributor

#1907 allowed dead peds to send entry/exit packets, because this is necessary to fix #908
This PR fixes #2335 by not allowing a dead ped to enter a vehicle (serverside).

But why is this clientside check in CClientPed::EnterVehicle not preventing a dead ped from sending a packet?

if (IsDead())
{
return false;
}

Because in CClientPed::IsDead when the ped is streamed it queries gta for TASK_SIMPLE_DEAD instead of returning m_bDead, and the task probably isn't initiated yet before the next frame (and it processed the player wasted packet from killPed and entity destroy packet from destroyElement in the same frame, so when CClientGame::DoVehicleInKeyCheck() is pulsed afterwards the player appears to be alive and outside a vehicle for that 1 frame).

@patrikjuvonen patrikjuvonen added the bug Something isn't working label Sep 5, 2021
@Lpsd
Copy link
Member

Lpsd commented Sep 6, 2021

PR works great, fixes #2335 - although we did stumble upon an issue that has probably been present in MTA since forever, but up until now has only been applicable to players - since peds can now be jacked it also applies to them.

I've linked the Discord discussion below - but essentially there should be a check on how often a player can attempt to get in/out of a vehicle. If you were to spawn the player directly after destroying the vehicle (same circumstances as in #2335), the "timers" for that check will be reset - meaning if you happen to spawn next to a player/ped who is in a vehicle, you might end up jacking them.

There's no obvious fix to that yet without potentially breaking other stuff. It's a bug that only applies under very specific circumstances; which as I mentioned has been present with players since most likely forever, and which can also partly be blamed on bad logic from the server/scripter - so I don't think we need to worry about it applying to peds now too. #INABIAF

https://discord.com/channels/801330706252038164/801411628600000522/884517276936712193

anyway - this PR fixes the case described in #2335 and shouldn't affect anything else, so we're good here... :shipit:

@patrikjuvonen
Copy link
Contributor

Thanks!

@patrikjuvonen patrikjuvonen changed the title Fix #2335: Dont allow dead peds to enter vehicles Fix #2335: Don't allow dead peds to enter vehicles Sep 8, 2021
@patrikjuvonen patrikjuvonen merged commit e13c374 into multitheftauto:master Sep 8, 2021
@botder botder added this to the Next Release (1.5.9) milestone Sep 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

onVehicleStartExit incorrectly triggers after #1907 Player / vehicle desync after car jacking, if jacker die

4 participants