Garry's Mod Wiki


  boolean GM:CanPlayerEnterVehicle( Player player, Vehicle vehicle, number role )


Determines whether or not a given player player can enter the given vehicle. Player:EnterVehicle will still call this hook.

Called just before GM:PlayerEnteredVehicle. See also GM:CanExitVehicle.


1 Player player
The player that wants to enter a vehicle.
2 Vehicle vehicle
The vehicle in question.
3 number role
The seat number.


1 boolean
false if the player is not allowed to enter the vehicle.


Displays a message in the console when a player enters any vehicle.

hook.Add( "CanPlayerEnterVehicle", "PrintPlayersInVehicles", function( ply, veh, role ) print( ply, "has entered the vehicle", veh ) end )