Ok so I have a code on my prop hunt server that gives the last prop a gun. The problem is when the prop gets the gun, the view doesn’t change which makes it a real pain when trying to shoot. So I’m wanting to make it so that when that last prop gets the gun, it switches to the weapon view. I’ve tried a number of different things but can’t get it to work correctly.
Here is the default code for the views.
// Give the active weapon a go at changing the viewmodel position
if pl:Team() == TEAM_PROPS && pl:Alive() then
view.origin = origin + Vector(0, 0, hullz - 60) + (angles:Forward() * -80)
local wep = pl:GetActiveWeapon()
if wep && wep != NULL then
local func = wep.GetViewModelPosition
if func then
view.vm_origin, view.vm_angles = func(wep, origin1, angles1) // Note: *1 to copy the object so the child function can’t edit it.
local func = wep.CalcView if func then view.origin, view.angles, view.fov = func(wep, pl, origin*1, angles*1, fov) // Note: *1 to copy the object so the child function can't edit it. end end
Another problem is, when the prop gets the weapon, it also spawns their player model with them. And I have no clue how to disable that or make it so the model cant be seen.
I’d really appreciate if someone could help me with these issues.