resource.AddSingleFile

From GMod Wiki

Jump to: navigation, search
Function
Syntax resource.AddSingleFile( String filename )
Where is this used?
Description:
Adds a single file to the download list for clients.
Returns: nil
Part of Library: resource
Realm: NewerServer.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Resource.AddSingleFile]Resource.AddSingleFile [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionSend the counter strike font to all the clients that decide to play on the server.
Used onNewerServer.png
Code
 
resource.AddSingleFile( "resource/fonts/csd.ttf" )
 
OutputN/A


DescriptionAdds the entire content folder from a gamemode.
Used onNewerServer.png
Code
local path = "../"..GM.Folder.."/content"
local folders = {""}
while true do
	local curdir = table.remove(folders,1)
	if not curdir then break end
	local searchdir = path..curdir
	for _, filename in ipairs(file.Find(searchdir.."/*")) do
		if filename ~= ".svn" then
			if file.IsDir(searchdir.."/"..filename) then
				table.insert(folders,curdir.."/"..filename)
			else
				resource.AddSingleFile(string.sub(curdir.."/"..filename,2))
			end
		end
	end
end
OutputN/A


Additional Notes

See Also

resource.AddFile

Generating A Resources File for a SWEP or SENT (Linux)

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox