Garry's Mod Wiki

Garry's Mod Wiki

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

Description

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.

Arguments

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

Returns

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

Example

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 )

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated twice a day. Edits and history are not available.

Last Parsed: Loading...