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:
28
resources/[gameplay]/[examples]/money-fountain/mapdata.lua
Normal file
28
resources/[gameplay]/[examples]/money-fountain/mapdata.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
-- define the money fountain list (SHARED SCRIPT)
|
||||
moneyFountains = {}
|
||||
|
||||
-- index to know what to remove
|
||||
local fountainIdx = 1
|
||||
|
||||
AddEventHandler('getMapDirectives', function(add)
|
||||
-- add a 'money_fountain' map directive
|
||||
add('money_fountain', function(state, name)
|
||||
return function(data)
|
||||
local coords = data[1]
|
||||
local amount = data.amount or 100
|
||||
|
||||
local idx = fountainIdx
|
||||
fountainIdx += 1
|
||||
|
||||
moneyFountains[idx] = {
|
||||
id = name,
|
||||
coords = coords,
|
||||
amount = amount
|
||||
}
|
||||
|
||||
state.add('idx', idx)
|
||||
end
|
||||
end, function(state)
|
||||
moneyFountains[state.idx] = nil
|
||||
end)
|
||||
end)
|
||||
Reference in New Issue
Block a user