DarkRP.PlayerWalletChanged
Jump to navigation
Jump to search
ply (Player)
amount (number)
total (number)
This page refers to DarkRP 2.4.3. This information may be incorrect as of later versions. Check here for a up-to-date list of hooks. |
---|
Syntax[edit]
Description | Called when someone's wallet changes |
---|---|
Syntax |
GAMEMODE:PlayerWalletChanged(Player ply, number amount, number total)
|
Returns | money_amount (number): override for money amount after the transaction (see examples) |
Arguments
The player whose money changed
How much money was ADDED to the wallet (it's a negative number when money was REMOVED)
How much money the player had BEFORE the transaction
Examples[edit]
Description | logs money |
---|---|
Code | hook.Add( "PlayerWalletChanged", "example", function(ply, amount)
ply:ChatPrint(ply:Nick() .. " got $" .. amount)
end)
|
Output | A print message |
Description | People's money can't be more than the given limit . Put in a serverside Lua file to make it work. |
---|---|
Code | local limit = 200000
hook.Add("PlayerWalletChanged", "WalletCap", function(ply, amount, total)
return math.Min(total + amount, limit) -- Return the minimum between the changed total and the limit
end)
|
Output | People never getting more than $200,000 in their wallets |