Jump to content

[HELP]Getting a Specific Vehicle Component


Recommended Posts

Yes

Quote

Returns a table containing the name of the component as the key and visibility flag of that component as the value

a simple example:

local value = getVehicleComponents(vehicle)["wheel_rf_dummy"]
if value then -- the value is true
	print("exists and visible")
elseif value == false then -- the value is false
	print ("exists and invisible")
else
	print("not exists") -- the value is nil
end




 

Link to post

Well, it doesnt do anything at all
I tried this too, nothing happens when i enter the vehicle

function ococo()
local theVehicle = getPedOccupiedVehicle (localPlayer) -- not needed, when you already have a vehicle 
if theVehicle then 
        local theVehicle = getPedOccupiedVehicle ( localPlayer )
        local getComponent = getVehicleComponents(theVehicle)["chassis_dummy"] -- get a table with all the components of the vehicle
        for compenent in pairs (getComponent) do
            setVehicleComponentVisible(theVehicle, compenent, false) -- hides the component
        end
end
end
addEventHandler ( "onClientVehicleEnter", root, ococo )

 

Link to post

Hey,

I think that this should be useful enough for you:

function ococo()
	local theVehicle = getPedOccupiedVehicle (localPlayer)
	if theVehicle then 
		local components = getVehicleComponents(theVehicle) -- get a table with all the components of the vehicle
		for k in pairs (components) do
			--outputChatBox(k) -- UNCOMMENT to get all the component names in chat
			--setVehicleComponentVisible(theVehicle, k, false) -- UNCOMMENT to hide all the vehicle componenets
		end
		setVehicleComponentVisible(theVehicle, "chassis", false) -- hide only the "chassis" component
	end
end
addEventHandler ( "onClientVehicleEnter", root, ococo )

 

  • Thanks 1
Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...