takePlayerMoney | Multi Theft Auto: Wiki Skip to content

takePlayerMoney

Client-side
Server-side
Shared

Manual Review Required

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


This function subtracts money from a player's current money amount.

Note

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

OOP Syntax Help! I don't understand this!

  • Method:player:takeMoney(...)
  • Variable: .money

Syntax

bool takePlayerMoney ( int amount )
Required Arguments
  • amount: MISSING_PARAM_DESC

Returns

  • bool: value

Returns true if the money was taken, or false if invalid parameters were passed.

Code Examples

server

This example takes money from a player when he types "takecashnumber" in the console.

function takeCash ( thePlayer, command, amount ) -- when the takecash command is called
takePlayerMoney ( thePlayer, tonumber(amount) ) -- take the amount of money from the player
end
addCommandHandler ( "takecash", takeCash ) -- add a handler function for the command "takecash"

See Also