ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Shared functions
  3. getPlayerMoney

Function

getPlayerMoney

Server and clientPlayersIdentical to MTA:SA

Returns the player's money. The server holds the balance; the in-game counter only displays it.

Syntax

int getPlayerMoney(player thePlayer)

Arguments

thePlayerplayer
The player.

Returns

The amount.

Example

addCommandHandler("kup", function(player)
    if getPlayerMoney(player) < 500 then
        outputChatBox("Za mało pieniędzy.", player, 255, 0, 0)
        return
    end
    takePlayerMoney(player, 500)
    giveWeapon(player, 22, 50)
end)

Notes

Also in client scripts. On the client the argument is optional: without it the function returns your own money. Only the server can change it.

See also