mirror of
https://github.com/citizenfx/cfx-server-data.git
synced 2025-12-12 06:14:09 +01:00
gameplay: example money, money fountain, ped money drop and player ID systems
This commit is contained in:
30
resources/[gameplay]/[examples]/money/client.lua
Normal file
30
resources/[gameplay]/[examples]/money/client.lua
Normal file
@@ -0,0 +1,30 @@
|
||||
local moneyTypes = {
|
||||
cash = `MP0_WALLET_BALANCE`,
|
||||
bank = `BANK_BALANCE`,
|
||||
}
|
||||
|
||||
RegisterNetEvent('money:displayUpdate')
|
||||
|
||||
AddEventHandler('money:displayUpdate', function(type, money)
|
||||
local stat = moneyTypes[type]
|
||||
if not stat then return end
|
||||
StatSetInt(stat, math.floor(money))
|
||||
end)
|
||||
|
||||
TriggerServerEvent('money:requestDisplay')
|
||||
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(0)
|
||||
|
||||
if IsControlJustPressed(0, 20) then
|
||||
SetMultiplayerBankCash()
|
||||
SetMultiplayerWalletCash()
|
||||
|
||||
Wait(4350)
|
||||
|
||||
RemoveMultiplayerBankCash()
|
||||
RemoveMultiplayerWalletCash()
|
||||
end
|
||||
end
|
||||
end)
|
||||
Reference in New Issue
Block a user