Lua skipping files custom models

Ok so I want people to download custom models when they join my gamemode and I have this code

[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(fdir)
end
end

for k,v in pairs(file.Find("…/"…dir…"/*")) do
resource.AddFile(dir…"/"…v)
end
end

AddDir(“addons/Sword_Sheild/models”)

AddDir(“addons/Sword_Sheild/materials”)

AddDir(“addons/Sword_Sheild/sound”)

AddCSLuaFile(“shared.lua”)

include(“shared.lua”)

if ( SERVER ) then

AddCSLuaFile( "shared.lua" )

SWEP.HoldType			= "melee"

end

if ( CLIENT ) then

SWEP.PrintName			= "Sword and Sheild"
SWEP.Author				= "Miketoast"

SWEP.Slot				= 0
SWEP.SlotPos			= 7
SWEP.ViewModelFOV		= 62
SWEP.IconLetter			= "x"
SWEP.Category = "AOC"

end
[/lua]

My friend said it told him he has to download 40 custom models but it skipped through them. I know the shared.lua goes through and everything is in the external addons in garrysmod/addons

You can’t send files from addons, you just replace “addons/Sword_Sheild/models/mymodels” with “models/mymodels/” since the models are copied when the gamemode starts to the main “models” directory.

Thanks Gbps, I’m one step closer but it still seems to not work…

In my gamemode, in the entities\weapons folder i have Sword_Sheild folder that has a shared.lua and a init.lua

The shared.lua has this code:

[lua]

if ( SERVER ) then

AddCSLuaFile( "shared.lua" )

SWEP.HoldType			= "melee"

end

if ( CLIENT ) then

SWEP.PrintName			= "Sword and Sheild"
SWEP.Author				= "Miketoast"

SWEP.Slot				= 0
SWEP.SlotPos			= 7
SWEP.ViewModelFOV		= 62
SWEP.IconLetter			= "x"
SWEP.Category = "AOC"

end

– function SWEP:Reload() --To do when reloading
– end

function SWEP:Think() – Called every frame
end

function SWEP:Initialize()
if( SERVER ) then
self:SetWeaponHoldType( “melee” );
end
util.PrecacheSound("")
end

function SWEP:PrimaryAttack()
self.Weapon:SetNextPrimaryFire(CurTime() + .4)

local trace = self.Owner:GetEyeTrace()

if trace.HitPos:Distance(self.Owner:GetShootPos()) <= 85 then
self.Owner:SetAnimation( PLAYER_ATTACK1 )
self.Weapon:SendWeaponAnim(ACT_VM_MISSCENTER)
bullet = {}
bullet.Num = 1
bullet.Src = self.Owner:GetShootPos()
bullet.Dir = self.Owner:GetAimVector()
bullet.Spread = Vector(0, 0, 0)
bullet.Tracer = 0
bullet.Force = 1
bullet.Damage = 35
self.Owner:FireBullets(bullet)
self.Weapon:EmitSound(“Impacts/slashmedium/slash_medium_” … math.random( 01, 12 ) … “.wav”)
else
self.Weapon:EmitSound(“weapons/shortsword/shortsword_attack” … math.random( 1,2 ) … “.wav”)
self.Owner:SetAnimation( PLAYER_ATTACK1 )
self.Weapon:SendWeaponAnim(ACT_VM_MISSCENTER)
end

end

function SWEP:Deploy()
return true;
end

function SWEP:Holster()
return true;
end

function SWEP:SecondaryAttack()
self.Weapon:SetNextSecondaryFire(CurTime() + .7)

local trace = self.Owner:GetEyeTrace()

if trace.HitPos:Distance(self.Owner:GetShootPos()) <= 85 then
self.Owner:SetAnimation( PLAYER_ATTACK1 )
self.Weapon:SendWeaponAnim(ACT_VM_HITCENTER)
bullet = {}
bullet.Num = 1
bullet.Src = self.Owner:GetShootPos()
bullet.Dir = self.Owner:GetAimVector()
bullet.Spread = Vector(0, 0, 0)
bullet.Tracer = 0
bullet.Force = 1
bullet.Damage = 35
self.Owner:FireBullets(bullet)
self.Weapon:EmitSound(“Impacts/slashmedium/slash_medium_” … math.random( 01, 12 ) … “.wav”)
else
self.Weapon:EmitSound(“weapons/shortsword/shortsword_attack” … math.random( 1,2 ) … “.wav”)
self.Owner:SetAnimation( PLAYER_ATTACK1 )
self.Weapon:SendWeaponAnim(ACT_VM_HITCENTER)
end

end


SWEP.ViewModel = “models/aoc_weapon/v_sword01_evil_shield.mdl”
SWEP.WorldModel = “models/aoc_weapon/w_sword01_evil_shield.mdl”

SWEP.Primary.Delay = 60.3
SWEP.Primary.Recoil = 0
SWEP.Primary.Damage = 15
SWEP.Primary.NumShots = 0
SWEP.Primary.Cone = 9
SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = “none”

SWEP.Secondary.Delay = 60.999999999
SWEP.Secondary.Recoil = 0
SWEP.Secondary.Damage = 8
SWEP.Secondary.NumShots = 1
SWEP.Secondary.Cone = 0
SWEP.Secondary.ClipSize = 1
SWEP.Secondary.DefaultClip = 1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = “none”

[/lua]

and the init has this code:

[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(fdir)
end
end

for k,v in pairs(file.Find("…/"…dir…"/*")) do
resource.AddFile(dir…"/"…v)
end
end

AddDir(“models/aoc_weapon”)

AddDir(“materials/models/aoc_weapon”)

AddDir(“sound/impacts”)

AddDir(“sound/shortsword”)

AddCSLuaFile(“shared.lua”)

include(“shared.lua”)

[/lua]

all models and materials are in the main models and material folder in garrysmod…

Hi I’m new here and am experiencing a similar problem…

Please give us more detail about your problem MSHIZZLE, as for MikeToast:
I don’t understand what the problem is, what are you trying to do?

I want people to download my custom models when they join the server but they still see texture errors after I included the directories to be sent to them, I fixed the problem but there are still a couple missing textures, I think I can work it out,

Anyone else who needs help can see this video here:

Tell them the link to the models on garrysmod.org or upload them to a URL and tell them that…

Haha yea that’s kinda stupid no offense, No one would go out of their way to download some models from a website, but I got most of the thing working now. Its best if it downloads straight to them instead of making them go our of their way to dl it.