• Custom Weapon not downloading Textures/Models (FastDL)
    2 replies, posted
I am having trouble with my custom weapon that my friend and I created. The gun works fine just as we planned it (MELONS EVERYWHERE) but for some reason it or FASTDL server will not have the client download textures and models. This causes you to be walking around with an error sign and a gun in your hands with no textures [IMG]http://postimg.org/image/ff7eezcpj/[/IMG] Our FastDL server root is located here, [URL="http://108.13.39.73"]http://108.13.39.73[/URL]. Lastly here are the weapons shared.lua code [CODE] resource.AddFile( "models/weapons/v_pist_nesz.mdl" ) resource.AddFile( "models/weapons/w_pist_nesz.mdl" ) resource.AddSingleFile( "models/weapons/v_pist_nesz.mdl" ) resource.AddSingleFile( "models/weapons/w_pist_nesz.mdl" ) resource.AddFile( "models/props_junk/watermelon01.mdl" ) resource.AddFile( "models/weapons/v_mp7_silenced.mdl" ) resource.AddFile( "models/weapons/w_mp7_silenced.mdl" ) resource.AddSingleFile( "sound/mp7/mp7_fire.wav" ) resource.AddSingleFile( "sound/jihad.wav" ) resource.AddSingleFile( "sound/nope.wav" ) resource.AddSingleFile( "sound/awp.wav" ) resource.AddSingleFile( "sound/grenade_launcher_shoot.wav" ) if SERVER then AddCSLuaFile( "resources.lua" ) resource.AddFile( "models/weapons/v_pist_nesz.mdl" ) resource.AddFile( "models/weapons/w_pist_nesz.mdl" ) resource.AddSingleFile( "models/weapons/v_pist_nesz.mdl" ) resource.AddSingleFile( "models/weapons/w_pist_nesz.mdl" ) resource.AddFile( "models/props_junk/watermelon01.mdl" ) resource.AddFile( "models/weapons/v_mp7_silenced.mdl" ) resource.AddFile( "models/weapons/w_mp7_silenced.mdl" ) resource.AddSingleFile( "sound/mp7/mp7_fire.wav" ) resource.AddSingleFile( "sound/jihad.wav" ) resource.AddSingleFile( "sound/nope.wav" ) resource.AddSingleFile( "sound/awp.wav" ) resource.AddSingleFile( "sound/grenade_launcher_shoot.wav" ) end SWEP.HoldType = "pistol" if CLIENT then SWEP.PrintName = "Melon Launcher" SWEP.Author = "OrigamiToaster" SWEP.Slot = 12 SWEP.ViewModelFlip = false SWEP.EquipMenuData = { type = "item_weapon", desc = "Shoots Melons" }; SWEP.Icon = "VGUI/ttt/icon_knife" end SWEP.Base = "weapon_tttbase" SWEP.Spawnable = false SWEP.AdminSpawnable = true SWEP.ViewModelFlip = true SWEP.AutoSpawnable = false SWEP.AllowDrop = false SWEP.ViewModel = "models/weapons/v_pist_nesz.mdl"; SWEP.WorldModel = "models/weapons/w_pist_nesz.mdl"; SWEP.Kind = WEAPON_PISTOL SWEP.DrawCrosshair = false SWEP.Primary.Damage = 300000 SWEP.Primary.ClipSize = 51 SWEP.Primary.DefaultClip = 51 SWEP.Primary.Automatic = true SWEP.Primary.Delay = .1 SWEP.Primary.Ammo = "none" SWEP.IsSilent = true -- Pull out faster than standard guns SWEP.DeploySpeed = 2 local ShootSound = Sound( "grenade_launcher_shoot.wav" ) local HeySound = Sound( "vo/npc/male01/overhere01.wav" ) function SWEP:PrimaryAttack() local ammo = self:Clip1() if ammo > 0 then self.Weapon:SetNextPrimaryFire( CurTime() + 0.2 ) self:ThrowChair( "models/props_junk/watermelon01.mdl" ) self:TakePrimaryAmmo( "1" ) end end function SWEP:SecondaryAttack() self:EmitSound( HeySound ) end function SWEP:ThrowChair( model_file ) self:EmitSound( ShootSound ) if ( CLIENT ) then return end local ent = ents.Create( "prop_physics" ) if ( !IsValid( ent ) ) then return end ent:SetGravity(0) ent:SetModel( model_file ) ent:SetPos( self.Owner:EyePos() + ( self.Owner:GetAimVector() * 8 ) ) ent:SetAngles( self.Owner:EyeAngles() ) ent:Spawn() local phys = ent:GetPhysicsObject() if ( !IsValid( phys ) ) then ent:Remove() return end local velocity = self.Owner:GetAimVector() velocity = velocity * 9000 phys:EnableGravity("false") phys:ApplyForceCenter( velocity ) end if CLIENT then function SWEP:DrawHUD() if true then local x = ScrW() / 2.0 local y = ScrH() / 2.0 surface.SetDrawColor(255, 0, 0, 255) local outer = 20 local inner = 10 surface.DrawLine(x - outer, y - outer, x - inner, y - inner) surface.DrawLine(x + outer, y + outer, x + inner, y + inner) surface.DrawLine(x - outer, y + outer, x - inner, y + inner) surface.DrawLine(x + outer, y - outer, x + inner, y - inner) draw.SimpleText("Launch Melon", "TabLarge", x, y - 30, COLOR_RED, TEXT_ALIGN_CENTER, TEXT_ALIGN_BOTTOM) end return self.BaseClass.DrawHUD(self) end end [/CODE] Lastly here is the file refrenced in the weapons shared.lua "resources.lua" ( /lua/autorun/server/resources.lua ) [CODE]if SERVER then AddCSLuaFile( "resources.lua" ) resource.AddFile( "models/weapons/v_pist_nesz.mdl" ) resource.AddFile( "models/weapons/w_pist_nesz.mdl" ) resource.AddSingleFile( "models/weapons/v_pist_nesz.mdl" ) resource.AddSingleFile( "models/weapons/w_pist_nesz.mdl" ) resource.AddFile( "models/props_junk/watermelon01.mdl" ) resource.AddFile( "models/weapons/v_mp7_silenced.mdl" ) resource.AddFile( "models/weapons/w_mp7_silenced.mdl" ) resource.AddSingleFile( "sound/mp7/mp7_fire.wav" ) resource.AddSingleFile( "sound/jihad.wav" ) resource.AddSingleFile( "sound/nope.wav" ) resource.AddSingleFile( "sound/awp.wav" ) resource.AddSingleFile( "sound/grenade_launcher_shoot.wav" ) end[/CODE] I tried to make this post as complete as possible but if you have any questions please ask below and I will do my best to answer. Thank you for any help you can provide. [editline]10th August 2013[/editline] for some reason the picture did not go through but here is what the weapon looks like in game. [URL="http://postimg.org/image/ff7eezcpj/"]http://postimg.org/image/ff7eezcpj/[/URL]
Do not use AddSingleFile on .mdl files, use AddFile.
We used AddFile for the .mdl at first but it didn't work, so we just spammed the AddSingleFile to see if that would fix it.
Sorry, you need to Log In to post a reply to this thread.