Garry's Mod Wiki

Revision Difference

GM:CanExitVehicle#560608

<function name="CanExitVehicle" parent="GM" type="hook"> <description>Determines if the player can exit the vehicle on their own. <page>Player:ExitVehicle</page> will bypass this hook.</description> <realm>Server</realm> <file line="567">gamemodes/base/gamemode/player.lua</file>⤶ <args> <arg name="veh" type="Vehicle">The vehicle entity</arg> <arg name="ply" type="Player">The player</arg> </args> <rets> <ret name="" type="boolean">True if the player can exit the vehicle.</ret> </rets> </function> <example> <description>Only lets player exit vehicle if it is not in motion.</description> <code> hook.Add( "CanExitVehicle", "PlayerMotion", function( veh, ply ) return ( veh:GetVelocity() == Vector( 0, 0, 0 ) ) end ) </code> </example>