• Third person custom muzzle flash problem
    3 replies, posted
I'm trying to finish my Handheld Airboat Gun but I can't solve my problem. Muzzle flash works well in first person but in third person there's still default AR2 muzzle instead of AirboatMuzzleFlash (even if there is return true!!!!). My code: [code] function SWEP:FireAnimationEvent(pos, ang, event, options) if ( event == 21 ) then local muzzle = EffectData(); muzzle:SetOrigin( self.Owner:GetPos() ) muzzle:SetEntity( self.Owner:GetViewModel() ) muzzle:SetAngles( self.Owner:EyeAngles() ) muzzle:SetAttachment( 1 ) muzzle:SetScale(2) util.Effect( "AirboatMuzzleFlash", muzzle ); return true; end if ( event == 5001) then local tpmuzzle = EffectData(); tpmuzzle:SetOrigin( self.Owner:GetPos() ) tpmuzzle:SetEntity( self.Weapon ) tpmuzzle:SetAngles( self.Owner:EyeAngles() ) tpmuzzle:SetAttachment( 1 ) util.Effect( "AirboatMuzzleFlash", tpmuzzle ); return true; // Function returning true, so there shouldn't be a muzzleflash, but it is! end end [/code]
5001 is usually the first person muzzle flash, and I think AR2 and Airboat muzzle flashes are pretty much the same or very similar, if not the same.
No. But do not judge is it similiar or not. I need a help with coding. OK?
Ok, here's what appears to be working for me: [code] local data = EffectData() data:SetFlags( 0 ) if ( !self.Owner:IsPlayer() || self.Owner:ShouldDrawLocalPlayer() ) then data:SetEntity( self ) else data:SetEntity( self.Owner:GetViewModel() ) end data:SetAttachment( 1 ) data:SetScale( 1 ) util.Effect( "AirboatMuzzleFlash", data )[/code] Just attach this to your proper events.
Sorry, you need to Log In to post a reply to this thread.