Marking a vehicle as ‘player vehicle’ for game code

A recent finding from the forums is that the GTA game code checks for the presence of a decorator named player_vehicle on entities to enable/disable certain behavior for player-driven vehicles (e.g. personal vehicles?).

Among other things, this includes:

  • Radio emitters for the radio station the car is playing
  • Some special behavior for entering the vehicle via a door (i.e. the ‘enter vehicle’ key)

Example code

-- somewhere *once* during initialization
DecorRegister("Player_Vehicle", 3)

-- on a vehicle
if DecorIsRegisteredAsType("Player_Vehicle", 3) then
    DecorSetInt(vehicle, "Player_Vehicle", -1)
end

Leave a comment

Your email address will not be published. Required fields are marked *