fixed bugs & bump version

master
rubin 2 weeks ago
parent 18f4cd613c
commit 9eb4399b17
  1. 5
      changelog
  2. 72
      mafia-tools.lua
  3. 2
      version

@ -37,4 +37,7 @@
Версия от 20.07.2023 Версия от 20.07.2023
Добавлена поддержка сервера Underground Добавлена поддержка сервера Underground
Версия от 05.07.2025 Версия от 05.07.2025
Фикс флуда перегона Фикс флуда перегона
Версия от 28.11.2025
Фикс не выключался флуд перегона
Фикс не сохранялись после релога armoff id

@ -1,6 +1,6 @@
script_name('mafia-tools') script_name('mafia-tools')
script_author("Serhiy_Rubin") script_author("Serhiy_Rubin")
script_version("05.07.2025") script_version("28.11.2025")
sampev = require 'samp.events' sampev = require 'samp.events'
inicfg = require "inicfg" inicfg = require "inicfg"
@ -1078,43 +1078,45 @@ end
mhcars = {} mhcars = {}
mhcars.time = 0 mhcars.time = 0
mhcars.onServerMessage = function(color, message) mhcars.onServerMessage = function(color, message)
if message == " Вы не являетесь лидером/замом мафии" or if config.data.mhcars.auto then
message == " Ожидайте принятия задания" or if message == " Вы не являетесь лидером/замом мафии" or
message == " Задание уже начато" or message == " Ожидайте принятия задания" or
message:find("Перегон был инициирован мафией ") then message == " Задание уже начато" or
mhcars.time = os.time() + 1800 message:find("Перегон был инициирован мафией ") then
end mhcars.time = os.time() + 1800
if message == " Задание по перегону машин завершено" then end
mhcars.time = 0 if message == " Задание по перегону машин завершено" then
end mhcars.time = 0
if message:find("^ Задание будет доступно через: ") then end
local p1, p2, p3 = string.match(message, "Задание будет доступно через: (%d+):(%d+):(%d+)") if message:find("^ Задание будет доступно через: ") then
if(p3 == nil)then local p1, p2, p3 = string.match(message, "Задание будет доступно через: (%d+):(%d+):(%d+)")
p1, p2 = string.match(message, "Задание будет доступно через: (%d+):(%d+)") if(p3 == nil)then
end p1, p2 = string.match(message, "Задание будет доступно через: (%d+):(%d+)")
if(p1 ~= nil and p2 ~= nil)then
local mhTimer = 0
if(p3 ~= nil)then
mhTimer = tonumber(p1) * 3600
mhTimer = mhTimer + (tonumber(p2) * 60)
mhTimer = mhTimer + tonumber(p3)
else
mhTimer = mhTimer + (tonumber(p1) * 60)
mhTimer = mhTimer + tonumber(p2)
end end
mhcars.time = os.time() + mhTimer - config.data.mhcars.offset_wait if(p1 ~= nil and p2 ~= nil)then
request.send[#request.send + 1] = { local mhTimer = 0
key = "mhcars", if(p3 ~= nil)then
second = mhTimer mhTimer = tonumber(p1) * 3600
} mhTimer = mhTimer + (tonumber(p2) * 60)
request.wait = 0 mhTimer = mhTimer + tonumber(p3)
end else
end --> by Richard_Holmes mhTimer = mhTimer + (tonumber(p1) * 60)
mhTimer = mhTimer + tonumber(p2)
end
mhcars.time = os.time() + mhTimer - config.data.mhcars.offset_wait
request.send[#request.send + 1] = {
key = "mhcars",
second = mhTimer
}
request.wait = 0
end
end --> by Richard_Holmes
end
end end
mhcars.loop = function() mhcars.loop = function()
while true do while true do
wait(0) wait(0)
if sampIsLocalPlayerSpawned() and isPlayerInMafia() and config.data.stats.rank >= 9 then if sampIsLocalPlayerSpawned() and isPlayerInMafia() and config.data.mhcars.auto and config.data.stats.rank >= 9 then
if mhcars.time == 0 then if mhcars.time == 0 then
if mhcars.antiflood == nil or os.time() - mhcars.antiflood > 1 then if mhcars.antiflood == nil or os.time() - mhcars.antiflood > 1 then
mhcars.antiflood = os.time() mhcars.antiflood = os.time()
@ -1936,11 +1938,11 @@ config.init = function()
config.save(config.default) config.save(config.default)
end end
config.read() config.read()
for k,v in pairs(config.default) do for k,v in pairs(config.default) doА
if config.data[k] == nil then if config.data[k] == nil then
config.data[k] = v config.data[k] = v
end end
if type(v) == "table" then if type(v) == "table" and k ~= "armoff" then
for kk,vv in pairs(v) do for kk,vv in pairs(v) do
if config.data[k][kk] == nil then if config.data[k][kk] == nil then
config.data[k][kk] = vv config.data[k][kk] = vv

@ -1 +1 @@
05.07.2025 28.11.2025
Loading…
Cancel
Save