Multi Theft Auto: Wiki:Exports.global:giveMoney: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m (Oldmr3b moved page Oldmr3b to Multi Theft Auto: Wiki:Exports.global:giveMoney) |
(No difference)
|
Latest revision as of 04:44, 28 February 2021
exports.global:giveMoney
The function gives the player money in RolePlay
Syntax
bool exports.global:giveMoney ( theElement, amount )
OOP Syntax Help! I don't understand this!
- Method: player:giveMoney(...)
- Variable: ..money
Required Arguments
- thePlayer: the player you are giving the money to..
- amount: a positive integer number specifying the amount of money to give to the player.
Returns
Returns true if the money was added, or false if invalid parameters were passed.
Example
Click to collapse [-]
Example 1 - ServerThis example gives a player money when using "givemoney" command.
function givePlayerMoney ( thePlayer, command, amount ) --when the givecash command is called exports.global:giveMoney ( thePlayer, amount ) --give the player money according to the amount end addCommandHandler ( "givemoney", givePlayerMoney) --add a handler function for the command "givecash"
Click to collapse [-]
Example 2 - ClientThis example gives a player money when using "givemoney" command.
function givePlayerMoney ( command, amount ) --when the givecash command is called exports.global:giveMoney ( localPlayer, amount ) --give the player money according to the amount end addCommandHandler ( "givemoney", givePlayerMoney) --add a handler function for the command "givecash"