mirror of
https://gitlab.com/lunovox/minertrade.git
synced 2025-03-15 05:31:20 +00:00
adicionar salário no mod. (não testada)
This commit is contained in:
parent
5456150647
commit
3eb3bf035e
2 changed files with 49 additions and 1 deletions
3
init.lua
3
init.lua
|
@ -14,7 +14,8 @@ dofile(modpath.."/item_exchange_table.lua")
|
|||
dofile(modpath.."/item_dispensing_machine.lua")
|
||||
-- --dofile(path.."/item_rent_door.lua")
|
||||
|
||||
dofile(modpath.."/payday.lua") -- <== Pay diary per playing in server.
|
||||
dofile(modpath.."/commands.lua")
|
||||
dofile(modpath.."/on_final.lua") -- <== Depois que carregou tudo!
|
||||
dofile(modpath.."/on_final.lua") -- <== Only after load all code!
|
||||
|
||||
minetest.log('action',"["..modname:upper().."] Loaded!")
|
||||
|
|
47
payday.lua
Normal file
47
payday.lua
Normal file
|
@ -0,0 +1,47 @@
|
|||
--[[
|
||||
minetest.after(3.5, function()
|
||||
modMinerTrade.payday = {
|
||||
interval = (60 *24) / (tonumber(minetest.setting_get("time_speed")) or 72),
|
||||
time = 0
|
||||
}
|
||||
modMinerTrade.payday.interval = 1
|
||||
minetest.register_globalstep(function(dtime)
|
||||
modMinerTrade.payday.time = modMinerTrade.payday.time + dtime
|
||||
if modMinerTrade.payday.time >= modMinerTrade.payday.interval then
|
||||
|
||||
end
|
||||
end)
|
||||
end)
|
||||
--]]
|
||||
|
||||
minetest.after(3.5, function()
|
||||
local interval = 5
|
||||
local time = 0
|
||||
minetest.register_globalstep(function(dtime)
|
||||
time = time + dtime
|
||||
if time >= interval then
|
||||
time = 0
|
||||
local dc = minetest.get_day_count()
|
||||
local players = minetest.get_connected_players()
|
||||
local salary = "minertrade:minercoin 1"
|
||||
if #players >= 1 then
|
||||
for _, player in ipairs(players) do
|
||||
local playername = player:get_player_name()
|
||||
local inv = modMinerTrade.getSafeInventory(ownername)
|
||||
local lp = tonumber(player:get_meta("last_pay")) or 0
|
||||
if lp ~= dc then
|
||||
player:set_meta("last_pay",dc)
|
||||
minetest.chat_send_player(
|
||||
playername,
|
||||
core.colorize("#00ff00", "["..modMinerTrade.translate("CITY HALL").."]: ")
|
||||
..modMinerTrade.translate("The city hall deposited your salary in your bank account!")
|
||||
)
|
||||
minetest.sound_play("sfx_cash_register", {object=player, max_hear_distance=5.0,})
|
||||
inv:add_item("safe_"..playername, salary)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
Loading…
Add table
Reference in a new issue