I’m modifying the riot shield for fun. One issue is that the public version has no view model, so it spams the console with errors whenever you take it out. The obvious solution is to simply give it a view model, and then not draw it. That doesn’t work, plain and simple. Here’s the code (shared):
[LUA]
SWEP.HoldType = “slam”
if CLIENT then
SWEP.PrintName = “Riot Shield”
SWEP.Author = “”
SWEP.Slot = 1
SWEP.SlotPos = 1
SWEP.IconLetter = “w”
SWEP.Icon = "icon/icon_riot.png"
end
SWEP.EquipMenuData =
{
type = “Defense”,
desc = “A riot shield used to deflect bullets.”
}
SWEP.Base = “weapon_tttbase”
SWEP.Spawnable = true
SWEP.AdminSpawnable = true
SWEP.Kind = WEAPON_PISTOL
SWEP.WeaponID = AMMO_AK47
SWEP.ViewModelFOV = 62
SWEP.ViewModelFlip = false
SWEP.AnimPrefix = “rpg”
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 = false
SWEP.Primary.Ammo = “none”
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = 1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = “none”
SWEP.CanBuy = { ROLE_DETECTIVE }
SWEP.LimitedStock = true
SWEP.Z_Offset = -60
SWEP.Distance = 25
SWEP.WorldModel = “models/riot/riotshield/shield.mdl”
SWEP.ViewModel = “models/weapons/v_crowbar.mdl”
function SWEP:Deploy()
if SERVER and IsValid( self.Owner ) then
self.Owner:DrawViewModel( false )
end
return true
end
[/LUA]
When the user takes out the weapon, it draws the crowbar. I looked at TTT’s weapon code and it’s literally the exact same as mine, but theirs works and mine doesn’t. I’m absolutely baffled, can anyone explain this?