So I got a player who’s sitting in a seat (prop_vehicle_prisoner_pod) and I want him to be able to see his view model, shoot, reload and toggle ironsights. So far I got the view model visible using ply:DrawViewModel(true) after entering the seat.
I was able to make the player shoot using this in a shared script:
local function KeyPress(ply, key) if ply:InVehicle() and IsValid(ply:GetActiveWeapon()) then local wep = ply:GetActiveWeapon() if key == IN_ATTACK then wep:PrimaryAttack() elseif key == IN_ATTACK2 then wep:SecondaryAttack() elseif key == IN_RELOAD then wep:Reload() end return true end end hook.Add( "KeyPress", "Vehicle.KeyPress", KeyPress)
But the secondary attack does nothing and when the clip runs empty, it plays the reload animation without actually reloading.
Pressing reload manually does the same thing. Also the primary attack and reload don’t seem to take their delays into account.
Can somebody tell me if it can be done like this or there’s some other way?