HUD
Functions

GM: can Remove Money

Called before money is being removed from users wallet. This is mostly for custom gamemode compatibility.

Used in: VCMod Main, VCMod ELS addons.

Server GM:VC_canRemoveMoney(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_canRemoveMoney", "VC_RestrictBuyingSpecificVehicle", 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 == "CDvehBuy" then
		local model, name, skin = VC_CD_getvehicleDataFromID(var)
		if model == "models/vehicle.mdl" then
			print("Player :"..ply:Nick().." is attempting to buy that one blocked vehicle, stopping.")
			return
		end
	end

	print("Player :"..ply:Nick().." is attempting to spend "..amount.." amount of money.")

	// Lets call our custom gamemode function
	disAwesomeGamemode.spendMoney(ply, amount)

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