• Need help creating SWEP with custom model
    0 replies, posted
So ill make this quick. There was a SWEP that was causing my game to crash, to fix it, I made a SWEP and placed the model name inside of the code. the problem comes when i use it in Gmod, the model is there but there is no texture for it. can anyone help? This is the .lua if you need it. if SERVER then   AddCSLuaFile( "shared.lua" ) resource.AddFile("models/newriotshield/riotshield/ballisticshield_mod.mdl") resource.AddFile("models/newriotshield/riotshield/ballisticshield_mod.dx80.vtx") resource.AddFile("models/newriotshield/riotshield/ballisticshield_mod.dx90.vtx") resource.AddFile("models/newriotshield/riotshield/ballisticshield_mod.phy") resource.AddFile("models/newriotshield/riotshield/ballisticshield_mod.sw.vtx") resource.AddFile("models/newriotshield/riotshield/ballisticshield_mod.vvd") resource.AddFile("materials/newriotshield/riotshield/ballshield.vmt") resource.AddFile("materials/newriotshield/riotshield/ballshield.vtf") resource.AddFile("materials/newriotshield/riotshield/ballshield_n.vtf") resource.AddFile("materials/newriotshield/riotshield/riotshield.vmt") resource.AddFile("materials/newriotshield/riotshield/riotshield.vtf") resource.AddFile("materials/newriotshield/riotshield/riotshield_mod.vmt") resource.AddFile("materials/newriotshield/riotshield/riotshield_mod.vtf") resource.AddFile("materials/newriotshield/riotshield/riotshield_mod_n.vtf") resource.AddFile("materials/newriotshield/riotshield/shieldglass.vmt") resource.AddFile("materials/newriotshield/riotshield/shieldglass.vtf") resource.AddFile("materials/newriotshield/riotshield/shieldglass_dudv.vtf") resource.AddFile("materials/newriotshield/riotshield/shieldglass_dx60.vmt") end if (CLIENT) then SWEP.PrintName = "Riot Shield" SWEP.Category = "Riot shield" SWEP.Slot = 3 SWEP.SlotPos = 1 SWEP.DrawAmmo = false SWEP.DrawCrosshair = false SWEP.Author = "Friedeggnchips" SWEP.Contact = "Dont" SWEP.Purpose = "For blocking bullets etc" end SWEP.HoldType = "crossbow" SWEP.Spawnable = true SWEP.AdminSpawnable = true SWEP.UseHands = true SWEP.ViewModelFOV = 62 SWEP.ViewModelFlip = false SWEP.AnimPrefix = "crossbow" SWEP.Primary.Damage         = 0 SWEP.Primary.ClipSize       = -1 SWEP.Primary.DefaultClip    = -1 SWEP.Primary.Automatic      = true SWEP.Primary.Delay = 1.1 SWEP.Primary.Ammo       = "none" SWEP.Primary.ClipSize  = -1 SWEP.Primary.DefaultClip = 1 SWEP.Primary.Automatic  = true SWEP.Primary.Ammo = "none" SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = 1 SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "none" SWEP.WorldModel = "models/newriotshield/riotshield/ballisticshield_mod.mdl" SWEP.ViewModel = "" function SWEP:Deploy() if SERVER then if IsValid(self.ent) then return end self:SetNoDraw(true) self.ent = ents.Create("prop_physics") self.ent:SetModel("models/newriotshield/riotshield/ballisticshield_mod.mdl") self.ent:SetPos(self.Owner:GetPos() + Vector(10,0,15) + (self.Owner:GetForward()*25)) ent:SetAngles((ply:GetAimVector()*-1):Angle()) self.ent:SetParent(self.Owner) self.ent:Fire("SetParentAttachmentMaintainOffset", "eyes", 0.01) self.ent:SetCollisionGroup( COLLISION_GROUP_WORLD ) self.ent:Spawn() self.ent:Activate() end return true end function SWEP:PrimaryAttack() end function SWEP:Holster() if SERVER then if not IsValid(self.ent) then return end self.ent:Remove() end return true end function SWEP:OnDrop() if SERVER then self:SetColor(Color(255,255,255,255)) if not IsValid(self.ent) then return end self.ent:Remove() end end function SWEP:OnRemove() if SERVER then self:SetColor(Color(255,255,255,255)) if not IsValid(self.ent) then return end self.ent:Remove() end end Thanks for the help.
Sorry, you need to Log In to post a reply to this thread.