fixed mafiawar timer 00:00

update
rubin 2 years ago
parent 29463537b6
commit c8b45e09a0
  1. 36
      mafia-tools.lua

@ -969,27 +969,11 @@ mafiawar.time = 0
mafiawar.onServerMessage = function(color, message)
if message:find("^ Начать войну можно не раньше (%d+):00$") then
local hour = message:match("^ Начать войну можно не раньше (%d+):00$")
datetime = {
year = tonumber(os.date("%Y")),
month = tonumber(os.date("%m")),
day = tonumber(os.date("%d")),
hour = tonumber(hour),
min = 0,
sec = 0
}
mafiawar.time = os.time(datetime)
mafiawar.set_time(hour)
end
if message:find("^ Начать войну с этой мафией можно не раньше (%d+):00$") then
local hour = message:match("^ Начать войну с этой мафией можно не раньше (%d+):00$")
datetime = {
year = tonumber(os.date("%Y")),
month = tonumber(os.date("%m")),
day = tonumber(os.date("%d")),
hour = tonumber(hour),
min = 0,
sec = 0
}
mafiawar.time = os.time(datetime)
mafiawar.set_time(hour)
end
if message == " Вы далеко от бизнеса" then
if mafiawar.biz then
@ -1010,6 +994,22 @@ mafiawar.onServerMessage = function(color, message)
end
end
end
mafiawar.set_time = function(hour)
local hour = message:match("^ Начать войну с этой мафией можно не раньше (%d+):00$")
local time = os.time()
if tonumber(hour) < tonumber(os.date("%H")) then
time = time + 10000
end
datetime = {
year = tonumber(os.date("%Y", time)),
month = tonumber(os.date("%m", time)),
day = tonumber(os.date("%d", time)),
hour = tonumber(hour),
min = 0,
sec = 0
}
mafiawar.time = os.time(datetime)
end
mafiawar.onCreate3DText = function(id, color, position, distance, testLOS, attachedPlayerId, attachedVehicleId, text)
-- msg.add(string.format("%d", color))

Loading…
Cancel
Save