diff --git a/mafia-tools.lua b/mafia-tools.lua index 4627e9b..325a97d 100644 --- a/mafia-tools.lua +++ b/mafia-tools.lua @@ -32,6 +32,7 @@ function main() lua_thread.create(mhcars.loop) lua_thread.create(healme.loop) lua_thread.create(armoff.loop) + lua_thread.create(clistoff.loop) sampRegisterChatCommand("int",function() local int = getActiveInterior() @@ -784,6 +785,36 @@ menu.loop = function() end end +-- CLISTOFF +clistoff = {} +clistoff.onServerMessage = function(color, message) + if message == " (( Чтобы посмотреть правила проведения войны за бизнес введите /mrules ))" then + clistoff.war = true + end + if message == " (( /captstats - подробная статистика ))" then + clistoff.wait = os.time() + clistoff.war = false + clistoff.start = true + end +end +clistoff.loop = function() + clistoff.war = false + clistoff.start = true + clistoff.wait = 0 + while true do + wait(0) + if not clistoff.war and clistoff.start and os.time() - clistoff.wait > 3 then + local id = getLocalPlayerId() + local color = sampGetPlayerColor(id) + if color ~= 16777215 then + antiflood.add("/clist 0") + end + clistoff.start = false + clistoff.wait = os.time() + end + end +end + -- ARMOFF armoff = {} armoff.onServerMessage = function(color, message) @@ -833,7 +864,6 @@ armoff.check = function() return result end - -- HEALME healme = {} healme.old_interior = -1 @@ -995,7 +1025,6 @@ mafiawar.onServerMessage = function(color, message) 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 @@ -1750,7 +1779,8 @@ config.default = { wait = 200, offset_wait = 1 }, - healme = true + healme = true, + clistoff = true } config.directory = string.format("%s\\moonloader\\config\\%s\\", getGameDirectory(), thisScript().name) config.init = function() @@ -1913,6 +1943,9 @@ end function getLocalPlayerNickname() return sampGetPlayerNickname(select(2, sampGetPlayerIdByCharHandle(PLAYER_PED))) end +function getLocalPlayerId() + return select(2, sampGetPlayerIdByCharHandle(PLAYER_PED)) +end function getServerAddress() local ip, port = sampGetCurrentServerAddress() return string.format("%s:%s", ip, port)