• Weapons with custom models are invisible
    2 replies, posted
All of my TTT custom weapons are invisible in both first person view and when dropped on the ground. The clients are downloading the models, but it doesn't show up in game. Anyone have any idea what's going on? Here's the code for my weapon: [CODE] if SERVER then AddCSLuaFile( "shared.lua" ) end SWEP.HoldType = "shotgun" if CLIENT then SWEP.PrintName = "Spas 12" SWEP.Slot = 2 SWEP.Icon = "VGUI/ttt/icon_shotgun" end SWEP.Base = "weapon_tttbase" SWEP.Spawnable = true SWEP.AdminSpawnable = true SWEP.ViewModelFlip = false SWEP.Kind = WEAPON_HEAVY SWEP.WeaponID = AMMO_SHOTGUN SWEP.Primary.Ammo = "Buckshot" SWEP.Primary.Damage = 12 SWEP.Primary.Cone = 0.085 SWEP.Primary.Delay = 0.8 SWEP.Primary.ClipSize = 8 SWEP.Primary.ClipMax = 36 SWEP.Primary.DefaultClip = 900 SWEP.Primary.Automatic = true SWEP.Primary.NumShots = 8 SWEP.AutoSpawnable = false SWEP.AmmoEnt = "item_box_buckshot_ttt" SWEP.ViewModel = "models/weapons/v_shotty_spas-12.mdl" SWEP.WorldModel = "models/weapons/w_shotty_spas-12.mdl" SWEP.Primary.Sound = Sound( "weapons/spas12/spas_shoot_pump.wav" ) SWEP.Primary.Recoil = 7 --SWEP.IronSightsPos = Vector( 5.7, -3, 3 ) resource.AddFile("models/weapons/v_shotty_spas-12.mdl") resource.AddFile("models/weapons/w_shotty_spas-12.mdl") resource.AddFile("sound/weapons/spas12/spas_shoot_pump.wav") SWEP.InLoadoutFor = {} SWEP.IronSightsPos = Vector( 5.14, -5, 2.14 ) SWEP.IronSightsAng = Vector(0, 0.8, 0) SWEP.SightsPos = Vector(5.738, -2.951, 3.378) SWEP.SightsAng = Vector(0.15, 0, 0) SWEP.RunSightsPos = Vector(0.328, -6.394, 1.475) SWEP.RunSightsAng = Vector(-4.591, -48.197, -1.721) SWEP.reloadtimer = 0 function SWEP:SetupDataTables() self:DTVar("Bool", 0, "reloading") return self.BaseClass.SetupDataTables(self) end function SWEP:Reload() self:SetIronsights( false ) --if self.Weapon:GetNetworkedBool( "reloading", false ) then return end if self.dt.reloading then return end if not IsFirstTimePredicted() then return end if self.Weapon:Clip1() < self.Primary.ClipSize and self.Owner:GetAmmoCount( self.Primary.Ammo ) > 0 then if self:StartReload() then return end end end function SWEP:StartReload() --if self.Weapon:GetNWBool( "reloading", false ) then if self.dt.reloading then return false end if not IsFirstTimePredicted() then return false end self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) local ply = self.Owner if not ply or ply:GetAmmoCount(self.Primary.Ammo) <= 0 then return false end local wep = self.Weapon if wep:Clip1() >= self.Primary.ClipSize then return false end wep:SendWeaponAnim(ACT_SHOTGUN_RELOAD_START) self.reloadtimer = CurTime() + wep:SequenceDuration() --wep:SetNWBool("reloading", true) self.dt.reloading = true return true end function SWEP:PerformReload() local ply = self.Owner -- prevent normal shooting in between reloads self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) if not ply or ply:GetAmmoCount(self.Primary.Ammo) <= 0 then return end local wep = self.Weapon if wep:Clip1() >= self.Primary.ClipSize then return end self.Owner:RemoveAmmo( 1, self.Primary.Ammo, false ) self.Weapon:SetClip1( self.Weapon:Clip1() + 1 ) wep:SendWeaponAnim(ACT_VM_RELOAD) self.reloadtimer = CurTime() + wep:SequenceDuration() end function SWEP:FinishReload() self.dt.reloading = false self.Weapon:SendWeaponAnim(ACT_SHOTGUN_RELOAD_FINISH) self.reloadtimer = CurTime() + self.Weapon:SequenceDuration() end function SWEP:CanPrimaryAttack() if self.Weapon:Clip1() <= 0 then self:EmitSound( "Weapon_Shotgun.Empty" ) self:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) return false end return true end function SWEP:Think() if self.dt.reloading and IsFirstTimePredicted() then if self.Owner:KeyDown(IN_ATTACK) then self:FinishReload() return end if self.reloadtimer <= CurTime() then if self.Owner:GetAmmoCount(self.Primary.Ammo) <= 0 then self:FinishReload() elseif self.Weapon:Clip1() < self.Primary.ClipSize then self:PerformReload() else self:FinishReload() end return end end end function SWEP:Deploy() self.dt.reloading = false self.reloadtimer = 0 return self.BaseClass.Deploy(self) end -- The shotgun's headshot damage multiplier is based on distance. The closer it -- is, the more damage it does. This reinforces the shotgun's role as short -- range weapon by reducing effectiveness at mid-range, where one could score -- lucky headshots relatively easily due to the spread. function SWEP:GetHeadshotMultiplier(victim, dmginfo) local att = dmginfo:GetAttacker() if not IsValid(att) then return 3 end local dist = victim:GetPos():Distance(att:GetPos()) local d = math.max(0, dist - 140) -- decay from 3.1 to 1 slowly as distance increases return 1 + math.max(0, (2.1 - 0.002 * (d ^ 1.25))) end [/CODE]
I've been having this problem for a while now, does anyone know anything?
Is it possible that they are not downloading the materials for that weapon?
Sorry, you need to Log In to post a reply to this thread.