Vehicle inspector for FiveM
Creates dynamic showroom cameras to inspect a vehicle and adds interactive rotation with the mouse. Useful for cardealers / showrooms.
- Drop the
vInspector
directory into youresources
directory - Add
ensure vInspector
to yourserver.cfg
file - Add
'@vInspector/inspector.lua'
to theclient_scripts
table in thefxmanifest.lua
of the resource(s) that will be using it:
client_scripts {
'@vInspector/inspector.lua',
...
}
Simply pass the model name of the vehicle you want to spawn and the coords (as a vector4
type) to the constructor:
local myInspector = Inspector:Create({
model = 'adder', -- the vehicle model name
coords = vector4(-791.61, -217.96, 36.40, 90.00), -- the spawn coords
hasRearEngine = true, -- whether the vehicle is rear / mid-engined
engineCompartmentIndex = 5, -- engine compartment doorIndex
putInVehicle = false, -- whether to put the player in the vehicle or spawn a clone (required for cockpit view)
easeIn = false, -- whether to smoothly transition to the inspector camera
easeOut = false, -- whether to smoothly transition back to the player camera
revolve = true, -- whether to set the vehicle as revolving when entering inspector
rotate = true, -- whether to allow mouse-controlled rotation
zoom = true, -- whether to allow zoom in / out
toggleEngine = true, -- whether to allow toggling the engine on and off
views = { 'front', 'rear', 'side', 'wheel', 'engine', 'cockpit' } -- available views
primaryColor = { r = 255, g = 255, b = 255 } -- set the vehicle's primary colour
})
F
- Switches to'front'
viewS
- Switches to'side'
viewR
- Switches to'rear'
viewC
- Switches to'cockpit'
viewE
- Switches to'engine'
view (if it has a valid engine compartment door)G
- Switches to'wheel'
viewBACKSPACE
Switches to'main'
view or exits the inspector if already in'main'
view.SPACE
- Toggles auto-revolve ('main'
view only)LSHIFT
- Toggles the vehicle's engineLMB
+MOUSEMOVE
- Rotates the vehicle ('main'
view only)MOUSEWHEEL
- Zooms In / Out ('main'
view only)
The player is able to look around the cockpit while in 'cockpit'
view
Note: For the 'engine'
view there is list of rear/mid-engined vehicles included. If you use custom cars with rear/mid engines then you'll need to set the hasRearEngine
option to true
so the camera will focus on it correctly.
Some custom vehicles with rear / mid engines have the rear compartment door index incorrectly set to 4
(the bonnet) - if this is the case, then you need to set the engineCompartmentIndex
to 4
otherwise the default index of 5
(the boot) will be used.
If the vehicle's engine compartment doesn't function then the instance will automatically remove the option for the 'engine'
view.
local myInspector = Inspector:Create({ ... })
myInspector:On('enter', function()
-- do something when entering the inspector
end)
myInspector:On('viewChange', function(view -- [[ string ]])
-- do something when the view is switched
end)
myInspector:On('exit', function()
-- do something when exiting the inspector
end)
- Allow controls to be customised
- Allow setting of vehicle attributes / mods
- Allow custom offsets / rotations for cameras
- Fix camera distance when motorcycles are used
- Some custom vehicles are badly made and the bounding boxes are off center which can cause the front / rear cameras to be misaligned - need to find a way of fixing this. Possibly use bones for alignment.