added menu guns & added checker frac/rank

update
rubin 2 years ago
parent 1f2e8af3ab
commit aeb081b4c2
  1. 204
      mafia-tools.lua

@ -25,6 +25,7 @@ function main()
lua_thread.create(mafia_checker.loop)
lua_thread.create(antiflood.loop)
lua_thread.create(invite_helper.loop)
lua_thread.create(get_guns.loop)
wait(-1)
end
@ -351,6 +352,27 @@ 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)
if button ~= 1 then return end
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, "get_guns" }
end
},
}
},
["edit"] = {
@ -383,7 +405,109 @@ 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
},
}
},
}
end
menu.show = { false, "main" }
@ -419,6 +543,42 @@ menu.loop = function()
end
end
-->> GET GUNS
get_guns = {}
get_guns.warehouse = false
get_guns.isCanOpen = false
get_guns.onServerMessage = function(color, message)
end
get_guns.onShowDialog = function(id, style, title, button1, button2, text)
if title == "Статистика персонажа" then
local frac, rank = text:match("Организация\t(.+).Ранг\tКонсильере.%[(.+)%]")
rank = rank:gsub("Лидер", "10")
rank = tonumber(rank)
config.data.stats.rank = rank
config.data.stats.frac = frac
config.save(config.data)
if not get_guns.check_stats then
get_guns.check_stats = true
return true, false
end
end
end
get_guns.loop = function()
get_guns.check_stats = false
get_guns.antiflood = 0
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
end
end
end
-->> INVITE HELPER
invite_helper = {}
invite_helper.data = {}
@ -808,6 +968,29 @@ config.default = {
rank = 7,
key = "VK_I",
message = "Добро пожаловать, {name}!"
},
get_guns = {
list = {
{ "Desert Eagle", 0 },
{ "Shotgun", 0 },
{ "SMG", 0 },
{ "AK47", 0 },
{ "M4A1", 0 },
{ "Rifle", 0 },
{ "Броня", 0 }
},
key = "VK_G",
auto_get_guns = false,
warelock_auto = false,
warelock_text = {
"sklad",
"склад"
},
warelock_time = 10
},
stats = {
frac = "",
rank = 0
}
}
config.directory = string.format("%s\\moonloader\\config\\%s\\", getGameDirectory(), thisScript().name)
@ -877,15 +1060,25 @@ events.handler = function(handler, param)
end
end
end
events.onServerMessage = {
get_guns.onServerMessage
}
events.onSendCommand = {
invite_helper.onSendCommand
}
events.onShowDialog = {
get_guns.onShowDialog
}
-->> EVENTS
function sampev.onServerMessage(color, message)
timer_2min.onServerMessage(color, message)
ammo_timer.onServerMessage(color, message)
invite_helper.onServerMessage(color, message)
local result = events.handler(events.onServerMessage, { color, message })
if result ~= nil then
return result
end
end
function sampev.onSendPickedUpPickup(id)
local X, Y, Z = getCharCoordinates(PLAYER_PED)
@ -911,6 +1104,12 @@ end
function sampev.onSendChat(message)
antiflood.set()
end
function sampev.onShowDialog(id, style, title, button1, button2, text)
local result = events.handler(events.onShowDialog, { id, style, title, button1, button2, text })
if result ~= nil then
return result
end
end
-->> NEW FUNCTION
function getLocalPlayerNickname()
@ -1275,4 +1474,5 @@ utf8({ "renderGetFontDrawTextLength" }, "Utf8ToAnsi")
utf8({ "renderFontDrawText" }, "Utf8ToAnsi")
utf8({ "sampSetCurrentDialogEditboxText" }, "Utf8ToAnsi")
utf8({ "sampHasDialogRespond" }, nil, "AnsiToUtf8")
utf8({ "sampev", "onServerMessage" }, "AnsiToUtf8", "Utf8ToAnsi")
utf8({ "sampev", "onServerMessage" }, "AnsiToUtf8", "Utf8ToAnsi")
utf8({ "sampev", "onShowDialog" }, "AnsiToUtf8", "Utf8ToAnsi")
Loading…
Cancel
Save