HUD
Functions

GM: can Add Money

Called before money is being added to users wallet. This is mostly for custom gamemode compatibility.

Used in: VCMod Main, VCMod ELS addons.

Server GM:VC_canAddMoney(Entity ply, Integer amount, String info)

Arguments

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

2. Integer amount; Amount
The amount of money.

3. String info; Information
Has a prefix_variable structure. Current prefixes: CDvehBuy, CDvehSell, CDvehReturn, RMrepairs, FuelPurchase.

Returns

1. Boolean Returning false will stop the default VCMod alterations to players wallet.

Example

hook.Add("VC_canAddMoney", "VC_RestrictSellingSpecificVehicle", function(ply, amount, info)

	// Split the info into prefix and a variable
	local data = string.Explode("_", info)

	// Get the prefix
	local prefix = data[1]

	// Remove prefix from data chunks
	data[1] = nil

	// Get the variable
	local var = string.Implode("_", data)

	if var and prefix == "CDvehSell" then
		local model, name, skin = VC_CD_getvehicleDataFromID(var)
		if model == "models/vehicle.mdl" then
			print("Player :"..ply:Nick().." is attempting to sell that one blocked vehicle, stopping.")
			return
		end
	end

	print("Player :"..ply:Nick().." is receiving "..amount.." amount of money.")
	// Lets call our custom gamemode function
	disAwesomeGamemode.giveMoney(ply, amount)

	local can = false
	return can
end)
Page modified:
...2018-11-02 09:24:34