|
|
|
@ -121,6 +121,44 @@ menu.update = function() |
|
|
|
|
} |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
-->> Список слов для открытия склада |
|
|
|
|
local warelock_text = {} |
|
|
|
|
warelock_text[#warelock_text+1] = { |
|
|
|
|
title = ">> Добавить строку", |
|
|
|
|
click = function(button, list, input, outs) |
|
|
|
|
if button == 1 then |
|
|
|
|
menu.show = { true, "edit", function(button, list, input, outs) |
|
|
|
|
if button == 1 then |
|
|
|
|
if #input > 0 then |
|
|
|
|
local arr = split(input, " ") |
|
|
|
|
if arr[1] ~= nil then |
|
|
|
|
config.data.get_guns.warelock_text[#config.data.get_guns.warelock_text+1] = arr[1] |
|
|
|
|
config.save(config.data) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
menu.show = { true, "warelock_auto" } |
|
|
|
|
end, "", "Введите слово для открытия склада!"} |
|
|
|
|
else |
|
|
|
|
menu.show = { true, "main" } |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
} |
|
|
|
|
for i = 1, #config.data.get_guns.warelock_text do |
|
|
|
|
warelock_text[#warelock_text+1] = { |
|
|
|
|
title = config.data.get_guns.warelock_text[i], |
|
|
|
|
click = function(button, list, input, outs) |
|
|
|
|
if button == 1 then |
|
|
|
|
table.remove(config.data.get_guns.warelock_text, i) |
|
|
|
|
config.save(config.data) |
|
|
|
|
menu.show = { true, "warelock_auto" } |
|
|
|
|
else |
|
|
|
|
menu.show = { true, "main" } |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
} |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
menu.dialog = { |
|
|
|
|
["main"] = { |
|
|
|
|
settings = {title = "mafia-tools" ,style = 4 ,btn1 = "Выбрать" ,btn2 = "Закрыть" ,forward = "{ffffff}" ,backwards = "\n" ,score = false}, |
|
|
|
@ -366,13 +404,60 @@ menu.update = function() |
|
|
|
|
menu.show = { true, "main" } |
|
|
|
|
end |
|
|
|
|
}, |
|
|
|
|
{ -->> Открывать склад по запросу в рацию |
|
|
|
|
title = "{"..config.data.font.color1.."}"..">{ffffff} Открывать склад по запросу\t"..(config.data.get_guns.warelock_auto and "вкл" or "выкл"), |
|
|
|
|
click = function(button, list, input , outs) |
|
|
|
|
if button ~= 1 then return end |
|
|
|
|
config.data.get_guns.warelock_auto = not config.data.get_guns.warelock_auto |
|
|
|
|
config.save(config.data) |
|
|
|
|
menu.show = { true, "main" } |
|
|
|
|
end |
|
|
|
|
}, |
|
|
|
|
{ -->> Брать оружие сразу как откроют склад |
|
|
|
|
title = "{"..config.data.font.color1.."}"..">{ffffff} Брать оружие сразу как откроют склад\t"..(config.data.get_guns.auto_get_guns and "вкл" or "выкл"), |
|
|
|
|
click = function(button, list, input , outs) |
|
|
|
|
if button ~= 1 then return end |
|
|
|
|
config.data.get_guns.auto_get_guns = not config.data.get_guns.auto_get_guns |
|
|
|
|
config.save(config.data) |
|
|
|
|
menu.show = { true, "main" } |
|
|
|
|
end |
|
|
|
|
}, |
|
|
|
|
{ -->> Клавиша взятия ганов |
|
|
|
|
title = "{"..config.data.font.color1.."}"..">{ffffff} Брать оружие по кнопке\t"..config.data.get_guns.key:gsub("VK_", ""), |
|
|
|
|
click = function(button, list, input , outs) |
|
|
|
|
if button ~= 1 then return end |
|
|
|
|
wait(100) |
|
|
|
|
local key = "" |
|
|
|
|
repeat |
|
|
|
|
wait(0) |
|
|
|
|
if not sampIsDialogActive() then |
|
|
|
|
sampShowDialog(222, "Смена активации", "Нажмите на любую клавишу", "Выбрать", "Закрыть", 0) |
|
|
|
|
end |
|
|
|
|
for k, v in pairs(vkeys) do |
|
|
|
|
if wasKeyPressed(v) and k ~= "VK_ESCAPE" and k ~= "VK_RETURN" then |
|
|
|
|
key = k |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
until key ~= "" |
|
|
|
|
config.data.get_guns.key = key |
|
|
|
|
config.save(config.data) |
|
|
|
|
menu.show = { true, "main" } |
|
|
|
|
end |
|
|
|
|
}, |
|
|
|
|
{ -->> Список слов для запросов |
|
|
|
|
title = "{"..config.data.font.color1.."}"..">{ffffff} Список запросов на открытие склада\t", |
|
|
|
|
click = function(button, list, input , outs) |
|
|
|
|
if button ~= 1 then return end |
|
|
|
|
menu.show = { true, "warelock_auto" } |
|
|
|
|
end |
|
|
|
|
}, |
|
|
|
|
{ -->> Список оружия |
|
|
|
|
title = "{"..config.data.font.color1.."}"..">{ffffff} Список оружия\t", |
|
|
|
|
click = function(button, list, input , outs) |
|
|
|
|
if button ~= 1 then return end |
|
|
|
|
menu.show = { true, "get_guns" } |
|
|
|
|
end |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
["edit"] = { |
|
|
|
@ -508,6 +593,10 @@ menu.update = function() |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
["warelock_auto"] = { |
|
|
|
|
settings = {title = "mafia-tools" ,style = 2 ,btn1 = "Выбрать" ,btn2 = "Назад" ,forward = "{ffffff}" ,backwards = "\n" ,score = false}, |
|
|
|
|
warelock_text |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
end |
|
|
|
|
menu.show = { false, "main" } |
|
|
|
@ -550,26 +639,49 @@ get_guns.isCanOpen = false |
|
|
|
|
get_guns.onServerMessage = function(color, message) |
|
|
|
|
if message == "{FFFFFF} Вы можете использовать {00AB06}/getgun [ID игрока]{FFFFFF}, чтобы выдать оружие другим членам организации" then |
|
|
|
|
if get_guns.getgun then |
|
|
|
|
get_guns.stop = os.time() |
|
|
|
|
return true, false |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
if message == " Вы не на складе оружия своей организации / у вас нет доступа!" or message == " Склад закрыт" then |
|
|
|
|
if get_guns.getgun then |
|
|
|
|
get_guns.stop = os.time() |
|
|
|
|
get_guns.getgun = false |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
if message:find("^ Склад .+ %{C42100%}закрыт") or message == " Склад закрыт" then |
|
|
|
|
get_guns.warehouse = false |
|
|
|
|
if not get_guns.check_warehouse then |
|
|
|
|
get_guns.check_warehouse = true |
|
|
|
|
get_guns.check_warehouse_time = os.time() |
|
|
|
|
return true, false |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
if message:find("^ Склад .+ %{00AB06%}открыт") or message == " Склад открыт" then |
|
|
|
|
get_guns.warehouse = true |
|
|
|
|
if not get_guns.check_warehouse then |
|
|
|
|
get_guns.check_warehouse = true |
|
|
|
|
get_guns.check_warehouse_time = os.time() |
|
|
|
|
return true, false |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
if message:find("^ .+%[%d+%]: (.+)") then |
|
|
|
|
if config.data.stats.rank >= 8 then |
|
|
|
|
|
|
|
|
|
if message == " Вам недоступна эта функция" then |
|
|
|
|
if not get_guns.check_warehouse then |
|
|
|
|
get_guns.check_warehouse = true |
|
|
|
|
get_guns.check_warehouse_time = os.time() |
|
|
|
|
return true, false |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
if message:find("^ %d+/%d+ Матов | %d+/%d+ Аптечек") and os.time() - get_guns.check_warehouse_time < 2 then |
|
|
|
|
return true, false |
|
|
|
|
end |
|
|
|
|
if message:find("^ .+%[%d+%]: (.+)") then |
|
|
|
|
get_guns.messages[#get_guns.messages+1] = message:match("^ .+%[%d+%]: (.+)") |
|
|
|
|
end |
|
|
|
|
if config.data.get_guns.auto_get_guns and message:find("^ .+ открыл%(а%) склад с оружием$") and not message:find(getLocalPlayerNickname()) then |
|
|
|
|
get_guns.start_get() |
|
|
|
|
end |
|
|
|
|
if message == " Броня уже 100%" and get_guns.getgun then |
|
|
|
|
antiflood.send[#antiflood.send+1] = "/getgun" |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
get_guns.enter_textdrawId = -1 |
|
|
|
|
get_guns.enter_textdraw = false |
|
|
|
@ -611,15 +723,28 @@ get_guns.onShowDialog = function(id, style, title, button1, button2, text) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
get_guns.weapon = {} |
|
|
|
|
get_guns.onSendWeaponsUpdate = function(playerTarget, actorTarget, weapons) -- ганы при использовании |
|
|
|
|
for i = 1, #weapons do |
|
|
|
|
get_guns.weapon[weapons[i]["slot"]] = weapons[i]["ammo"] |
|
|
|
|
if weapons[i]["ammo"] == 0 then |
|
|
|
|
table.remove(get_guns.weapon, weapons[i]["slot"]) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
get_guns.onResetPlayerWeapons = function() |
|
|
|
|
get_guns.weapon = {} |
|
|
|
|
end |
|
|
|
|
get_guns.loop = function() |
|
|
|
|
get_guns.antiflood = 0 |
|
|
|
|
get_guns.check_stats = false |
|
|
|
|
get_guns.check_warehouse = false |
|
|
|
|
get_guns.check_warehouse_time = 0 |
|
|
|
|
get_guns.warehouse = false |
|
|
|
|
|
|
|
|
|
get_guns.getgun = false |
|
|
|
|
get_guns.stop = 0 |
|
|
|
|
get_guns.list = {} |
|
|
|
|
get_guns.messages = {} |
|
|
|
|
get_guns.warelock_send = {} |
|
|
|
|
while true do |
|
|
|
|
wait(0) |
|
|
|
|
if not get_guns.check_stats then |
|
|
|
@ -635,9 +760,39 @@ get_guns.loop = function() |
|
|
|
|
end |
|
|
|
|
if get_guns.enter_textdraw and isKeyCanBePressed() and wasKeyPressed(vkeys[config.data.get_guns.key]) and not get_guns.getgun then |
|
|
|
|
get_guns.start_get() |
|
|
|
|
else |
|
|
|
|
if wasKeyPressed(vkeys[config.data.get_guns.key]) and get_guns.getgun then |
|
|
|
|
addChatMessage("Выполняется взятие ганов") |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
if get_guns.getgun and get_guns.stop ~= 0 and os.time() - get_guns.stop > 1 then |
|
|
|
|
get_guns.getgun = false |
|
|
|
|
if #get_guns.messages > 0 then |
|
|
|
|
if config.data.get_guns.warelock_auto and not get_guns.warehouse and config.data.stats.rank >= 8 then |
|
|
|
|
local result = false |
|
|
|
|
local text = split(get_guns.messages[1], " ") |
|
|
|
|
for i = 1, #config.data.get_guns.warelock_text do |
|
|
|
|
for p = 1, #text do |
|
|
|
|
if text[p] == config.data.get_guns.warelock_text[i] then |
|
|
|
|
result = true |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
if result then |
|
|
|
|
local rand = math.random(1, 5) |
|
|
|
|
get_guns.warelock_send = { |
|
|
|
|
{ os.time() + rand, false }, |
|
|
|
|
{ os.time() + config.data.get_guns.warelock_time + rand, true } |
|
|
|
|
} |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
table.remove(get_guns.messages, 1) |
|
|
|
|
end |
|
|
|
|
if #get_guns.warelock_send > 0 then |
|
|
|
|
if get_guns.warelock_send[1][1] < os.time() then |
|
|
|
|
if get_guns.warelock_send[1][2] == get_guns.warehouse then |
|
|
|
|
antiflood.send[#antiflood.send+1] = "/warelock" |
|
|
|
|
end |
|
|
|
|
table.remove(get_guns.warelock_send, 1) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
@ -645,17 +800,19 @@ get_guns.start_get = function() |
|
|
|
|
get_guns.list = {} |
|
|
|
|
for i = 1, #config.data.get_guns.list do |
|
|
|
|
if config.data.get_guns.list[i][2] > 0 then |
|
|
|
|
for n = 1, config.data.get_guns.list[i][2] do |
|
|
|
|
get_guns.list[#get_guns.list+1] = i - 1 |
|
|
|
|
if get_guns.weapon[config.data.get_guns.list[i][3]] == nil or get_guns.weapon[config.data.get_guns.list[i][3]] < (config.data.get_guns.list[i][4] * config.data.get_guns.list[i][2]) then |
|
|
|
|
for n = 1, config.data.get_guns.list[i][2] do |
|
|
|
|
get_guns.list[#get_guns.list+1] = i - 1 |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
get_guns.getgun = true |
|
|
|
|
get_guns.stop = 0 |
|
|
|
|
antiflood.send[#antiflood.send+1] = "/getgun" |
|
|
|
|
end |
|
|
|
|
get_guns.check_warelock = function() |
|
|
|
|
|
|
|
|
|
if #get_guns.list > 0 then |
|
|
|
|
get_guns.getgun = true |
|
|
|
|
antiflood.send[#antiflood.send+1] = "/getgun" |
|
|
|
|
else |
|
|
|
|
addChatMessage("У Вас достаточно оружия!") |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1051,13 +1208,13 @@ config.default = { |
|
|
|
|
}, |
|
|
|
|
get_guns = { |
|
|
|
|
list = { |
|
|
|
|
{ "Desert Eagle", 0 }, |
|
|
|
|
{ "Shotgun", 0 }, |
|
|
|
|
{ "SMG", 0 }, |
|
|
|
|
{ "AK47", 0 }, |
|
|
|
|
{ "M4A1", 0 }, |
|
|
|
|
{ "Rifle", 0 }, |
|
|
|
|
{ "Броня", 0 } |
|
|
|
|
{ "Desert Eagle", 0, 2, 14 }, |
|
|
|
|
{ "Shotgun", 0, 3, 10 }, |
|
|
|
|
{ "SMG", 0, 4, 60 }, |
|
|
|
|
{ "AK47", 0, 5, 60 }, |
|
|
|
|
{ "M4A1", 0, 5, 100 }, |
|
|
|
|
{ "Rifle", 0, 6, 10 }, |
|
|
|
|
{ "Броня", 0, 777, 10 } |
|
|
|
|
}, |
|
|
|
|
key = "VK_G", |
|
|
|
|
auto_get_guns = false, |
|
|
|
@ -1071,6 +1228,10 @@ config.default = { |
|
|
|
|
stats = { |
|
|
|
|
frac = "", |
|
|
|
|
rank = 0 |
|
|
|
|
}, |
|
|
|
|
war = { |
|
|
|
|
armoff = true, |
|
|
|
|
armoff_id = { 0, 1, 4 } |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
config.directory = string.format("%s\\moonloader\\config\\%s\\", getGameDirectory(), thisScript().name) |
|
|
|
@ -1196,6 +1357,12 @@ end |
|
|
|
|
function sampev.onTextDrawHide(id) |
|
|
|
|
get_guns.onTextDrawHide(id) |
|
|
|
|
end |
|
|
|
|
function sampev.onSendWeaponsUpdate(playerTarget, actorTarget, weapons) |
|
|
|
|
get_guns.onSendWeaponsUpdate(playerTarget, actorTarget, weapons) |
|
|
|
|
end |
|
|
|
|
function sampev.onResetPlayerWeapons() |
|
|
|
|
get_guns.onResetPlayerWeapons() |
|
|
|
|
end |
|
|
|
|
-->> NEW FUNCTION |
|
|
|
|
function getLocalPlayerNickname() |
|
|
|
|
return sampGetPlayerNickname(select(2, sampGetPlayerIdByCharHandle(PLAYER_PED))) |
|
|
|
@ -1320,6 +1487,15 @@ function isKeyCanBePressed() |
|
|
|
|
end |
|
|
|
|
return true |
|
|
|
|
end |
|
|
|
|
function split(str, delim, plain) |
|
|
|
|
local tokens, pos, plain = {}, 1, not (plain == false) --[[ delimiter is plain text by default ]] |
|
|
|
|
repeat |
|
|
|
|
local npos, epos = string.find(str, delim, pos, plain) |
|
|
|
|
table.insert(tokens, string.sub(str, pos, npos and npos - 1)) |
|
|
|
|
pos = epos and epos + 1 |
|
|
|
|
until not pos |
|
|
|
|
return tokens |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
-->> UPDATE MODULE |
|
|
|
|
function openURL(url, fpath, message_off) |
|
|
|
|