Skip to content

Conversation

@Cocodrulo
Copy link
Contributor

Describe Pull request
This pull request refactors the client/main.lua script to improve vehicle handling and code consistency. The main focus is on standardizing function calls, enhancing vehicle blacklist management, and ensuring proper argument usage for game-native functions. Below are the most important changes:

Vehicle Blacklist Management

  • Refactored the isBlacklistedVehicle, addNoLockVehicles, and removeNoLockVehicles functions to be defined earlier in the file to make them local (and still work) following the lowercase first letter of the function. [1] [2]

Standardization of Native Function Calls

  • Standardized calls to GetVehiclePedIsIn, IsPedInVehicle, and IsPedDeadOrDying throughout the file by explicitly passing the lastVehicle argument (usually false), ensuring consistent and expected behavior. [1] [2] [3] [4] [5] [6]

Command Registration Improvements

  • Updated command registrations (e.g., togglelocks and engine) to include the false argument, clarifying that these commands should not be restricted to the game's console.

Vehicle Door and Trunk Handling

  • Updated SetVehicleDoorOpen and SetVehicleDoorShut calls in ToggleVehicleTrunk to include all arguments, aligning with native function signatures and preventing potential issues.

Minor Code Consistency Fixes

  • Changed SetPedFleeAttributes and SetTextProportional to use boolean values for clarity and consistency with native expectations. [1] [2]

If your PR is to fix an issue mention that issue here

Questions (please complete the following information):

  • Have you personally loaded this code into an updated qbcore project and checked all it's functionality? No
  • Does your code fit the style guidelines? Yes
  • Does your PR fit the contribution guidelines? Yes

Moved and exported isBlacklistedVehicle, addNoLockVehicles, and removeNoLockVehicles functions to the top of the file for better organization. Updated various native function calls to include missing parameters for consistency and correctness. Improved command registration by adding the 'false' argument to prevent command duplication. Made minor logic and safety improvements in vehicle and ped handling.
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.

1 participant