~Problem Sloved~
i have a file that send things to other players that join my server >
this 1
resource.AddFile("addons/Harry Potter/models/harry/harry_potter.dx90.vtx")
wont send all vtx files wont send :S every 1 is waiting for ages but it wont download also i haz that with .vtf files :Z! :( help plz ?
[b][url=http://wiki.garrysmod.com/?title=Resource.AddFile]Resource.AddFile [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
Is used for sending an entire folder.
[b][url=http://wiki.garrysmod.com/?title=Resource.AddSingleFile]Resource.AddSingleFile [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
Is used for sending a single file.
Also starts in root directory. Addon folders combine with the the roots folders anyway.
"models/harry/harry_potter.dx90.vtx" -> I think.
[QUOTE=goluch;24613597][b][url=http://wiki.garrysmod.com/?title=Resource.AddFile]Resource.AddFile [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
Is used for sending an entire folder.
[b][url=http://wiki.garrysmod.com/?title=Resource.AddSingleFile]Resource.AddSingleFile [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
Is used for sending a single file.
Also starts in root directory. Addon folders combine with the the roots folders anyway.
"models/harry/harry_potter.dx90.vtx" -> I think.[/QUOTE]
allright so its like this
When i use
resource.Addfile("file")
thats for sendin folderS?
and like this >
addons/Harry Potter
:D ? ( thats folder for harrypotter model :Z)
i found this
[url]http://www.garrysmod.org/downloads/?a=view&id=109499[/url]
but when i do this :
AddDir("mapname")
it dont even download the files :z
[QUOTE=goluch;24613597][b][url=http://wiki.garrysmod.com/?title=Resource.AddFile]Resource.AddFile [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
Is used for sending an entire folder.
[b][url=http://wiki.garrysmod.com/?title=Resource.AddSingleFile]Resource.AddSingleFile [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
Is used for sending a single file.
Also starts in root directory. Addon folders combine with the the roots folders anyway.
"models/harry/harry_potter.dx90.vtx" -> I think.[/QUOTE]
Wrong. [b][url=http://wiki.garrysmod.com/?title=Resource.AddSingleFile]Resource.AddSingleFile [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] is to add a SINGLE file.
What [b][url=http://wiki.garrysmod.com/?title=Resource.AddFile]Resource.AddFile [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] does is, if you do: [code]resource.AddFile( "models/test.mdl" )[/code] it will automatically add the related files such as the test.vtx, test.dx90.vtx etc. [code]resource.AddSingleFile( "models/test.mdl" )[/code] will ONLY add test.mdl.
[QUOTE=Capsup;24624275]Wrong. [b][url=http://wiki.garrysmod.com/?title=Resource.AddSingleFile]Resource.AddSingleFile [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] is to add a SINGLE file.
What [b][url=http://wiki.garrysmod.com/?title=Resource.AddFile]Resource.AddFile [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] does is, if you do: [code]resource.AddFile( "models/test.mdl" )[/code] it will automatically add the related files such as the test.vtx, test.dx90.vtx etc. [code]resource.AddSingleFile( "models/test.mdl" )[/code] will ONLY add test.mdl.[/QUOTE]
will this work
[code]
function AddDir(dir) // recursively adds everything in a directory to be downloaded by client
local list = file.FindDir("../"..dir.."/*")
for _, fdir in pairs(list) do
if fdir != ".svn" then // don't spam people with useless .svn folders
AddDir(fdir)
end
end
for k,v in pairs(file.Find("../"..dir.."/*")) do
"highlight">AddDir(dir)
end
end
AddDir("addons/Master Chief Playermodel")
AddDir("addons\Master Chief Playermodel")
[/code]
[QUOTE=goluch;24613597][b][url=http://wiki.garrysmod.com/?title=Resource.AddFile]Resource.AddFile [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
Is used for sending an entire folder.
[b][url=http://wiki.garrysmod.com/?title=Resource.AddSingleFile]Resource.AddSingleFile [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
Is used for sending a single file.
Also starts in root directory. Addon folders combine with the the roots folders anyway.
"models/harry/harry_potter.dx90.vtx" -> I think.[/QUOTE]
You clearly dont know what you're talking about.
[url]http://www.facepunch.com/showthread.php?p=21508609[/url]
[QUOTE=SeveredSkull;24664880]Are you including this in the init.lua file?[/QUOTE]
server/autorun
resource.lua
file i puted the code in :Z
but it wont download the models !~:(
It should be lua/autorun/server/resource.lua
autorun/server only calls the contained files serverside so you don't need the if SERVER then stuff
Also resource.lua is too likely a filename for other addons to have as well. Try and make the filename less generic.
This allows you to add Directories to your servers FstDl rather than each individual file.
Go into your lua/autorun/server folder on your server and put this in a Lua file that you can call whatever you want.
[lua]
function AddDir(dir) -- recursively adds everything in a directory to be downloaded by client
local list = file.FindDir("../"..dir.."/*")
for _, fdir in pairs(list) do
if fdir != ".svn" then -- don't spam people with useless .svn folders
AddDir(dir.."/"..fdir)
end
end
for k,v in pairs(file.Find("../"..dir.."/*")) do
resource.AddFile(dir.."/"..v)
end
end
AddDir("models/test/")
AddDir("")
[/lua]
You can add extra directories if you want, But never add in the Base of the directory
so do not use "AddDir("models/") As this will add any model you have on your server into the downloads
even Ep2 ep1 and CSS content.
If you have individual files inside models/ or materials/ You will have to use
[lua]
resource.addfile("dir/dir/dir/Filename.Extension");
[/lua]
For those Individual files.
: this is what server does :
He find the models he says download textures models blablabla :S
Allright..
so when he try to download something , ( like uhm.. blabla.vtf )
It look likes he downloading
( download balk will just load with white balks )
but then nothing happends ;p he's for ever stuck on that file ( no gmod is not crashed ) its like he still try's to download that file :l
cause
this happends :
I join my server
It trys to download a texture
It look likes he downloading > down right the download balk is just filling with white blocks
After balk is full the texture is not downloaded
The balk > down right at the botem does nothing
TADA :p
[editline]07:55PM[/editline]
- can soomeee 1 show me like 1 of his resource.AddFile("THIS PATH")
of models ?
Thanks
[editline]07:58PM[/editline]
this is the model i want to add ,
( the path to whole directory ) addons/Harry Potter
:S
Any 1 got an idea !?!?!?!?!? :l !:l
can i also use this
AddDir( "addons/Trailsmaterials/trails" ) :z
i use this ( full code )
[CODE]function AddDir(dir) -- recursively adds everything in a directory to be downloaded by client
local list = file.FindDir("../"..dir.."/*")
for _, fdir in pairs(list) do
if fdir != ".svn" then -- don't spam people with useless .svn folders
AddDir(dir.."/"..fdir)
end
end
for k,v in pairs(file.Find("../"..dir.."/*")) do
resource.AddFile(dir.."/"..v)
end
end
AddDir( "addons/Trails/materials/trails" ) [/CODE]
[EDIT]
i get it ! Its like now ,
AddDir( "Trails/materials/trails" ) ?= directory of files like .vmt etc :Z
cant i do it with add dir ? :*( :l
Also, ( the directory of the whole file > )
C:\srcds\orangebox\garrysmod\addons\Trails\materials\trails
how should i do it then :( ?i read it like 20 times but dont rly get it
like
resource.AddFile ("models/trails/materials/trails/file1.vmt")
< eg
[QUOTE=Siemz;24732317]
resource.AddFile ("models/trails/materials/trails/file1.vmt")
[/QUOTE]
Good Job! But I dont think that that is a valid path... No idea why the hell you have materials in a models folder.
[editline]11:25AM[/editline]
Valid as in "makes sense" obviously it would work but again, you shouldnt be storing textures in a models folder.
[QUOTE=SeveredSkull;24733601]Good Job! But I dont think that that is a valid path... No idea why the hell you have materials in a models folder.
[editline]11:25AM[/editline]
Valid as in "makes sense" obviously it would work but again, you shouldnt be storing textures in a models folder.[/QUOTE]
Allright THNX alot :D! <3 trying now !
but wasnt it like i only haz to add
model.mdl then it will download the other things it self :z ?
ps full path to it is >
C:\srcds\orangebox\garrysmod\addons\Trails\materials\trails
so i also dont think it isn't right xD
[editline]10:29PM[/editline]
-Fixed ! THANKS ALOT :D!@ FOR ALL YOU'RE HELP ! :D!~
Sorry, you need to Log In to post a reply to this thread.