GetVehicleComponents: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 28: Line 28:
         end
         end
     end
     end
)
</syntaxhighlight>
</section>
==Example==
<section name="Server" class="server" show="true">
<syntaxhighlight lang="lua">
addEventHandler("onVehicleEnter", root,
function(thePlayer, seat, jacked)
  for _, v in pairs do (getVehicleComponents(source)) do
  outputChatBox(v, thePlayer, 0, 255, 0)
end
end
)
)
</syntaxhighlight>
</syntaxhighlight>

Revision as of 07:35, 20 October 2013

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
)

See Also