Gamemode.GetSENTMenu

From GMod Wiki

Revision as of 23:39, 22 October 2009 by Crazy Quebecer (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Event Hook
Hook NameGetSENTMenu
SyntaxGM:GetSENTMenu( )
DescriptionWhen called upon by your gamemode, should return a datatable structure containing entries referring to SENTs that have been loaded clientside.
ReturnsTable :datatable
Lua StateNewerClient.png
BBCode[b][url=wiki.garrysmod.com/?title=Gamemode.GetSENTMenu]Gamemode.GetSENTMenu [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Examples

DescriptionThe standard implementation
Used onNewerClient.png
Code
 
 function GM:GetSENTMenu() 
 
 	local columns = {} 
 	columns[ 1 ] = "#Name" 
 	columns[ 2 ] = "#Author" 
 	columns[ 3 ] = "#Admin" 
 
 	local ret = {} 
 
 	table.insert( ret, columns ) 
 
 	local entlist = scripted_ents.GetList() 
 
 	for k,v in pairs( entlist ) do 
 
 		if ( v.t.Spawnable || v.t.AdminSpawnable ) then 
 
 			local entry = {} 
 			entry[ 1 ] 	= v.t.PrintName 
 			entry[ 2 ] 	= v.t.Author 
 			if ( v.t.AdminSpawnable && !v.t.Spawnable ) then entry[ 3 ]  = "ADMIN ONLY" else entry[ 3 ]  = "" end 
 			entry[ "command" ]  = "gm_spawnsent "..v.t.Classname 
 
 			table.insert( ret, entry )		 
 
 		end 
 
 	end 
 
 	return ret 
 
 end 
 
OutputN/A


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox