• Floating SWEP + Model Issues
    4 replies, posted
I'm currently using some workshop SWEP's on my TTT server. They're "ports" of CSGO weapons + skins. I'm having two major issues. The first being that the weapons float when dropped for anyone but the person who dropped it (sometimes it works properly, but most of the time it's an issue) , the second issue being that certain custom models don't show the weapon in the players hand and throw the following error (the weapon_bizon_csgo just being an example, all of them throw this error for their respective weapon): [CODE] [ERROR] addons/csgottt/lua/weapons/weapon_mp7_csgo/shared.lua:158: attempt to index local 'hand' (a nil value) 1. old_DrawWorldModel - addons/csgottt/lua/weapons/weapon_bizon_csgo/shared.lua:158 [/CODE] I'd greatly appreciate any help. Code from one of the SWEP's is below. [CODE]local soundData = { name = "Weapon_Cbizon.Clipout" , channel = CHAN_ITEM, volume = 1, soundlevel = 80, pitchstart = 100, pitchend = 100, sound = "csgo/bizon/bizon_clipout.wav" } sound.Add(soundData) local soundData = { name = "Weapon_Cbizon.Clipin" , channel = CHAN_ITEM, volume = 1, soundlevel = 80, pitchstart = 100, pitchend = 100, sound = "csgo/bizon/bizon_clipin.wav" } sound.Add(soundData) local soundData = { name = "Weapon_Cbizon.BoltForward" , channel = CHAN_ITEM, volume = 1, soundlevel = 80, pitchstart = 100, pitchend = 100, sound = "csgo/bizon/bizon_boltforward.wav" } sound.Add(soundData) local soundData = { name = "Weapon_Cbizon.Boltback" , channel = CHAN_ITEM, volume = 1, soundlevel = 80, pitchstart = 100, pitchend = 100, sound = "csgo/bizon/bizon_boltback.wav" } sound.Add(soundData) local soundData = { name = "Weapon_Cbizon.Draw" , channel = CHAN_ITEM, volume = 1, soundlevel = 80, pitchstart = 100, pitchend = 100, sound = "csgo/bizon/bizon_draw.wav" } sound.Add(soundData) if ( SERVER ) then AddCSLuaFile( "shared.lua" ) end SWEP.PrintName = "PP-Bizon | Antique" SWEP.Slot = 2 SWEP.SlotPos = 2 SWEP.HoldType = "ar2" SWEP.ViewModelFlip = false SWEP.ViewModel = "models/weapons/c_csgo_bizon.mdl" SWEP.WorldModel = "models/weapons/csgo_world/w_smg_bizon.mdl" SWEP.UseHands = true SWEP.ViewModelFOV = 54 SWEP.DrawCrosshair = false -- set false if you want no crosshair SWEP.Weight = 5 SWEP.AutoSwitchTo = false SWEP.AutoSwitchFrom = false -- TTT settings SWEP.Spawnable = true SWEP.AdminSpawnable = true SWEP.AutoSpawnable = true SWEP.Kind = WEAPON_HEAVY SWEP.AmmoEnt = "item_ammo_smg1_ttt" SWEP.IsSilent = false SWEP.NoSights = false SWEP.Base = "weapon_tttbase" SWEP.AllowDrop = true -- TTT SWEP.Primary.Sound = Sound( "csgo/bizon/bizon-1.wav" ) SWEP.Primary.Recoil = 0.8 SWEP.Primary.Damage = 11 SWEP.Primary.NumShots = 1 SWEP.HeadshotMultiplier = 5 SWEP.Primary.Cone = 0.03 SWEP.Primary.KickUp = 0.25 -- Maximum up recoil (rise) SWEP.Primary.KickDown = 0.2 -- Maximum down recoil (skeet) SWEP.Primary.KickHorizontal = 0.2 -- Maximum up recoil (stock) SWEP.Primary.ClipSize = 64 SWEP.Primary.Delay = 0.07 SWEP.Primary.DefaultClip = 128 SWEP.Primary.Automatic = true SWEP.Primary.Ammo = "smg1" SWEP.IronSightsPos = Vector(3.22, -2.131, 0.3) SWEP.IronSightsAng = Vector(0.023, -1.073, 0) --SWEP.IronSightsPos = Vector(3.559, 0, 0.72) --SWEP.IronSightsAng = Vector(0, 0, 0) -- Accuracy SWEP.CrouchCone = 0.025 -- Accuracy when we're crouching SWEP.CrouchWalkCone = 0.03 -- Accuracy when we're crouching and walking SWEP.WalkCone = 0.04 -- Accuracy when we're walking SWEP.AirCone = 0.1 -- Accuracy when we're in air SWEP.StandCone = 0.04 -- Accuracy when we're standing still SWEP.IronsightsCone = 0.015 function SWEP:PreDrop() self:SetIronsights(false) return self.BaseClass.PreDrop(self) end function SWEP:Holster() self:SetIronsights(false) return true end function SWEP:Reload() self.Weapon:DefaultReload( ACT_VM_RELOAD ); self:SetIronsights( false ) end if CLIENT then SWEP.Icon = "vgui/ttt/icon_mac" end function SWEP:DrawWorldModel() local hand, offset, rotate if not IsValid( self.Owner ) then self:SetRenderOrigin( nil ) self:SetRenderAngles( nil ) self:DrawModel() self:DrawModel( ) return end hand = self.Owner:GetAttachment(self.Owner:LookupAttachment("anim_attachment_rh")) offset = hand.Ang:Right() * 1 + hand.Ang:Forward() * 2 + hand.Ang:Up() * 0.2 hand.Ang:RotateAroundAxis(hand.Ang:Right(), 10) hand.Ang:RotateAroundAxis(hand.Ang:Forward(), 10) hand.Ang:RotateAroundAxis(hand.Ang:Up(), 0) self:SetRenderOrigin(hand.Pos + offset) self:SetRenderAngles(hand.Ang) self:DrawModel() if (CLIENT) then self:SetModelScale(1,1,1) end end[/CODE]
That attachment doesn't exist in that weapon model, then. [editline]28th July 2015[/editline] The solution would be to find the proper bone on the world model.
[QUOTE=code_gs;48319567]That attachment doesn't exist in that weapon model, then. [editline]28th July 2015[/editline] The solution would be to find the proper bone on the world model.[/QUOTE] The custom playermodels I have work with the default TTT weapons. The custom weapons are what's causing the issue. What bones do the default TTT weapons merge to?
Could also be that your server is missing the said models. ( For the floating dropped weapons issue )
[QUOTE=Robotboy655;48320702]Could also be that your server is missing the said models. ( For the floating dropped weapons issue )[/QUOTE] I fixed the floating weapons last night with two lines. Just need to fix the weapons not attaching to models without hands. I know they function with default weapons, just the custom weapons don't work right because I can't find a proper attachment point.
Sorry, you need to Log In to post a reply to this thread.