Make vehicle customization available server-side

Hi

This request I following up a discussion we were having with dbub on the discord.
You can read it here, but I will explain in detail so this is not strictly needed : Discord

Original concern :
Developers want to be able to create and customize vehicle server-side.
This is because of security and simplicity when using entity lockdown.

Bad methods currently used by developers consist of putting a player the vehicle driver seat, then waiting for the player to have control, then send to the player an event to put the vehicles custom.

A proposed better way is to use a state bag, then apply vehicle customs when a player has ownership of the vehicle. This is currently the best solution to this problem (even tho most developers don’t do it this way).

A better solution to this would be :

  • RPC for these customisation natives
  • Actually modifying state on the server (this seems more complicated)

Here is a list of used natives to set vehicle state from multiple developers scripts :

  • SET_VEHICLE_MOD_KIT
  • SET_VEHICLE_MOD
  • SET_VEHICLE_ENVEFF_SCALE
  • SET_VEHICLE_NUMBER_PLATE_TEXT_INDEX
  • SET_ENTITY_RENDER_SCORCHED
  • SET_VEHICLE_FIXED
  • SET_VEHICLE_ENGINE_HEALTH
  • SET_VEHICLE_PETROL_TANK_HEALTH
  • SET_VEHICLE_FUEL_LEVEL
  • SET_VEHICLE_EXTRA_COLOURS
  • SET_VEHICLE_WHEEL_TYPE
  • SET_VEHICLE_WINDOW_TINT
  • SET_BOAT_ANCHOR
  • _SET_BOAT_MOVEMENT_RESISTANCE
  • _SET_BOAT_FROZEN_WHEN_ANCHORED
  • _SET_FORCED_BOAT_LOCATION_WHEN_ANCHORED
  • SMASH_VEHICLE_WINDOW
  • SET_VEHICLE_TYRE_BURST
  • SET_VEHICLE_DOOR_SHUT
  • SET_VEHICLE_DOOR_OPEN
  • SET_VEHICLE_TYRE_BURST
  • SET_VEHICLE_DAMAGE
  • SET_VEHICLE_TYRES_CAN_BURST
  • _SET_HELI_MAIN_ROTOR_HEALTH
  • _SET_HELI_TAIL_ROTOR_HEALTH
  • _SET_TYRE_HEALTH
  • _SET_REDUCE_DRIFT_VEHICLE_SUSPENSION
  • _SET_DRIFT_TYRES_ENABLED
  • SET_VEHICLE_WHEEL_X_OFFSET
  • SET_VEHICLE_WHEEL_Y_ROTATION
  • _SET_VEHICLE_NEON_LIGHT_ENABLED
  • SET_VEHICLE_EXTRA
  • SET_VEHICLE_EXTRA_COLOURS
  • _SET_VEHICLE_NEON_LIGHTS_COLOUR
  • _SET_VEHICLE_XENON_LIGHTS_COLOR
  • _SET_VEHICLE_INTERIOR_COLOR
  • TOGGLE_VEHICLE_MOD
  • SET_VEHICLE_TYRE_SMOKE_COLOR
  • SET_VEHICLE_LIVERY

Here is also a list of getter natives that are not currently available server-side :

  • GET_VEHICLE_TRAILER_VEHICLE
  • _GET_TYRE_HEALTH
  • GET_VEHICLE_ENVEFF_SCALE
  • _GET_VEHICLE_XENON_LIGHTS_COLOR
  • IS_VEHICLE_WINDOW_INTACT
  • IS_VEHICLE_DOOR_DAMAGED
  • _GET_DRIFT_TYRES_ENABLED
  • GET_VEHICLE_TYRES_CAN_BURST
  • GET_HELI_MAIN_ROTOR_HEALTH
  • GET_HELI_TAIL_BOOM_HEALTH
  • GET_HELI_TAIL_ROTOR_HEALTH
  • _IS_VEHICLE_NEON_LIGHT_ENABLED
  • _GET_VEHICLE_NEON_LIGHTS_COLOUR
  • GET_VEHICLE_TYRE_SMOKE_COLOR
  • GET_VEHICLE_MOD
  • IS_TOGGLE_MOD_ON
  • GET_VEHICLE_MOD_VARIATION
  • _IS_BOAT_ANCHORED_AND_FROZEN

These getter natives will probably also be used by RP peoples to get vehicle properties when “saving a vehicle”, then re-creating a vehicle later when needed with the appropriate setter natives.

This list is inspired by multiples vehicles scripts from multiples gamemodes (RP QB-CORE, RP ESX, Gungame servers that create vehicles, KOTH) and would serve different uses case in each one of them.

This request is here to help and remove hacky ways of setting vehicles state on client side, hoping this can help people like Avarian or Pichot in their quest of creating vehicle server side.

If you need any more information, feel free to ask.

3 Likes

Two of the native getter are now in process of being added in the following PR thanks to @MRV6 :

Seems like he has taken interest in adding some getter natives with already 3 in process PR :slight_smile:

1 Like

hope they implement your idea. its very good and many dev would love it!