forcing bullets to hit a player

doing this for a swep, what functions should i use?, basically i want to force the bullet to hit the player, whether aiming or not, any idea

calculate bullet direction to be facing a player?

Make a fake bullet …


local attacker = 
local victim = 
local force = 100
local DM = 50

local dmginfo = DamageInfo()
dmginfo:SetDamage( DM )
dmginfo:SetDamageType( DMG_BULLET )
dmginfo:SetAttacker( attacker )
dmginfo:SetDamageForce( (victim:GetPos()-attacker:GetPos()):Normalize( ) * force )
dmginfo:TakeDamageInfo(victim ) -- "Fires" the bullet

Then add some fake clientside-trails or something to give the effect of a bullet shoot.

what about forcing the seed?

it might be a bit off the hook , but you could set the players eyeangles aiming towards the players head , then you are forcing the bullet to fly that way , But i’m not sure if it is that what you mean ; D

meh made something in 5 mins you might wanna use this in your advantage

[LUA]local t_vict = {}

function SWEP:AimQualifier()
local victheadpos
for k, v in pairs(player.GetAll()) do
local head = v:LookupBone(“ValveBiped.Bip01_Head1”)–or whatever part you want your bullet be piercing trough
t_vict = v:GetBonePosition(head)
victheadpos = t_vict[1]
end
return victheadpos
end

function SWEP:ForceBullet()
local eyes = self.Owner:EyeAngles()
eyes.pitch = victheadpos
self.Owner:SetEyeAngles( eyes )
end[/LUA]