Get Vehicle & NPC List Table

Hello, I am trying to return a table of all available Vehicles and NPC’s on the server. I have successfully returned tables for entities, weapons, and tools using similar methods.

vehicles.GetTable() is giving me a nil error:
[ERROR] attempt to index global ‘vehicles’ (a nil value)

and I can’t find any functions to return a NPC list…

Any help would be greatly appreciated!
Thanks in advance :]

See how spawnmenu does it in sandbox. list.Get functions are used IIRC.

list.Get( “Vehicles” ) & list.Get( “NPC” )

Thank you very much for the suggestion Robotboy665! :slight_smile:

EDIT: This works wonderfully for the NPC’s.
Vehicles on the other hand are another thing…
The table returns a list of all vehicles inside the actual Vehicles tab but none from the SCars tab, I am assuming that an SCar is technically a vehicle and hopefully not an entity(yes i realize vehicles are entities but I hope you understand what i’m getting at)

So, assuming SCars are truly Vehicles, how does one return a list of all registered vehicles?
Why wont vehicles.GetTable() work? http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index107b.html

That wiki you are looking at is outdated, vehicles.GetTable() does not exist anymore.

I realize its outdated, nevertheless it has much more information than any other wiki i’ve come across.
This is from wiki.garrysmod.com
GM:GetVehicles() which is derived from vehicles.GetTable()
http://wiki.garrysmod.com/page/GM/GetVehicles

Calling “local VehiList = GetVehicles()” errors:
[ERROR] attempt to call global ‘GetVehicles’ (a nil value)

and calling “local VehiList = GM:GetVehicles()” errors:
[ERROR] attempt to index global ‘GM’ (a nil value)

I even attempted to use list.Get(“SCars”) which I figured would return an empty table, which it did…

Well you should check out how SCars builds it’s own tab. They are not source vehicles ( I believe they are using a chair from normal vehicles tab - everything else is a separate entity. ). If they don’t appear in Vehicles tab obviously they won’t be in the list.

I’m just trying to future proof my addon is all in case another vehicle pack comes along that makes its own tab. For now I’ll add them in however SCars builds their tab. :]

Thank you all for your help!

[editline]26th June 2013[/editline]

list.Get( “SCarVehicles” ) Is what I needed, Looking inside the SCar Slim source helped me to figure this out as suggested by Robotboy665 :wink: