• Jihad Bomb not showing in players hand
    7 replies, posted
So I’m trying to make a Jihad bomb using the models form [URL="http://www.garrysmod.org/downloads/?a=view&id=33601"]here[/URL] and the lua file below. The problem is that it doesn’t work properly; for example, the physics all work but and the model loads for both third and first person BUT when you’re the other players looking at the Traitor with the Jihad it doesn’t show up in their hand. I think this has something to do with the SWEP.HoldType because right now its “slam” but the positioning of the players arms aren’t even correct. The player holds it like it’s a pistol (I can’t remember what view that is but you get the point). Please assume that the model pathways are correct since when their on the sever they could be changed and really it doesn’t matter as long as the logics there which is what I’m looking for help with. I’m looking for guidance since I don’t even know where to look now. I’ve coded before but with other languages so I get the logic part so don’t worry about dumbing this down a lot. Thanks in advance for whatever help you can supply. [CODE] -- traitor equipment: c4 bomb if SERVER then AddCSLuaFile( "shared.lua" ); resource.AddFile("sound/siege/jihad.wav"); resource.AddFile("sound/siege/big_explosion.wav"); end SWEP.HoldType = "slam" if CLIENT then SWEP.PrintName = "Jihad bomb" SWEP.Slot = 6 SWEP.EquipMenuData = { type = "item_weapon", name = "Jihad bomb", desc = "Sacrifice yourself for Allah.\nLeft Click to make yourself EXPLODE.\nRight click to taunt." }; SWEP.Icon = "VGUI/ttt/icon_c4" end SWEP.Base = "weapon_tttbase" SWEP.Kind = WEAPON_EQUIP SWEP.CanBuy = {ROLE_TRAITOR} SWEP.WeaponID = AMMO_C4 SWEP.ViewModel = Model("models/weapons/v_jb.mdl") SWEP.WorldModel = Model("models/weapons/w_c4.mdl") SWEP.DrawCrosshair = false SWEP.ViewModelFlip = false SWEP.Primary.ClipSize = -1 SWEP.Primary.DefaultClip = -1 SWEP.Primary.Automatic = false SWEP.Primary.Ammo = "none" SWEP.Primary.Delay = 5.0 SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "none" SWEP.NoSights = true ---------------------- -- Weapon its self -- ---------------------- -- Reload does nothing function SWEP:Reload() end function SWEP:Initialize() util.PrecacheSound("siege/big_explosion.wav") util.PrecacheSound("siege/jihad.wav") end -- Think does nothing function SWEP:Think() end -- PrimaryAttack function SWEP:PrimaryAttack() self.Weapon:SetNextPrimaryFire(CurTime() + 3) local effectdata = EffectData() effectdata:SetOrigin( self.Owner:GetPos() ) effectdata:SetNormal( self.Owner:GetPos() ) effectdata:SetMagnitude( 8 ) effectdata:SetScale( 1 ) effectdata:SetRadius( 16 ) util.Effect( "Sparks", effectdata ) self.BaseClass.ShootEffects( self ) -- The rest is only done on the server if (SERVER) then timer.Simple(2, function() self:Asplode() end ) self.Owner:EmitSound( "siege/jihad.wav" ) end end -- The asplode function function SWEP:Asplode() self:Remove() local k, v -- Make an explosion at your position local ent = ents.Create( "env_explosion" ) ent:SetPos( self.Owner:GetPos() ) ent:SetOwner( self.Owner ) ent:Spawn() ent:SetKeyValue( "iMagnitude", "180" ) ent:Fire( "Explode", 0, 0 ) ent:EmitSound( "siege/big_explosion.wav", 500, 500 ) self.Owner:Kill( ) self.Owner:AddFrags( -1 ) for k, v in pairs( player.GetAll( ) ) do v:ConCommand( "play siege/big_explosion.wav\n" ) end end -- SecondaryAttack function SWEP:SecondaryAttack() self.Weapon:SetNextSecondaryFire( CurTime() + 1 ) local TauntSound = Sound( "vo/npc/male01/overhere01.wav" ) self.Weapon:EmitSound( TauntSound ) -- The rest is only done on the server if (!SERVER) then return end self.Weapon:EmitSound( TauntSound ) end -- Bewm function SWEP:WorldBoom() surface.EmitSound( "siege/big_explosion.wav" ) end [/CODE]
-snip-
Necessary? I'm looking for help and legitimate posts. That is if "-snip-" means what I think.
That snip was me posting in the wrong thread :P I have way to many threads open
Oh LOL that's fine then, at first I was think you meant the thread should literally be "snipped"
bump
You are not calling SetWeaponHoldType anywhere in that code. EDIT: Just realised this is based on ttt weapon base, so it might be taken care of there. Disregard if it is.
So like this: [CODE] function SWEP:Initialize() self:SetWeaponHoldType( self.HoldType ) util.PrecacheSound("siege/big_explosion.wav") util.PrecacheSound("siege/jihad.wav") end [/CODE] And thanks. And no I would have no idea if it is handled there but it is a ttt base weapon.
Sorry, you need to Log In to post a reply to this thread.