Swep fire poistion, and particle help.

So with the primary fire i have it so it shoots particles, but its really,really bad.
See if you move your weapon in certain spots and continue to shoot the particles that come out don’t follow the guns sight,and just shoots pretty much in the same spot anywhere, how could i fix that?

So pretty much, how could i go about tracing the players aim spot better? (not from the crosshair, but from the model). and just for a fyi, im using th rpg model.

-fixed my second issue-

Pictures:

http://img35.imageshack.us/img35/5543/123fle.jpg

http://img828.imageshack.us/img828/8908/1234tu.jpg

Hopefully you don’t mind…
bump.

Bump again.

Show your script , maybe we can see the mistake you made?

Alright here you go, credit goes to who ever donkie is, all i did was change some things to my likings.

[lua]

if CLIENT then
SWEP.PrintName = “Fire Extinguisher”
SWEP.Slot = 3
SWEP.SlotPos = 3
SWEP.DrawAmmo = false
SWEP.DrawCrosshair = true
end

SWEP.Author = “Orginal:Donkie” – edited by rab, for my preferences.
SWEP.Contact = “”
SWEP.Purpose = “Extingish Fire”
SWEP.Instructions = “Left click extinguish fire”
SWEP.ViewModel = Model(“models/weapons/v_rpg.mdl”)
SWEP.WorldModel = Model(“models/weapons/w_rocket_launcher.mdl”)
SWEP.Spawnable = false
SWEP.AdminSpawnable = true
SWEP.ViewModelFOV = 62
SWEP.ViewModelFlip = false
SWEP.AnimPrefix = “rpg”

SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = 1
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = “none”

SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = 1
SWEP.Secondary.Automatic = true
SWEP.Secondary.Ammo = “none”

SWEP.DefaultFlameHealth = 13

function SWEP:PrimaryAttack()
if SERVER then
local own = self.Owner
local pos1 = own:GetPos() + own:GetForward() * 10 + own:GetRight() * -10 -
local pos2 = own:GetPos() + own:GetForward() * 24 + own:GetRight() * 8 + own:GetUp() * ((own:GetAimVector().z+2)*45)
local Ents = ents.FindInBox(pos1,pos2)
for _,ent in ipairs(Ents) do
if ValidEntity(ent) then // Is it really a entity?
if ent:IsOnFire() then
if type(ent.flamehealth) != “number” then // This entity has not been extinguished before
ent.flamehealth = self.DefaultFlameHealth // Set the prop’s flame’s health to the default.
end
if ent.flamehealth > 0 then // If he still is burning and his flame’s health is over 0 then
ent.flamehealth = ent.flamehealth - 5 // Lower his flamehealth by 1
elseif ent.flamehealth <= 0 then // If he still is burning but his flame’s health is less than or equal to 0 then
ent.flamehealth = self.DefaultFlameHealth // Reset the flame’s health for future use
ent:Extinguish() // Extinguish the prop
end
end
end
end
umsg.Start(“CallFireextinguishersmokeeffect”)
umsg.Entity(self.Weapon)
umsg.Entity(self.Owner)
umsg.End()
end
end

local function DosmokeEffect( um )
local ent = um:ReadEntity()
local ply = um:ReadEntity()

local NozzlePos = ent:GetPos() + (ent:GetForward() * 24 + ent:GetRight() * 8 + ent:GetUp() * 26)
local Emitter = ParticleEmitter(NozzlePos) 
local Spread = 10
local Force = 150
for i=1, 1 do 
	local smoke = Emitter:Add("particles/smokey",NozzlePos) 
	if smoke then 
		smoke:SetVelocity(ply:GetAimVector() * Force + Vector(math.random(-Spread,Spread),math.random(-Spread,Spread),math.random(-Spread,Spread)) ) 
		smoke:SetStartSize()
		smoke:SetEndSize(30)	
        smoke:SetDieTime( 2.0 )
        smoke:SetStartAlpha( math.Rand( 50, 150 ) )
        smoke:SetRoll( math.Rand( -0.2, 0.2 ) )
        smoke:SetColor( 200, 200, 210 )

	end 
end

end
usermessage.Hook(“CallFireextinguishersmokeeffect”, DosmokeEffect)

function SWEP:SecondayAttack()

end
[/lua]

Oh my dear sweet jesus. There are so many things wrong with that code I can’t even begin to describe…

Scrap that code and start from scratch.
Use the barrel muzzle attachment position and angle to emit the particles from and create a real effect file for the effect, don’t create it in a umsg within the SWEP shivers (also that would error in multiplayer, there is no server/client check and the client functions (the emitter) would error on the server)

Yeah kind of figured it was badly messed up, and ill give it a go.
better experienced for me anyway

Also could you elaborate on the barrel muzzle attachment thing?