highwaywarrior Posted March 18, 2021 Share Posted March 18, 2021 I tried getVehicleComponents but it always gets all components of the vehicle, and its the only function I found about getting vehicle components. Is it possible to get specific vehicle components by dummy/object name or something like that? Link to comment
Scripting Moderators xLive Posted March 18, 2021 Scripting Moderators Share Posted March 18, 2021 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 comment
highwaywarrior Posted March 19, 2021 Author Share Posted March 19, 2021 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 comment
SpecT Posted March 19, 2021 Share Posted March 19, 2021 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 ) 1 Link to comment
highwaywarrior Posted March 19, 2021 Author Share Posted March 19, 2021 Thank you so much! 1 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now