added render timer ammo

update
rubin 2 years ago
parent f2ee17e748
commit e1c98f5ef4
  1. 38
      mafia-tools.lua

@ -72,9 +72,29 @@ ammo_timer.onServerMessage = function(color, message)
}
end
end
ammo_timer.data = {
ls = { time = 0, text = "00:00:00" },
sf = { time = 0, text = "00:00:00" },
lv = { time = os.time() - 1800, text = "10:00:00" },
mhcars = { time = 0, text = "00:00:00" },
}
ammo_timer.loop = function()
font = renderCreateFont(config.data.font.name,config.data.font.size,config.data.font.flag)
local getText = function(key)
if ammo_timer.data[key]["time"] == 0 then
return string.format("{%s}%s:{%s} %s", config.data.font.color1, key:upper(), config.data.font.color2, ammo_timer.data[key]["text"])
else
local min = math.floor((os.time() - ammo_timer.data[key]["time"]) / 60)
return string.format("{%s}%s:{%s} %s (%d min)", config.data.font.color1, key:upper(), config.data.font.color2, ammo_timer.data[key]["text"], min)
end
end
while true do
wait(0)
local text = string.format("%s\n%s\n%s\n%s", getText("ls"), getText("sf"), getText("lv"), getText("mhcars"))
renderFontDrawText(font,text,config.data.timer_pos.x,config.data.timer_pos.y,-1)
end
end
@ -114,6 +134,17 @@ end
config = {}
config.data = {}
config.default = {
font = {
name = "Segoe UI",
size = 10,
flag = 13,
color1 = "2f72f7",
color2 = "ffffff"
},
timer_pos = {
x = 150,
y = 300
},
time_2min = 0,
room = "all"
}
@ -199,6 +230,13 @@ function getSampRpServerName()
end
return result
end
function convertTableToString(table)
local result = ""
for i = 1, #table do
result = string.format("%s%s\n", result, table[i])
end
return result
end
-->> UPDATE MODULE
function openURL(url, fpath, message_off)

Loading…
Cancel
Save