dobrograd-13-06-2022/garrysmod/addons/feature-cars/lua/car-dealer/cl_test.lua
Jonny_Bro (Nikita) e4d5311906 first commit
2023-11-16 15:01:19 +05:00

28 lines
566 B
Lua

netstream.Hook('followVehicles', function(vehs, dir)
hook.Add('CalcView', 'followVehicles', function(ply, pos, ang, fov)
local pos = Vector()
for i = #vehs, 1, -1 do
local veh = vehs[i]
if IsValid(veh) then
pos = pos + veh:GetPos()
else
table.remove(vehs, i)
end
end
if #vehs <= 0 then return hook.Remove('CalcView', 'followVehicles') end
pos = pos / #vehs - dir * 50 + Vector(0, 0, 400)
local ang = dir:Angle()
ang:RotateAroundAxis(ang:Right(), -80)
return {
origin = pos,
angles = ang,
fov = 110,
}
end)
end)