Back to TPG

TPG.Economy.Charge

S🏷️ Economy

Part of TPG namespace

TPG.Economy.Charge(ply, cost, reason)
View on GitHub|gamemode/systems/sv_economy.lua:269-276
📋 Has LDoc👁️ 3 viewsUpdated 1 month ago

Description

Deduct a cost if the player can afford it, and notify them of the charge. Unlike ECON.Reward/ECON.Penalize, this does NOT check ECON.Active itself -- every current call site (dupe purchases, gear, stock vehicles) already gates the call on the economy being active, but a future caller that forgets to check ECON.Active first would still successfully charge the player's wallet. the player is invalid or can't afford it.

Parameters

NameTypeDescription
plyPlayer
costnumber
reason?stringPassed through to `ECON.Notify`.(default: "purchase")

Returns

TypeDescription
booleanTrue if the charge succeeded; false (no state change) if

Examples

No examples available.

Used In

No usages found in the codebase.