Garry's Mod Wiki

Revision Difference

Global.GenerateSpawnlistFromPath#549459

<function name="GenerateSpawnlistFromPath" parent="Global" type="libraryfunc"> <description>This function adds all models from a specified folder to a custom Spawnlist category. Internally uses <page>Global.AddPropsOfParent</page> <warning>Using this function before <page>SANDBOX:PopulateContent</page> has been called will result in an error</warning></description> <realm>Client</realm> <file line="24-L41">gamemodes/sandbox/gamemode/spawnmenu/creationmenu/content/contenttypes/gameprops.lua</file> <args> <arg name="folder" type="string">the folder to search for models</arg> <arg name="path" type="string">The path to look for the files and directories in. See <page text="this list">File_Search_Paths</page> for a list of valid paths.</arg> <arg name="name" type="string">The Spawnmenu Category name</arg> <arg name="icon" type="string" default="icon16/page.png">The Spawnmenu Category Icon to use</arg> <arg name="appid" type="number">The AppID which is needed for the Content</arg> </args> </function> <example> <description>Creates a Example Category</description> <code> hook.Add("OnSpawnMenuOpen", "Example", function() hook.Add("SpawnMenuCreated", "Example", function() GenerateSpawnlistFromPath("models/player", "GAME", "Example") end) </code> </example>