Garry's Mod Wiki

GenerateSpawnlistFromPath

  GenerateSpawnlistFromPath( string folder, string path, string name, string icon = "icon16/page.png", number appid )

Description

This function adds all models from a specified folder to a custom Spawnlist category. Internally uses AddPropsOfParent

Using this function before SANDBOX:PopulateContent has been called will result in an error

Arguments

1 string folder
the folder to search for models
2 string path
The path to look for the files and directories in. See this list for a list of valid paths.
3 string name
The Spawnmenu Category name
4 string icon = "icon16/page.png"
The Spawnmenu Category Icon to use
5 number appid
The AppID which is needed for the Content

Example

Creates a Example Category

hook.Add("SpawnMenuCreated", "Example", function() GenerateSpawnlistFromPath("models/player", "GAME", "Example") end)