Part of TPG namespace
TPG.Economy.Charge(ply, cost, reason)📋 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
| Name | Type | Description |
|---|---|---|
ply | Player | |
cost | number | |
reason? | string | Passed through to `ECON.Notify`.(default: "purchase") |
Returns
| Type | Description |
|---|---|
boolean | True if the charge succeeded; false (no state change) if |
Examples
No examples available.
Used In
No usages found in the codebase.