Allow only certain teams to enter SENT / Scripted Vehicle

I want only certain teams to be able to enter in a Combine APC mod I downloaded from the workshop. I am able to edit it’s code as I extracted it and unsubscribed.

You could use


[editline]29th February 2016[/editline]


hook.Add( 'CanPlayerEnterVehicle', 'no_enter_APC', function( ply, veh, srole ) -- hook into canplayerentervehicle

    if ( ply:Team() == SOME_TEAM ) and ( veh:GetModel() == 'SOME_MODEL.mdl' ) then -- change SOME_TEAM to whatever team you want to be able to get in
        return true -- let them get in
        return false -- don't let them get in

end )

I used GetModel to check the vehicle in the example there, but you could change that to check the class or whatever you want

The code given above should work. If you want to notify the player who can’t enter the vehicle by using