added log ffixcar

update
rubin 2 years ago
parent 944c2be930
commit 6644b2e4bb
  1. 81
      mafia-tools.lua

@ -21,16 +21,14 @@ function main()
lua_thread.create(ammo_timer.loop) lua_thread.create(ammo_timer.loop)
lua_thread.create(request.loop) lua_thread.create(request.loop)
lua_thread.create(menu.loop) lua_thread.create(menu.loop)
while true do wait(-1)
wait(0)
end
end end
-->> MENU DIALOG -->> MENU DIALOG
menu = {} menu = {}
menu.dialog = {} menu.dialog = {}
menu.data = {} menu.data = {}
menu.ffixcar_log = {}
menu.update = function() menu.update = function()
-->> Список блокировщика -->> Список блокировщика
@ -205,6 +203,14 @@ menu.update = function()
menu.show = { true, "main" } menu.show = { true, "main" }
end end
}, },
{ -->> Логи ffixcar
title = "{"..config.data.font.color1.."}"..">{ffffff} Логи /ffixcar\t",
click = function(button, list, input , outs)
if button ~= 1 then return end
wait(100)
menu.show = { true, "ffixcar_log" }
end
},
{ -->> Смена позиции { -->> Смена позиции
title = "{"..config.data.font.color1.."}"..">{ffffff} Сменить позицию\t", title = "{"..config.data.font.color1.."}"..">{ffffff} Сменить позицию\t",
click = function(button, list, input , outs) click = function(button, list, input , outs)
@ -234,7 +240,19 @@ menu.update = function()
["members_user"] = { ["members_user"] = {
settings = {title = "mafia-tools" ,style = 2 ,btn1 = "Выбрать" ,btn2 = "Назад" ,forward = "{ffffff}" ,backwards = "\n" ,score = true}, settings = {title = "mafia-tools" ,style = 2 ,btn1 = "Выбрать" ,btn2 = "Назад" ,forward = "{ffffff}" ,backwards = "\n" ,score = true},
menu.show[3] menu.show[3]
} },
["ffixcar_log"] = {
settings = {title = "mafia-tools" ,style = 0 ,btn1 = "Выбрать" ,btn2 = "Назад" ,forward = "{ffffff}" ,backwards = "\n" ,score = false},
{
text = menu.ffixcar_log,
{
click = function(button, list, input, outs)
menu.show = { true, "main" }
end
}
}
},
} }
end end
@ -338,6 +356,14 @@ request.handler = function(text)
end end
end end
ammo_timer.data = new_data ammo_timer.data = new_data
local text = ""
for i = 1, #info["ffixcar_log"] do
local data = info["ffixcar_log"][i]
if isPlayerInList(data["sender"]) then
text = string.format("%s[%s] %s\n", text, os.date("%X", data["time"]), data["text"])
end
end
menu.ffixcar_log = text
end end
return true return true
end end
@ -378,9 +404,10 @@ ammo_timer.onServerMessage = function(color, message)
end end
end --> by Richard_Holmes end --> by Richard_Holmes
if message:find(".+ заказал спавн транспорта через %d+ секунд%. С банка фракции снято %d+ вирт$") then if message:find(".+ заказал спавн транспорта через %d+ секунд%. С банка фракции снято %d+ вирт$") then
addChatMessage(message:match(" (%g+_%g+ заказал спавн транспорта через %d+ секунд%. С банка фракции снято %d+ вирт)$"))
request.send[#request.send + 1] = { request.send[#request.send + 1] = {
key = "ffixcar", key = "ffixcar",
text = "" text = message:match(" (%g+_%g+ заказал спавн транспорта через %d+ секунд%. С банка фракции снято %d+ вирт)$")
} }
request.wait = 0 request.wait = 0
end end
@ -586,28 +613,28 @@ function convertTableToString(table)
end end
return result return result
end end
function start_dialog(menu, put) -- module by trefa & modify (put & list in []) function start_dialog(_menu, put) -- module by trefa & modify (put & list in [])
function _dialog(menu, id, outs, put) function _dialog(_menu, id, outs, put)
sampShowDialog(id, menu.settings.title, tbl_split(menu.settings.style, menu, menu.settings.forward ,menu.settings.backwards ,menu.settings.score), menu.settings.btn1, (menu.settings.btn2 ~= nil and menu.settings.btn2 or _), menu.settings.style) sampShowDialog(id, _menu.settings.title, tbl_split(_menu.settings.style, _menu, _menu.settings.forward ,_menu.settings.backwards ,_menu.settings.score), _menu.settings.btn1, (_menu.settings.btn2 ~= nil and _menu.settings.btn2 or _), _menu.settings.style)
repeat repeat
wait(0) wait(0)
if put ~= nil and sampIsDialogActive() then if put ~= nil and sampIsDialogActive() then
sampSetCurrentDialogEditboxText(put) sampSetCurrentDialogEditboxText(put)
put = nil put = nil
end end
local result, button, list, input = sampHasDialogRespond(id) local result, button, list, input = sampHasDialogRespond(id)
if result then if result then
local out, outs = menu[((menu.settings.style == 0 or menu.settings.style == 1 or menu.settings.style == 3) and 1 or ((list + 1) > #menu[1] and 2 or 1))][((menu.settings.style == 0 or menu.settings.style == 1 or menu.settings.style == 3) and 1 or ((list + 1) > #menu[1] and (list - #menu[1]) + 1 or list + 1))].click(button, list, input, outs) local out, outs = _menu[((_menu.settings.style == 0 or _menu.settings.style == 1 or _menu.settings.style == 3) and 1 or ((list + 1) > #_menu[1] and 2 or 1))][((_menu.settings.style == 0 or _menu.settings.style == 1 or _menu.settings.style == 3) and 1 or ((list + 1) > #_menu[1] and (list - #_menu[1]) + 1 or list + 1))].click(button, list, input, outs)
if type(out) == "table" then if type(out) == "table" then
return _dialog(out, id - 1, outs, put) return _dialog(out, id - 1, outs, put)
elseif type(out) == "boolean" then elseif type(out) == "boolean" then
if not out then if not out then
return out return out
end
return _dialog(menu, id, outs, put)
end end
return _dialog(_menu, id, outs, put)
end end
until result end
until result or menu.show[1]
end end
function tbl_split(style, tbl, forward ,backwards ,score) function tbl_split(style, tbl, forward ,backwards ,score)
@ -626,7 +653,7 @@ function start_dialog(menu, put) -- module by trefa & modify (put & list in [])
return tbl[1].text return tbl[1].text
end end
return _dialog(menu, 1337, outs, put) return _dialog(_menu, 1337, outs, put)
end end
function getNicknamesOnline() function getNicknamesOnline()
local result = {} local result = {}

Loading…
Cancel
Save