Compare commits

...

21 Commits

  1. 7
      README.md
  2. 7
      changelog
  3. 824
      mafia-tools.lua
  4. BIN
      pictures/menu1.png
  5. BIN
      pictures/menu2.png
  6. 2
      version

@ -12,8 +12,13 @@
- Система комнат для синхронизации времени ограбления АММО, перегона, ffixcar
- Логи ffixcar
- Чекер мафий по клистам и скинам
- Инвайт хелпер с автоматической выдачей ранга
- Можно указать оружие для автоматического взятия со склада
- Берет оружие как только откроют склад / по нажатию на кнопку
- Открывает склад по запросу в рацию
![menu](pictures/menu.png)
![menu](pictures/menu1.png)
![menu](pictures/menu2.png)
# **Прочее**
- Скрипт в разработке и будет дополняться

@ -20,3 +20,10 @@
Добавлен чекер мафии по клистам и по скинам
Версия от 05.02.2023
Добавлен чат для тестеров /maf [text]
Версия от 09.02.2023
Добавлен инвайт хелпер (Учитывает ЛВЛ и выдает ранг)
Добавлен список ганов которые должен брать скрипт
Скрипт не берет повторно, добирает если не хватает по патронам (не учитывается х2)
Добавлено автоматическое открытие склада по запросу в райцию
Добавлено автоматическое взятие ганов как откроют склад
Добавлено взятие ганов по кнопке (Откроет склад если вы 8+)

