From DarkRP
Jump to navigation Jump to search
This page refers to DarkRP 2.4.3. This information may be incorrect as of later versions.
Check here for a up-to-date list of hooks.


DescriptionCalled when a player wants to buy a vehicle
GAMEMODE:PlayerBuyVehicle(Player ply, Entity ent)
Returnsallowed (boolean): whether the player is allowed to buy this vehicle.

reason (string): the reason to give to the player if they are not allowed to buy the vehicle

surpressMessage (boolean): whether the "You bought this vehicle!" message should be surpressed.


  • ply (Player)
  • The player who wants to buy it

  • ent (Entity)
  • The vehicle in question


    DescriptionAllows only citizens to buy vehicles. The reason it gives to non-citizens is that they're not citizens. It also makes sure the message "You bought this vehicle!" does not appear (that's what the last true does)
    hook.Add( "PlayerBuyVehicle", "example", function(ply, ent)
    	return ply:Team() == TEAM_CITIZEN, "You're not a citizen!", true
    OutputAll vehicles are citizen only