HUD
Functions

GM: CD can Buy Vehicle

Called when a player tries to buy a car using the car dealer.

Used in: VCMod Main addon.

Server GM:VC_CD_canBuyVehicle(Entity ply, String vehID, Entity npc)

Arguments

1. Entity ply; Player
Player who is doing it.

2. String vehID; Vehicle ID
VCMod Car Dealers vehicle ID.

3. Entity npc; Car Dealer
The entity of the car dealer.

Returns

1. Boolean If it should allow player to buy it or not.

Example

hook.Add("VC_CD_canBuyVehicle", "VC_CD_canBuyVehicle", function(ply, vehID, npc)
	local blacklist = {}
	table.insert(blacklist, "models/buggy.mdl") // Half-Life 2 buggy
	table.insert(blacklist, "models/vehicle.mdl") // Half-Life 2 Episode 2 jalopy

	local model, name, skin = VC_CD_getVehicleDataFromID(vehID)
	local dist = pos:Distance(Vector(0,0,0))
	if table.HasValue(blacklist, model) then
		print("Player :"..ply:Nick().." is attempting to buy a restricted vehicle, stopping.")
		local can = false
		return can
	end
end)
Page modified:
...2018-11-02 09:24:35