Garry's Mod Wiki

Revision Difference

GM:CanExitVehicle#527793

<function name="CanExitVehicle" parent="GM" type="hook"> <ishook>yes</ishook> <description>Determines if the player can exit the vehicle.</description> <realm>Server</realm> <predicted>No</predicted> <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> function GM:CanExitVehicle(veh, ply) hook.Add( "CanExitVehicle", "PlayerMotion", function( veh, ply ) return ( veh:GetVelocity() == Vector( 0, 0, 0 ) ) end⤶ end )⤶ </code> ⤶ </example></example>