added key invite

update
rubin 2 years ago
parent 75ca827d4c
commit cb4d651fe4
  1. 93
      mafia-tools.lua

@ -5,6 +5,7 @@ script_version("05.02.2023.2")
sampev = require 'samp.events'
inicfg = require "inicfg"
dlstatus = require("moonloader").download_status
vkeys = require "vkeys"
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
@ -23,6 +24,7 @@ function main()
lua_thread.create(menu.loop)
lua_thread.create(mafia_checker.loop)
lua_thread.create(antiflood.loop)
lua_thread.create(invite_helper.loop)
wait(-1)
end
@ -170,7 +172,14 @@ menu.update = function()
config.save(config.data)
menu.show = { true, "main" }
end
},
},
{ -->> Разделитель
title = " \t ",
click = function(button, list, input , outs)
if button ~= 1 then return end
menu.show = { true, "main" }
end
},
{ -->> Настройки отображения
title = "{"..config.data.font.color1.."}".."Настройки отображения\t",
click = function(button, list, input , outs)
@ -221,7 +230,14 @@ menu.update = function()
ammo_timer.setpos = true
menu.show = { true, "main" }
end
},
},
{ -->> Разделитель
title = " \t ",
click = function(button, list, input , outs)
if button ~= 1 then return end
menu.show = { true, "main" }
end
},
{ -->> Mafia Checker
title = "{"..config.data.font.color1.."}".."Счетчик мафий на сервере и в стриме\t",
click = function(button, list, input , outs)
@ -246,7 +262,14 @@ menu.update = function()
mafia_checker.setpos = true
menu.show = { true, "main" }
end
},
},
{ -->> Разделитель
title = " \t ",
click = function(button, list, input , outs)
if button ~= 1 then return end
menu.show = { true, "main" }
end
},
{ -->> Invite Helper
title = "{"..config.data.font.color1.."}".."Инвайт хелпер\t",
click = function(button, list, input , outs)
@ -279,19 +302,41 @@ menu.update = function()
end
},
{ -->> Ранг по умолчанию
title = "{"..config.data.font.color1.."}"..">{ffffff} Установить ранг\t"..config.data.invite_helper.rank,
click = function(button, list, input , outs)
if button ~= 1 then return end
menu.show = { true, "edit", function(button, list, input, outs)
if button == 1 then
if #input > 0 and input:find("(%d+)") then
config.data.invite_helper.rank = tonumber(input:match("(%d+)"))
config.save(config.data)
title = "{"..config.data.font.color1.."}"..">{ffffff} Установить ранг\t"..config.data.invite_helper.rank,
click = function(button, list, input , outs)
if button ~= 1 then return end
menu.show = { true, "edit", function(button, list, input, outs)
if button == 1 then
if #input > 0 and input:find("(%d+)") then
config.data.invite_helper.rank = tonumber(input:match("(%d+)"))
config.save(config.data)
end
end
end
menu.show = { true, "main" }
end, config.data.invite_helper.rank}
end
menu.show = { true, "main" }
end, config.data.invite_helper.rank}
end
},
{ -->> Клавиша инвайта
title = "{"..config.data.font.color1.."}"..">{ffffff} Инвайт по кнопке\tПрицел + "..config.data.invite_helper.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.invite_helper.key = key
config.save(config.data)
menu.show = { true, "main" }
end
},
}
},
@ -326,7 +371,6 @@ menu.update = function()
}
},
}
end
menu.show = { false, "main" }
@ -355,6 +399,7 @@ menu.loop = function()
menu.show[1] = false
menu.update()
if menu.dialog[menu.show[2]] ~= nil then
wait(100)
start_dialog(menu.dialog[menu.show[2]], menu.show[4])
end
end
@ -365,8 +410,8 @@ end
invite_helper = {}
invite_helper.data = {}
invite_helper.onServerMessage = function(color, message)
if message:find("$ Вы приняли .+ в ") then
local name = message:match("$ Вы приняли (.+) в ")
if message:find("^ Вы приняли .+ в ") then
local name = message:match("^ Вы приняли (.+) в ")
if invite_helper.data[name] ~= nil then
antiflood.send[#antiflood.send+1] = invite_helper.data[name]
invite_helper.data[name] = nil
@ -399,6 +444,18 @@ invite_helper.onSendCommand = function(cmd)
end
end
end
invite_helper.loop = function()
while true do
wait(0)
local result, ped = getCharPlayerIsTargeting(PLAYER_HANDLE)
if result then
local result, id = sampGetPlayerIdByCharHandle(ped)
if result and wasKeyPressed(vkeys[config.data.invite_helper.key]) then
antiflood.send[#antiflood.send+1] = "/invite "..id
end
end
end
end
-->> ANTIFLOOD
antiflood = {}

Loading…
Cancel
Save