Garry's Mod Wiki

SANDBOX:CanDrive

  boolean SANDBOX:CanDrive( Player ply, Entity ent )
This hook is predicted. This means that in singleplayer, it will not be called in the Client realm.

Description

Called when a player attempts to drive a prop via Prop Drive

Arguments

1 Player ply
The player who attempted to use Prop Drive.
2 Entity ent
The entity the player is attempting to drive

Returns

1 boolean
Return true to allow driving, false to disallow

Example

Stops nonadmins from using Prop Drive

function GM:CanDrive( ply, ent ) if !ply:IsAdmin() then return false end end