givePlayerMoney | Multi Theft Auto: Wiki Skip to content

givePlayerMoney

Client-side
Server-side
Shared

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


This function adds money to a player's current money amount. To set absolute values, setPlayerMoney can be used.

Note

Using this function client side (not recommended) will not change a players money server side.

Note

As of MTA SA version 1.5.9, despite the documentation claiming that amount should be a positive integer, this function does work with negative values or zero. In that case the function does still add the number to the game money value, in the negative case resulting in a decreased value.

Syntax

givePlayerMoney ( )

Code Examples

server

This example gives a player money when using "givecash" command.

function consoleGiveCash ( thePlayer, command, amount ) --when the givecash command is called
givePlayerMoney ( thePlayer, amount ) --give the player money according to the amount
end
addCommandHandler ( "givecash", consoleGiveCash ) --add a handler function for the command "givecash"

See Also