• Problem with custom Models *Help fast please*
    8 replies, posted
So when ever I add a custom models to the server the model shows up but its a pink checkerboard. Any ideas on how to fix this?
It's missing materials.
[QUOTE=Drew P. Richard;25422294]It's missing materials.[/QUOTE] hmmm I must be doing the ResourceAddfile wrong. Do I add in the file extensions on these files or just leave it like this. resource.AddFile("materials/models/player/khaotik/darkelfa/art_phoenix/t_phoenix") Or like this? resource.AddFile("materials/models/player/khaotik/darkelfa/art_phoenix/t_phoenix.vmt") resource.AddFile("materials/models/player/khaotik/darkelfa/art_phoenix/t_phoenix.vtf")
[QUOTE=thejjokerr;25422469]Only add .vmt, it will automaticly add vtf for you. Same for models, only add .mdl and it will add the other files with it.[/QUOTE] really? so ive been wasting my time adding every single file :p im gonna give it a shot.
What you may also want to do if you find yourself getting a lot of content: Inside the gamemode folder create a folder called content, and put it all in there, it works exactly like an addon. content/models/* content/materials/* etc. etc. Then, somewhere in a serverside file work with this: [code] local function RecurseDirectory(Location) for k,v in pairs(file.Find(Location.."*")) do if file.IsDir(Location..v) then RecurseDirectory(Location..v.."/"); else local NewLocation = string.gsub(Location..v,"../gamemodes/name/content/",""); if !string.find(NewLocation,"bz2") then resource.AddFile(NewLocation); end end end end RecurseDirectory("../gamemodes/name/content/models/"); RecurseDirectory("../gamemodes/name/content/materials/"); RecurseDirectory("../gamemodes/name/content/sound/"); RecurseDirectory("../gamemodes/name/content/scripts/"); [/code]
awesome it worked thank you very very much!
[QUOTE=Drew P. Richard;25422751]What you may also want to do if you find yourself getting a lot of content: Inside the gamemode folder create a folder called content, and put it all in there, it works exactly like an addon. content/models/* content/materials/* etc. etc. Then, somewhere in a serverside file work with this: [code] local function RecurseDirectory(Location) for k,v in pairs(file.Find(Location.."*")) do if file.IsDir(Location..v) then RecurseDirectory(Location..v.."/"); else local NewLocation = string.gsub(Location..v,"../gamemodes/name/content/",""); if !string.find(NewLocation,"bz2") then resource.AddFile(NewLocation); end end end end RecurseDirectory("../gamemodes/name/content/models/"); RecurseDirectory("../gamemodes/name/content/materials/"); RecurseDirectory("../gamemodes/name/content/sound/"); RecurseDirectory("../gamemodes/name/content/scripts/"); [/code][/QUOTE] Wouldn't that technically make the files go into gamemodes/name/content ?
Nope. For example, if you had something called hephep.mdl in gamemodes/name/content/models, It would make it do resource.AddFile("models/hephep.mdl").
Sorry, you need to Log In to post a reply to this thread.