GetVehicleComponents

From Multi Theft Auto: Wiki
Revision as of 14:30, 26 July 2013 by Abxf (talk | contribs) (→‎Example)
Jump to navigation Jump to search

ADDED/UPDATED IN VERSION 1.3.1 r4748:

This function gets a table of the components currently on a vehicle.

Syntax

table getVehicleComponents ( vehicle theVehicle )

Required Arguments

  • theVehicle: The vehicle you wish to get the components of.

Returns

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

Example

Click to collapse [-]
Client
addCommandHandler ( "gvc",
    function ( )
        local theVehicle = getPedOccupiedVehicle ( localPlayer )
        if ( theVehicle ) then
            for k in pairs ( getVehicleComponents ( theVehicle ) ) do
                outputChatBox ( k )
            end
        end
    end
)

Example

Click to collapse [-]
Server
addEventHandler("onVehicleEnter", root,
 function(thePlayer, seat, jacked)
  for _, v in pairs do (getVehicleComponents(source)) do
   outputChatBox(v, thePlayer, 0, 255, 0)
 end
end
)

See Also