TakePlayerMoney: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 4: Line 4:


==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">bool takePlayerMoney ( player thePlayer, int amount )</syntaxhighlight>  
<section name="Server" class="server" show="true">
<syntaxhighlight lang="lua">
bool takePlayerMoney ( player thePlayer, int amount )
</syntaxhighlight>  


====Required Arguments====  
====Required Arguments====  
*'''thePlayer:''' the [[player]] you are taking the money from.
*'''thePlayer:''' the [[player]] you are taking the money from.
*'''amount:''' an integer number specifying the amount of money to take from the player.
*'''amount:''' an integer number specifying the amount of money to take from the player.
</section>
<section name="Client" class="client" show="true">
<syntaxhighlight lang="lua">
bool takePlayerMoney ( int amount )
</syntaxhighlight>
====Required Arguments====
*'''amount:''' an integer number specifying the amount of money to take from the player.
</section>


===Returns===
===Returns===

Revision as of 19:05, 20 February 2009

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

Syntax

Click to collapse [-]
Server
bool takePlayerMoney ( player thePlayer, int amount )

Required Arguments

  • thePlayer: the player you are taking the money from.
  • amount: an integer number specifying the amount of money to take from the player.
Click to collapse [-]
Client
bool takePlayerMoney ( int amount )

Required Arguments

  • amount: an integer number specifying the amount of money to take from the player.

Returns

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

Example

This example takes money from a player when he types "takecash number" 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