Someone make a little tutorial in util.Effect? (Already checked the wiki)
2 replies, posted
It really don't seens to work with me. Someone can please help me? I made this little wep to test it:
[CODE]
SWEP.PrintName = "Effects testing weps"
SWEP.Slot = 3
SWEP.SlotPos = 1
SWEP.Instructions = "Fire bro"
SWEP.Spawnable = true
SWEP.AdminSpawnable = true
SWEP.ViewModel = "models/weapons/v_smg1.mdl"
SWEP.WorldModel = "models/weapons/w_smg1.mdl"
SWEP.Category = "Happys Sweps"
SWEP.Primary.ClipSize = 30
SWEP.Primary.DefaultClip = 30
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = "pistol"
SWEP.Weight = 5
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
function SWEP:PrimaryAttack()
if ( !self:CanPrimaryAttack() ) then return end
self.Weapon:EmitSound( "Weapon_SMG1.Single" )
self:ShootBullet( 7 ,2, 0.01 )
self.Weapon:SetNextPrimaryFire( CurTime() + 0.2)
self:TakePrimaryAmmo( 1 )
self.Owner:ViewPunch( Angle( -1, 0, 0 ) )
local tr = util:TraceLine({
start = self.Owner:EyePos(),
endpos = self.Owner:EyePos() + self.Owner:EyeAngles():Forward() * 10000,
})
local effectdata = EffectData()
effectdata:SetStart(self.Owner:EyePos())
effectdata:SetOrigin(tr.HitPos)
effectdata:SetScale( 3 )
util.Effect( "Sparks", effectdata )
end
local Time = CurTime()
function SWEP:Reload()
if ( self.Weapon:Ammo1() <= 0 ) then return end
if ( self.Weapon:Clip1() >= self.Primary.ClipSize ) then return end
if (CurTime() < Time + 0.5) then return end --Replace here
Time = CurTime()
timer.Simple(0.1,function() self.Weapon:EmitSound("Weapon_SMG1.Reload") end)
self.Owner:SetAnimation(PLAYER_RELOAD)
self.Weapon:DefaultReload(ACT_VM_RELOAD)
end
[/CODE]
It only spawn sparkles next to the spawn in gm_construct
It don't give me error
[QUOTE=Garr;45402180][CODE]util.Effect( "Sparks ", effectdata )[/CODE][/QUOTE]
Is it because of the extra space you have in "Sparks " ? Just trying to rule out what might be the obvious problem, but if it doesn't care about the space, sorry.
[QUOTE=Mista Tea;45402669]Is it because of the extra space you have in "Sparks " ? Just trying to rule out what might be the obvious problem, but if it doesn't care about the space, sorry.[/QUOTE]
It is not the problem i already taked off this space.
[editline]15th July 2014[/editline]
Made it, solved.
Sorry, you need to Log In to post a reply to this thread.