• Server won't force download playermodels
    11 replies, posted
I am having trouble on my ttt server as it won't download the player models when people join - people can only see them if they have already downloaded them. How can I make the server force downloads as the playermodels are already in my downloads for the server.
resource.AddFile for each .mdl / .vmt file.
You should be using: resource.AddFile("filePath/fileName") for things such as models/textures resource.AddSingleFile("filePath/fileName") if you want to download a single file only resource.AddWorkshop("workshopID") for items that are in the Steam Workshop These will force the client to download the file from your FastDL server, and if that's not available, forces it to download from the server itself(not applicable to AddWorkshop, as those come from the workshop itself). You can add these in your "init.lua", or create a "resources.lua" under "garrysmod\lua\autorun\server"
Okay, thanks. I'll try that now.
Didn't work
[QUOTE=Denchanator;42830750]Didn't work[/QUOTE] What are you using? Workshop, or manual FastDL?
Could you also post the file you placed in lua\autorun\server? [QUOTE=Safixk;42829257] resource.AddSingleFile("filePath/fileName") if you want to download a single file only [/QUOTE] I've never actually got this to work, to be honest. Like, I tried using it for a custom icon on a TTT swep, where it would only be one file, but it's just purple/black.
[QUOTE=NiandraLades;42838273]I've never actually got this to work, to be honest. Like, I tried using it for a custom icon on a TTT swep, where it would only be one file, but it's just purple/black.[/QUOTE] That's because SWEP icons have a VTF and a VMT (Err. Unless you're using a .PNG), one containing the texture itself (.vtf), and path to the VTF file(.vmt). In the case of a texture, you want to be downloading both files (and you need to make sure the client doesn't have a copy of it, otherwise it won't download), but simply for the fact that it's a texture and requires BOTH of the files, you would use resource.AddFile instead as in "resource.AddFile(fakepath/textureName)" completely disregarding the .vmt/.vft extension from the files, because it would download both of them. To avoid the client download override, I usually add in a number at the end of the file name to make sure that the client doesn't have it, such as "resource.AddFile(fakepath/textureName1234)" Make sure that your VMT is also pointing to the right VTF, and that the files are in the materials folder (if they're inside a directory there, use a path then file name - Otherwise, if it's in the Materials folder, and not inside anything else, you should just be using the file name itself. Unless you're talking about downloading a .PNG, which you can use for SWEP icons, but I don't personally use it - So you're better off asking someone else in using PNG's.
If you want to make an easy resource.lua Google Foxwarriors Resource generator. Its really easy. You open the folder with your addon into the program, Then you click Generate>lua>add file>copy to clipboard. Then all you have to do is go into your resource.lua and paste.
[QUOTE=Safixk;42840737]That's because SWEP icons must have a VTF and a VMT, one containing the texture itself, and the other giving it the lightmap, and path to the VTF file. In the case of a texture, you want to be downloading both files (and you need to make sure the client doesn't have a copy of it, otherwise it won't download), but simply for the fact that it's a texture and requires BOTH of the files, you would use resource.AddFile instead as in "resource.AddFile(\fake\path\textureName)" completely disregarding the .vmt/.vft extension from the files, because it would download both of them. To avoid the client download override, I usually add in a number at the end of the file name to make sure that the client doesn't have it, such as "resource.AddFile(fake\path\textureName1234)" Make sure that your VMT is also pointing to the right VTF, and that the files are in the materials folder (if they're inside a directory there, use a path then file name - Otherwise, if it's in the Materials folder, and not inside anything else, you should just be using the file name itself.[/QUOTE] A SWEP icon doesn't need to be .vmt and .vtf, it can very well be a .png, and futhermore I suggest using .png over .vmt and .vtf for icons. Also, giving it the lightmap? What? I believe you have no idea what you are talking about. And you don't use backslashes in paths in lua, you'll need to replace it with double backslashes or a normal slash.
[QUOTE=Robotboy655;42840802]A SWEP icon doesn't need to be .vmt and .vtf, it can very well be a .png, and futhermore I suggest using .png over .vmt and .vtf for icons. Also, giving it the lightmap? What? I believe you have no idea what you are talking about. And you don't use backslashes in paths in lua, you'll need to replace it with double backslashes or a normal slash.[/QUOTE] If you noticed. As soon as I hit submit. I edited out most of my issues with the post - It's just that I was currently working on something at the time, and got mixed up. I also added at the end the deal with the .PNG's (which for me at least, I find silly, and rather use a VTF/VMT). As for the backslashes, I run on linux on my personal computer (not work), and I code (mostly) C++, which only strengthens the fact that I should be using backslashes (although not correct LUA). I apologize, and have also edited out my silly mistakes (and opinionated parts of my post regarding PNG's)
[QUOTE=Safixk;42842793]If you noticed. As soon as I hit submit. I edited out most of my issues with the post - It's just that I was currently working on something at the time, and got mixed up. I also added at the end the deal with the .PNG's (which for me at least, I find silly, and rather use a VTF/VMT). As for the backslashes, I run on linux on my personal computer (not work), and I code (mostly) C++, which only strengthens the fact that I should be using backslashes (although not correct LUA). I apologize, and have also edited out my silly mistakes (and opinionated parts of my post regarding PNG's)[/QUOTE] Why use 2 files when you can have one file, that has lossless quality, previews in explorer ( Windows, not sure of Linux ) and is easy to edit without fucking around with exporting/importing? ( I am aware of export/import plugins, but you won't get best results with them )
Sorry, you need to Log In to post a reply to this thread.