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

Loading…
Cancel
Save