Skip to content

Conversation

@Cocodrulo
Copy link
Contributor

@Cocodrulo Cocodrulo commented Sep 20, 2025

Description

This pull request adds a fallback implementation for vehicle-related player events in server/events.lua to ensure core vehicle event handling works even if the baseevents resource is not running. The new code tracks when a player enters, aborts entering, enters, or leaves a vehicle, and triggers the appropriate server events.

Baseevents fallback implementation:

  • Added a thread that monitors the player's vehicle interactions and triggers server events (baseevents:enteringVehicle, baseevents:enteringAborted, baseevents:enteredVehicle, baseevents:leftVehicle) when the baseevents resource is not started. This ensures consistent vehicle event handling regardless of resource state.
  • Implemented a helper function GetPedVehicleSeat to determine the seat index the player occupies in a vehicle.

Checklist

  • I have personally loaded this code into an updated qbcore project and checked all of its functionality.
  • My code fits the style guidelines.
  • My PR fits the contribution guidelines.

Implements client-side detection and server event triggers for entering, aborting, entering, and leaving vehicles when the 'baseevents' resource is not started. This ensures vehicle-related events are still handled even if the baseevents resource is unavailable.
Copy link

@Cisternita Cisternita left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not useful

@Cocodrulo
Copy link
Contributor Author

Cocodrulo commented Oct 31, 2025

not useful

Why not? Why make a full event of QBCore relly on the existance of a script or not in the server and don't have a fallback?

@Qwerty1Verified
Copy link
Member

I haven't tested this event personally, but could we benefit from using the CEventNetworkPlayerEnteredVehicle game event instead of the thread?

@Cocodrulo
Copy link
Contributor Author

I don't think that event will detect the seat change

@Qwerty1Verified
Copy link
Member

Do you mean when someone shuffles seat without leaving the vehicle?

@Cocodrulo
Copy link
Contributor Author

exactly

@Cocodrulo
Copy link
Contributor Author

And also when entering is aborted

@Qwerty1Verified
Copy link
Member

From what I see, the current logic is: if not inVehicle -> if IsPedInVehicle -> Get Seat. This check only seems to occur during the transition from no vehicle to a new vehicle. The same goes for if the loop runs whilst they're trying to get into a vehicle: if not inVehicle -> if GetVehiclePedIsTryingToEnter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants