HUD
Functions

GM: CD can Spawn Vehicle

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

Used in: VCMod Main addon.

Server GM:VC_CD_canSpawnVehicle(Entity ply, String vehID, Vector pos, Angle ang, Entity npc, Table ranksRestr, Table jobRestr)

Arguments

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

2. String vehID; Vehicle ID
The VCMod car dealer vehicle ID.

3. Vector pos; Position
The position where the car dealer would be placed.

4. Angle ang; Angle
The angle of the would-be car dealer.

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

6. Table ranksRestr; Restricted ranks
A list of all rank restrictions, seperate for NPC and object.

7. Table jobRestr; Restricted jobs
A list of all job restrictions, seperate for NPC and object.

Returns

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

Example

hook.Add("VC_CD_canSpawnVehicle", "VC_CD_canSpawnVehicle", function(ply, vehID, pos, ang, npc, ranksRestr, jobRestr)
	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 spawn a restricted vehicle, stopping.")
		local can = false
		return can
	end
end)
Page modified:
...2020-11-16 22:30:48