added auto mafiawar

update
rubin 2 years ago
parent 5ea9e874cc
commit 07b470a323
  1. 35
      mafia-tools.lua

@ -674,6 +674,22 @@ mafiawar.onServerMessage = function(color, message)
}
mafiawar.time = os.time(datetime)
end
if message == " Вы далеко от бизнеса" then
if mafiawar.biz then
mafiawar.biz = false
mafiawar.time = 0
msg.add("Если не каптит - нужно отойти от 3D текста бизнеса и подойти снова")
end
end
if message:find("^ Война за бизнес %{6AB1FF%}.+ %{FFFFFF%}пройдет в %{6AB1FF%}.+ %{FFFFFF%}| ID: {6AB1FF}%d+$") or
message == " Ваша мафия уже участвует в войне" or
message == " Эта мафия уже начала войну за бизнес" or
message == " Этот бизнес под контролем вашей мафии" then
if mafiawar.biz then
mafiawar.biz = false
mafiawar.time = 0
end
end
end
mafiawar.onCreate3DText = function(id, color, position, distance, testLOS, attachedPlayerId, attachedVehicleId, text)
if text:find("Владелец") then
@ -690,7 +706,19 @@ end
mafiawar.loop = function()
while true do
wait(0)
if mafiawar.biz and mafiawar.time
if config.data.mafiawar.auto and mafiawar.biz then
if mafiawar.time == 0 then
if mafiawar.antiflood == nil or os.time() - mafiawar.antiflood > 1 then
mafiawar.antiflood = os.time()
antiflood.send[#antiflood.send+1] = "/mafiawar "..config.data.mafiawar.id
end
end
if mafiawar.time ~= 0 and os.time() < mafiawar.time then
if antiflood.get() > config.data.mafiawar.wait then
sampSendChat("/mafiawar "..config.data.mafiawar.id)
end
end
end
end
end
@ -1320,7 +1348,9 @@ config.default = {
armoff_id = { 0, 1, 4 }
},
mafiawar = {
auto = true
auto = true,
id = 0,
wait = 600
}
}
config.directory = string.format("%s\\moonloader\\config\\%s\\", getGameDirectory(), thisScript().name)
@ -1399,6 +1429,7 @@ function processEvent(func, args)
end
end -- by QRLK (edith.lua)
function sampev.onServerMessage(color, message)
mafiawar.onServerMessage(color, message)
if os.time() - live < 3 then
timer_2min.onServerMessage(color, message)
ammo_timer.onServerMessage(color, message)

Loading…
Cancel
Save