@ -1,10 +1,12 @@
script_name('mafia-tools')
script_author("Serhiy_Rubin")
script_version("05.02.2023.2")
script_version("09.02.2023")
sampev = require 'samp.events'
inicfg = require "inicfg"
dlstatus = require("moonloader").download_status
vkeys = require "vkeys"
live = 0
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
@ -22,7 +24,15 @@ function main()
lua_thread.create(request.loop)
lua_thread.create(menu.loop)
lua_thread.create(mafia_checker.loop)
wait(-1)
lua_thread.create(antiflood.loop)
lua_thread.create(invite_helper.loop)
lua_thread.create(get_guns.loop)
lua_thread.create(updateScoresAndPing)
while true do
wait(0)
live = os.time()
msg.loop()
end
end
-->> MENU DIALOG
@ -117,6 +127,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},
@ -140,7 +188,7 @@ menu.update = function()
end
end
menu.show = { true, "main" }
end, config.data.room}
end, config.data.room, "Введите название комнаты!"}
end
},
{ -->> Участники
@ -170,6 +218,13 @@ menu.update = function()
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,6 +276,13 @@ menu.update = function()
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,12 +308,185 @@ menu.update = function()
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)
if button ~= 1 then return end
menu.show = { true, "main" }
end
},
{ -->> Минимальный лвл
title = "{"..config.data.font.color1.."}"..">{ffffff} Минимальный уровень\t"..config.data.invite_helper.lvl,
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.lvl = tonumber(input:match("(%d+)"))
config.save(config.data)
end
end
menu.show = { true, "main" }
end, config.data.invite_helper.lvl, "Введите минимальный уровень для инвайта!"}
end
},
{ -->> Авто ранг вкл выкл
title = "{"..config.data.font.color1.."}"..">{ffffff} Устанавливать ранг автоматически\t"..(config.data.invite_helper.auto_rank and "вкл" or "выкл"),
click = function(button, list, input , outs)
if button ~= 1 then return end
config.data.invite_helper.auto_rank = not config.data.invite_helper.auto_rank
config.save(config.data)
menu.show = { true, "main" }
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)
end
end
menu.show = { true, "main" }
end, config.data.invite_helper.rank, "Введите какой ранг давать после инвайта!"}
end
},
{ -->> Сообщение в чат после инвайта
title = "{"..config.data.font.color1.."}"..">{ffffff} Сообщение в рацию\t"..config.data.invite_helper.message,
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
config.data.invite_helper.message = input
config.save(config.data)
end
menu.show = { true, "main" }
end, config.data.invite_helper.message, "{name} - Заменится на никнейм игрока которого приняли\nЧтобы не отправлять сообщение оставьте поле пустым!"}
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
},
{ -->> Разделитель
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)
if button ~= 1 then return end
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.warelock_time.." сек",
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
if tonumber(input:match("(%d+)")) > 0 then
config.data.get_guns.warelock_time = tonumber(input:match("(%d+)"))
config.save(config.data)
end
end
end
menu.show = { true, "main" }
end, config.data.get_guns.warelock_time, "Введите сколько секунд склад держать открытым"}
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"] = {
settings = {title = "mafia-tools" ,style = 1 ,btn1 = "Выбрать" ,btn2 = "Назад" ,forward = "{ffffff}" ,backwards = "\n" ,score = true},
{
text = "",
text = menu.show[5],
{
click = function(button, list, input, outs)
menu.show[3](button, list, input, outs)
@ -278,8 +513,113 @@ menu.update = function()
}
}
},
["get_guns"] = {
settings = {title = "mafia-tools" ,style = 4 ,btn1 = "Выбрать" ,btn2 = "Назад" ,forward = "{ffffff}" ,backwards = "\n" ,score = true},
{
{ -->> Desert Eagle
title = "Desert Eagle\t"..config.data.get_guns.list[1][2],
click = function(button, list, input, outs)
if button ~= 1 then
menu.show = { true, "main" }
return
end
config.data.get_guns.list[1][2] = config.data.get_guns.list[1][2] + 1
config.save(config.data)
menu.show[1] = true
end
},
{ -->> Shotgun
title = "Shotgun\t"..config.data.get_guns.list[2][2],
click = function(button, list, input, outs)
if button ~= 1 then
menu.show = { true, "main" }
return
end
config.data.get_guns.list[2][2] = config.data.get_guns.list[2][2] + 1
config.save(config.data)
menu.show[1] = true
end
},
{ -->> SMG
title = "SMG\t"..config.data.get_guns.list[3][2],
click = function(button, list, input, outs)
if button ~= 1 then
menu.show = { true, "main" }
return
end
config.data.get_guns.list[3][2] = config.data.get_guns.list[3][2] + 1
config.save(config.data)
menu.show[1] = true
end
},
{ -->> AK47
title = "AK47\t"..config.data.get_guns.list[4][2],
click = function(button, list, input, outs)
if button ~= 1 then
menu.show = { true, "main" }
return
end
config.data.get_guns.list[4][2] = config.data.get_guns.list[4][2] + 1
config.save(config.data)
menu.show[1] = true
end
},
{ -->> M4A1
title = "M4A1\t"..config.data.get_guns.list[5][2],
click = function(button, list, input, outs)
if button ~= 1 then
menu.show = { true, "main" }
return
end
config.data.get_guns.list[5][2] = config.data.get_guns.list[5][2] + 1
config.save(config.data)
menu.show[1] = true
end
},
{ -->> Rifle
title = "Rifle\t"..config.data.get_guns.list[6][2],
click = function(button, list, input, outs)
if button ~= 1 then
menu.show = { true, "main" }
return
end
config.data.get_guns.list[6][2] = config.data.get_guns.list[6][2] + 1
config.save(config.data)
menu.show[1] = true
end
},
{ -->> Броня
title = "Броня\t"..config.data.get_guns.list[7][2],
click = function(button, list, input, outs)
if button ~= 1 then
menu.show = { true, "main" }
return
end
config.data.get_guns.list[7][2] = config.data.get_guns.list[7][2] + 1
config.save(config.data)
menu.show[1] = true
end
},
{ -->> Сброс
title = "Сброс\t",
click = function(button, list, input, outs)
if button ~= 1 then
menu.show = { true, "main" }
return
end
for i = 1, #config.data.get_guns.list do
config.data.get_guns.list[i][2] = 0
end
config.save(config.data)
menu.show[1] = true
end
},
}
},
["warelock_auto"] = {
settings = {title = "mafia-tools" ,style = 2 ,btn1 = "Выбрать" ,btn2 = "Назад" ,forward = "{ffffff}" ,backwards = "\n" ,score = false},
warelock_text
},
}
end
menu.show = { false, "main" }
@ -308,12 +648,290 @@ 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
end
end
-->> GET GUNS
get_guns = {}
get_guns.warehouse = false
get_guns.isCanOpen = false
get_guns.onServerMessage = function(color, message)
if message == "{FFFFFF} Вы можете использовать {00AB06}/getgun [ID игрока]{FFFFFF}, чтобы выдать оружие другим членам организации" then
if get_guns.getgun then
return false
end
end
if message == " Вы не на складе оружия своей организации / у вас нет доступа!" or message == " Склад закрыт" then
if get_guns.getgun then
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 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 false
end
end
if message == " Вам недоступна эта функция" then
if not get_guns.check_warehouse then
get_guns.check_warehouse = true
get_guns.check_warehouse_time = os.time()
return false
end
end
if message:find("^ %d+/%d+ Матов | %d+/%d+ Аптечек") and os.time() - get_guns.check_warehouse_time < 2 then
return 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 get_guns.enter_textdraw 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
get_guns.onShowTextDraw = function(id, textdraw)
if textdraw.text:find("VEHICLE_ENTER_EXIT") then
get_guns.enter_textdrawId = id
get_guns.enter_textdraw = true
end
end
get_guns.onTextDrawHide = function(id)
if id == get_guns.enter_textdrawId then
get_guns.enter_textdrawId = -1
get_guns.enter_textdraw = false
end
end
get_guns.onShowDialog = function(id, style, title, button1, button2, text)
if title == "Статистика персонажа" then
local frac, rank = text:match("Организация\t(.+).Ранг\t.+%[(.+)%]")
if rank ~= nil then
rank = rank:gsub("Лидер", "10")
rank = tonumber(rank)
config.data.stats.rank = rank
config.data.stats.frac = frac
config.save(config.data)
end
if not get_guns.check_stats then
get_guns.check_stats = true
get_guns.antiflood = os.time() - 28
return false
end
end
if title == "Склад оружия" then
if get_guns.getgun then
if #get_guns.list > 0 then
sampSendDialogResponse(id,1,get_guns.list[1],"")
table.remove(get_guns.list, 1)
else
get_guns.getgun = false
if get_guns.closed and config.data.stats.rank >= 8 and get_guns.warehouse then
antiflood.send[#antiflood.send+1] = "/warelock"
end
end
return false
end
end
end
get_guns.weapon = {} -- >> onSendPacket
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.closed = false
get_guns.list = {}
get_guns.messages = {}
get_guns.warelock_send = {}
while true do
wait(0)
if not get_guns.check_stats then
if sampIsLocalPlayerSpawned() and os.time() - get_guns.antiflood > 30 then
get_guns.antiflood = os.time()
antiflood.send[#antiflood.send+1] = "/stats"
end
elseif not get_guns.check_warehouse then
if sampIsLocalPlayerSpawned() and os.time() - get_guns.antiflood > 30 then
get_guns.antiflood = os.time()
antiflood.send[#antiflood.send+1] = "/warehouse"
end
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
msg.add("Выполняется взятие ганов")
end
end
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
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
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
if #get_guns.list > 0 then
get_guns.getgun = true
get_guns.closed = false
if not get_guns.warehouse and config.data.stats.rank >= 8 then
antiflood.send[#antiflood.send+1] = "/warelock"
get_guns.closed = true
end
antiflood.send[#antiflood.send+1] = "/getgun"
else
msg.add("У Вас достаточно оружия!")
end
end
-->> Обновление листа таба
function updateScoresAndPing()
while true do
wait(1000)
local bs = raknetNewBitStream()
raknetSendRpc(155,bs)
raknetDeleteBitStream(bs)
end
end
-->> INVITE HELPER
invite_helper = {}
invite_helper.data = {}
invite_helper.onServerMessage = function(color, message)
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
else
if config.data.invite_helper.auto_rank then
local result, id = getPlayerIdByPlayerName(name)
if result then
antiflood.send[#antiflood.send+1] = "/giverank "..id.." "..config.data.invite_helper.rank
end
end
end
if #config.data.invite_helper.message > 0 then
name = name:gsub("_", " ")
antiflood.send[#antiflood.send+1] = string.format("/r %s", config.data.invite_helper.message:gsub("{name}", name))
end
end
end
invite_helper.onSendCommand = function(cmd)
if cmd:find("%/invite %d+") then
local id, rank = cmd:match("%/invite (%d+)"), config.data.invite_helper.rank
if cmd:find("%/invite (%d+) (%d+)") then
id, rank = cmd:match("%/invite (%d+) (%d+)")
end
id = tonumber(id)
local result, name = getNickNameByPlayerId(id)
if result then
if ScoresAndPings[id] ~= nil then
local score = ScoresAndPings[id].score
msg.add(score)
if score >= config.data.invite_helper.lvl then
invite_helper.data[name] = "/giverank "..id.." "..rank
else
msg.add(string.format("У игрока %s[%d] всего %d уровень. Нужен %d уровень!", name, id, score, config.data.invite_helper.lvl))
return false
end
end
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 = {}
antiflood.clock = 0
antiflood.set = function()
antiflood.clock = os.clock() * 1000
end
antiflood.get = function()
return (os.clock() * 1000 - antiflood.clock)
end
antiflood.send = {}
antiflood.loop = function()
while true do
wait(0)
if antiflood.get() > 1300 then
if #antiflood.send > 0 then
sampSendChat(antiflood.send[1])
table.remove(antiflood.send, 1)
antiflood.set()
end
end
end
end
-->> MAFIA CHECKER
mafia_checker = {}
mafia_checker.loop = function()
@ -434,19 +1052,6 @@ request.handler = function(text)
mhcars = { time = 0, text = "00:00:00" },
ffixcar = { time = 0, text = "00:00:00" },
}
local isPlayerInList = function(sender)
local result = false
if config.data.list_block then
if config.data.list[sender] == nil then
result = true
end
else
if config.data.list[sender] ~= nil then
result = true
end
end
return result
end
for sender, sender_data in pairs(info["data"]) do
if isPlayerInList(sender) then
for key, v in pairs(sender_data) do
@ -524,7 +1129,6 @@ ammo_timer.onServerMessage = function(color, message)
end
end --> by Richard_Holmes
if message:find(".+ заказал спавн транспорта через %d+ секунд%. С банка фракции снято %d+ вирт$") then
addChatMessage(message:match(" (%g+_%g+ заказал спавн транспорта через %d+ секунд%. С банка фракции снято %d+ вирт)$"))
request.send[#request.send + 1] = {
key = "ffixcar",
text = message:match(" (%g+_%g+ заказал спавн транспорта через %d+ секунд%. С банка фракции снято %d+ вирт)$")
@ -572,7 +1176,6 @@ ammo_timer.loop = function()
end
end
-->> 2 MIN TIMER
timer_2min = {}
timer_2min.onServerMessage = function(color, message)
@ -631,6 +1234,40 @@ config.default = {
main = false,
x = x2,
y = y2
},
invite_helper = {
lvl = 7,
auto_rank = true,
rank = 7,
key = "VK_I",
message = "Добро пожаловать, {name}!"
},
get_guns = {
list = {
{ "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,
warelock_auto = false,
warelock_text = {
"sklad",
"склад"
},
warelock_time = 5
},
stats = {
frac = "",
rank = 0
},
war = {
armoff = true,
armoff_id = { 0, 1, 4 }
}
}
config.directory = string.format("%s\\moonloader\\config\\%s\\", getGameDirectory(), thisScript().name)
@ -650,6 +1287,13 @@ config.init = function()
if config.data[k] == nil then
config.data[k] = v
end
if type(v) == "table" then
for kk,vv in pairs(v) do
if config.data[k][kk] == nil then
config.data[k][kk] = vv
end
end
end
end
config.save(config.data)
end
@ -692,9 +1336,25 @@ config.read = function()
end
-->> EVENTS
function processEvent(func, args)
if args == nil then
args = {}
end
local kk = table.pack(func(table.unpack(args)))
if kk.n > 0 then
return kk
end
end -- by QRLK (edith.lua)
function sampev.onServerMessage(color, message)
if os.time() - live < 3 then
timer_2min.onServerMessage(color, message)
ammo_timer.onServerMessage(color, message)
invite_helper.onServerMessage(color, message)
local res = processEvent(get_guns.onServerMessage, table.pack(color, message))
if res then
return table.unpack(res)
end
end
end
function sampev.onSendPickedUpPickup(id)
local X, Y, Z = getCharCoordinates(PLAYER_PED)
@ -710,7 +1370,53 @@ function sampev.onSendPickedUpPickup(id)
end
end --> by Benya
end
ScoresAndPings = {}
function sampev.onUpdateScoresAndPings(data)
ScoresAndPings = data
end
function sampev.onSendCommand(cmd)
antiflood.set()
local res = processEvent(invite_helper.onSendCommand, table.pack(cmd))
if res then
return table.unpack(res)
end
end
function sampev.onSendChat(message)
antiflood.set()
end
function sampev.onShowDialog(id, style, title, button1, button2, text)
local res = processEvent(get_guns.onShowDialog, table.pack(id, style, title, button1, button2, text))
if res then
return table.unpack(res)
end
end
function sampev.onShowTextDraw(id, data)
get_guns.onShowTextDraw(id, data)
end
function sampev.onTextDrawHide(id)
get_guns.onTextDrawHide(id)
end
function onSendPacket(id, bs)
if id == 204 then
raknetBitStreamIgnoreBits(bs,40)
local count = raknetBitStreamGetNumberOfUnreadBits(bs) / 32
for i = 1, count do
local slot = raknetBitStreamReadInt8(bs)
local weapon = raknetBitStreamReadInt8(bs)
local ammo = raknetBitStreamReadInt16(bs)
if get_guns.weapon ~= nil then
get_guns.weapon[slot] = ammo
--msg.add(string.format("slot %d = %d ammo", slot, ammo))
if ammo == 0 then
table.remove(get_guns.weapon, slot)
end
end
end
end
end
function sampev.onResetPlayerWeapons()
get_guns.onResetPlayerWeapons()
end
-->> NEW FUNCTION
function getLocalPlayerNickname()
return sampGetPlayerNickname(select(2, sampGetPlayerIdByCharHandle(PLAYER_PED)))
@ -793,6 +1499,64 @@ function urlencode(str)
function (c) return string.format ("%%%02X", string.byte(c)) end)
return str
end
function getNickNameByPlayerId(id)
local result = false
local nick = ""
if sampIsPlayerConnected(id) then
nick = sampGetPlayerNickname(id)
result = true
end
return result, nick
end
function getPlayerIdByPlayerName(name)
local result = false
local id = -1
for i = 0, sampGetMaxPlayerId(false) do
if sampIsPlayerConnected(i) then
if sampGetPlayerNickname(i) == name then
result = true
id = i
break
end
end
end
return result, id
end
function isPlayerInList(sender)
local result = false
if config.data.list_block then
if config.data.list[sender] == nil then
result = true
end
else
if config.data.list[sender] ~= nil then
result = true
end
end
return result
end
function isKeyCanBePressed()
if sampIsDialogActive() or sampIsChatInputActive() or sampIsCursorActive() or isSampfuncsConsoleActive() then
return false
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
function sendRpcCommand(text)
local bs = raknetNewBitStream()
raknetBitStreamWriteInt32(bs, #text)
raknetBitStreamWriteString(bs,text)
raknetSendRpc(50,bs)
raknetDeleteBitStream(bs)
end
-->> UPDATE MODULE
function openURL(url, fpath, message_off)
@ -844,6 +1608,19 @@ function addChatMessage(text)
sampAddChatMessage(tag..text, 0xFFFFFFFF)
end
-->> Chat Message HOOK (Для addChatMessage вне хука samp events)
msg = {}
msg.list = {}
msg.add = function(arg)
msg.list[#msg.list+1] = arg
end
msg.loop = function()
if #msg.list > 0 then
addChatMessage(msg.list[1])
table.remove(msg.list, 1)
end
end
script_update = {
version_url = "http://git.deadpoo.net/rubin/mafia-tools/raw/branch/master/version",
script_url = "http://git.deadpoo.net/rubin/mafia-tools/raw/branch/master/mafia-tools.lua",
@ -1036,5 +1813,8 @@ utf8({ "sampAddChatMessage" }, "Utf8ToAnsi")
utf8({ "print" }, "Utf8ToAnsi")
utf8({ "renderGetFontDrawTextLength" }, "Utf8ToAnsi")
utf8({ "renderFontDrawText" }, "Utf8ToAnsi")
utf8({ "sampSetCurrentDialogEditboxText" }, "Utf8ToAnsi")
utf8({ "sampHasDialogRespond" }, nil, "AnsiToUtf8")
utf8({ "sampev", "onServerMessage" }, "AnsiToUtf8", "Utf8ToAnsi")
utf8({ "sampev", "onShowDialog" }, "AnsiToUtf8", "Utf8ToAnsi")
utf8({ "sampev", "onSendCommand" }, "AnsiToUtf8", "Utf8ToAnsi")

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 293 KiB

@ -1 +1 @@
05.02.2023.2
09.02.2023
Loading…
Cancel
Save