mirror of
https://codeberg.org/usrib/emeraldbank.git
synced 2024-12-23 14:42:27 +01:00
income fix
This commit is contained in:
parent
aff751548b
commit
38b8d28105
29
income.lua
29
income.lua
@ -22,24 +22,21 @@
|
|||||||
|
|
||||||
local S = core.get_translator(core.get_current_modname())
|
local S = core.get_translator(core.get_current_modname())
|
||||||
|
|
||||||
local income_enabled = core.settings:get_bool("emeraldbank.income_enabled", true)
|
|
||||||
local income_count = tonumber(core.settings:get("emeraldbank.income_count")) or 1
|
local income_count = tonumber(core.settings:get("emeraldbank.income_count")) or 1
|
||||||
local income_period = tonumber(core.settings:get("emeraldbank.income_period")) or 1800
|
local income_period = tonumber(core.settings:get("emeraldbank.income_period")) or 1800
|
||||||
|
|
||||||
|
local timer = 0
|
||||||
|
|
||||||
-- income
|
core.register_globalstep(function(dtime)
|
||||||
if income_enabled then
|
timer = timer + dtime;
|
||||||
local timer = 0
|
if timer >= income_period then
|
||||||
core.register_globalstep(function(dtime)
|
timer = 0
|
||||||
timer = timer + dtime;
|
for _, player in ipairs(core.get_connected_players()) do
|
||||||
if timer >= income_period then
|
if not player or player.is_fake_player then return end
|
||||||
timer = 0
|
local name = player:get_player_name()
|
||||||
for _, player in ipairs(core.get_connected_players()) do
|
core.chat_send_player(name, S("You have earned @1 emeralds in your bank account!", income_count) )
|
||||||
if not player or player.is_fake_player then return end
|
emeraldbank.add_emeralds(player, income_count)
|
||||||
local name = player:get_player_name()
|
|
||||||
core.chat_send_player(name, S("You have earned @1 emeralds in your bank account!", income_count) )
|
|
||||||
emeraldbank.add_emeralds(player, income_count)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end)
|
end
|
||||||
end
|
end)
|
||||||
|
Loading…
Reference in New Issue
Block a user