players.giveMoney
Adds to the money on a player’s HUD, or takes from it with a negative amount. It’s GTA:SA’s own HUD money, what the player sees: keep the real balance in your gamemode’s own data and set the HUD from it.
Signature
Section titled “Signature”players.giveMoney(player: PlayerTarget, amount: number): Promise<ActionResult>Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
player |
PlayerTarget |
The player, or their ID. |
amount |
number |
How much to add; negative takes money away. -999,999,999 to 999,999,999. |
Returns
Section titled “Returns”A promise of an ActionResult: applied once the player’s game has carried it out, rejected with a code, or timeout after five seconds without an answer.
Example
Section titled “Example”import { players, server } from "nativemp";
server.on("playerSpawned", async ({ player }) => { await players.giveMoney(player, 500); // a reward});Related
Section titled “Related”players.setMoney: the other way to change itpickups.create: type 8 pickups are money
A captured Player keeps this effect bound to its connection across awaits; see Async handlers.