[HELP] gmod_vehicle_viewmode - Updating to Get/SetThirdpersonMode

I haven’t found anything else listed about this, so I think it probably needs one so anyone else with this problem can have something to refer to.

The air vehicle base I use currently has this code:


if (CLIENT) then

hook.Add("CalcView", "AVehicle:Seat:CalcView", function(ply,origin,angles,fov)        local seat = ply:GetVehicle();
        if IsValid(ply) and ply:GetNWBool("AVehicleSeatOccupied") and IsValid(seat) and seat.isAVehicleSeat and not (seat.isAvehiclePod) then
            if (gmod_vehicle_viewmode:GetInt() == 1) then -- This is the line that is problematic
                local view = {};
                local posang = seat:GetAttachment(seat:LookupAttachment("vehicle_feet_passenger0"));
                local tracedata = {}
                tracedata.start = posang.Pos + (posang.Ang:Up() * 25)
                tracedata.endpos = posang.Pos +  (posang.Ang:Up() * 25)     + (angles:Forward() * (-1*seat.ThirdViewDistance)) ;
                tracedata.filter = {seat, ply};
                tracedata.mins = Vector(-5,-5,-5);
                tracedata.maxs = Vector(5,5,5);
                tracedata.mask =  MASK_SOLID_BRUSHONLY + MASK_PLAYERSOLID_BRUSHONLY + CONTENTS_SOLID;
                local trace =  util.TraceHull(tracedata);
                view.angles = angles;
                view.origin = trace.HitPos + (posang.Ang:Up() * 25);
                view.fov = fov;    
                if (AVehicles) and (AVehicles.Vehicle) and (AVehicles.Vehicle.IsIn) then
                    return GAMEMODE:CalcView(ply, view.origin, view.angles, fov);
                else
                    return view;
                end
                
            else
                local posang = seat:GetAttachment(seat:LookupAttachment("vehicle_feet_passenger0"));
                return GAMEMODE:CalcView(ply,posang.Pos + posang.Ang:Up() * 25,angles,fov)
            end
        end
        return GAMEMODE:CalcView(ply,origin,angles,fov)
    end);


end


The command ‘gmod_vehicle_viewmode’ was removed and replaced with:

I’m not very proficient in lua, so I’m hoping someone here can help me fix this, as I’ve fixed every other bug with the base save this one.

Thanks in advance.