To spawn a TDM car, you just spawn “prop_vehicle_jeep”, set the Model, Position, Angle, SetKeyValue “vehiclescript” to the script.txt provided by TDM, Spawn and Activate it.
concommand.Add( "spawnvehicle", function( _p, _cmd, _args )
local _v = ents.Create( "prop_vehicle_jeep" ); -- Type of vehicle to spawn.
// Just in case the entity creation was unsuccessful.
if ( !IsValid( _v ) ) then return; end
_v:SetPos( _p:GetEyeTrace( ).HitPos + Vector( 0, 0, 50 ) ); -- Set vehicle position to spawn where we are looking, but off the ground 50 units ( where 16 units = 1 foot ).
_v:SetAngles( _p:GetAngles( ) + Angle( 0, 90, 0 ) ); -- Vehicles are rotated 90, so Left or so is typically their "Front"...
_v:SetModel( "models/tdmcars/blah.mdl" );
-- _v:SetSkin( 1 ); -- Optional, set the active skin.. For TDM it is usually 0-15 / 1-16..
_v:SetKeyValue( "vehiclescript", "scripts/vehicles/jeep.txt" );
_v:Activate( ); -- Activate needed for some vehicles such as prop_vehicle_airboat or it'll crash the server
To spawn other entities, you can use ents.Create to spawn them in the world. You can use Player:Give to give a weapon entity, etc etc…
If you want to list all files inside of a GMA file so you know which model to use, etc… You can list them using file.Find( “*”, title_of_workshop_item );
I made a tool that does this… Example: https://dl.dropboxusercontent.com/u/26074909/tutoring/_file_structure/addon_info_CLIENT.txt
It’ll be released soon on my dev-base… Basically it lists all files, and gives a brief overview ( maps, models, etc )…
But, because you’re having trouble finding model names, and other file-names without extracting… This may help you… The function to return a list of files: https://dl.dropboxusercontent.com/u/26074909/tutoring/_utilities/release/_get_addon_files.lua.html
it is used ( a newer / updated version will be released in fileio; but the file-list generator uses the addon table ):
for k, v in pairs( engine.GetAddons( ) ) do
local _files = fileio:GenerateAddonFileList( v );
local _info = fileio:GenerateAddonInfoList( _files );