Alright, so what I want this SWEP to do is to fire two different rag dolls, one for each firing mode.
I also want two different sounds to be played from the launched rag dolls, depending on the firing mode used.
I have the rag doll launcher set up and working, but what I can't seem to figure out is how to get the two different sounds to be played [B][I]FROM[/I][/B] the rag dolls after they are launched.
I'm still very new to this, so any help would be very much appreciated
Here is what I have so far:
[CODE]if SERVER then
AddCSLuaFile ("shared.lua")
SWEP.Weight = 5
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
elseif CLIENT then
SWEP.PrintName = "Shitty SWEP Name"
SWEP.Slot = 4
SWEP.SlotPos = 1
SWEP.DrawAmmo = false
SWEP.DrawCrosshair = false
language.Add("Undone_Thrown_SWEP_Entity","Undone Thrown SWEP Entity")
end
SWEP.Author = "Blah"
SWEP.Purpose = "Blah"
SWEP.Instructions = "Blah"
SWEP.Category = "Blah"
SWEP.Spawnable = true
SWEP.AdminSpawnable = true
SWEP.ViewModel = "models/weapons/v_RPG.mdl"
SWEP.WorldModel = "models/weapons/w_rocket_launcher.mdl"
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"
local ShootSound = Sound("Metal.SawBladeStick")
function SWEP:Reload()
end
function SWEP:Think()
end
function SWEP:throw_attack (model_file)
local tr = self.Owner:GetEyeTrace()
self.Weapon:EmitSound (ShootSound)
self.BaseClass.ShootEffects (self)
if (!SERVER) then return end
local ent = ents.Create ("prop_ragdoll")
ent:SetModel (model_file)
ent:SetPos (self.Owner:EyePos() + (self.Owner:GetAimVector() * 16))
ent:SetAngles (self.Owner:EyeAngles())
ent:Spawn()
local shot_length = tr.HitPos:Length();
for i=0, ent:GetPhysicsObjectCount( ) -1 do
local physBone = ent:GetPhysicsObjectNum( i )
if (physBone:IsValid()) then
physBone:ApplyForceCenter( self.Owner:GetAimVector():GetNormalized() * math.pow( shot_length, 10 ) )
end
end
cleanup.Add (self.Owner, "props", ent)
undo.Create ("Launched Ragdoll")
undo.AddEntity (ent)
undo.SetPlayer (self.Owner)
undo.Finish()
end
function SWEP:PrimaryAttack()
self:throw_attack("shitty/model/file.mdl")
end
function SWEP:SecondaryAttack()
self:throw_attack("shitty/model/file2.mdl")
end[/CODE]
Sorry, you need to Log In to post a reply to this thread.