if target:Team() == TEAM_KILLER && !target.batstun then
timer.Simple(0, function()
target:SetVelocity(Vector(0,1500,0))
end)
local randomfreeze = math.random(1,10)
randomfreeze = math.Round(randomfreeze)
if randomfreeze == 1 then
timer.Create("stun_basebat" .. target:UniqueID(), math.random(4, 6), 1, function()
if !IsValid(target) then return end
if target:Alive() then
target:SetMoveType(MOVETYPE_WALK)
target:SetRunSpeed(target.stungun_runspeed)
target:SetWalkSpeed(target.stungun_walkspeed)
end
target:SetMoveType(MOVETYPE_WALK)
target.batstun = false
end)
target:SetMoveType(MOVETYPE_NONE)
target.batstun = true
target.stungun_runspeed = target:GetRunSpeed()
target.stungun_walkspeed = target:GetWalkSpeed()
target:SetRunSpeed(50)
target:SetWalkSpeed(50)
else
timer.Create("stun_basebat" .. target:UniqueID(), math.random(4, 6), 1, function()
if !IsValid(target) then return end
if target:Alive() then
target:SetRunSpeed(target.stungun_runspeed)
target:SetWalkSpeed(target.stungun_walkspeed)
end
target.batstun = false
end)
target.batstun = true
target.stungun_runspeed = target:GetRunSpeed()
target.stungun_walkspeed = target:GetWalkSpeed()
target:SetRunSpeed(50)
target:SetWalkSpeed(50)
end
end
end
hook.Add("EntityTakeDamage", "stungun_EntityTakeDamage", EntityTakeDamage)
This code im currently using to if the enemy get hits he pushed away but not to the eye trace of the guy using this weapon…
How i must modify this code to get the setvelocity on eyetrace and maybe not as timer… so it called everytime if i hit the enemy with this weapon
thanks alot