TakePlayerMoney: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 17: Line 17:
end
end
end</syntaxhighlight>
end</syntaxhighlight>
==See Also==
{{Player functions}}

Revision as of 20:04, 20 May 2006

Subtracts money from the player's current money amount.

Syntax

takePlayerMoney ( player, money )

Required Arguments

  • Player: Tells the function to give money to a player
  • Money: A whole integer specifying the amount of money to give to the player

Example

Note: Player is not defined in this function, so I used source to point to the player. You can read about using source on the LUA Tips and Tricks page

addEventHandler ( "onPlayerConsole", root, "onConsole" )
function onConsole ( message )
	if gettok(message, 1, 32) == "!takecash" then --when the player types !takecash in the console
		takePlayerMoney ( source, -100 ) --subtract $100 from player's money
	end
end

See Also