|
|
|
@ -248,26 +248,26 @@ menu.update = function() |
|
|
|
|
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.."}".."Инвайт хелпер\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) |
|
|
|
|
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 |
|
|
|
|
end |
|
|
|
|
menu.show = { true, "main" } |
|
|
|
|
end, config.data.invite_helper.lvl} |
|
|
|
|
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 "выкл"), |
|
|
|
@ -381,12 +381,21 @@ invite_helper.onServerMessage = function(color, message) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
invite_helper.onSendCommand = function(cmd) |
|
|
|
|
if cmd:lower():find("%/invite %d+ (%d+)") then |
|
|
|
|
local id, rank = cmd:lower():match("%/invite (%d+) (%d+)") |
|
|
|
|
if cmd:lower():find("%/invite %d+") then |
|
|
|
|
local id, rank = cmd:lower():match("%/invite (%d+)"), config.data.invite_helper.rank |
|
|
|
|
if cmd:lower():find("%/invite (%d+) (%d+)") then |
|
|
|
|
id, rank = cmd:lower():match("%/invite (%d+) (%d+)") |
|
|
|
|
end |
|
|
|
|
local id = tonumber(id) |
|
|
|
|
local result, name = getNickNameByPlayerId(id) |
|
|
|
|
if result then |
|
|
|
|
invite_helper.data[name] = "/giverank "..id.." "..rank |
|
|
|
|
local score = sampGetPlayerScore(id) |
|
|
|
|
if score >= config.data.invite_helper.lvl then |
|
|
|
|
invite_helper.data[name] = "/giverank "..id.." "..rank |
|
|
|
|
else |
|
|
|
|
addChatMessage(string.format("У игрока %s[%d] всего %d уровень. Нужен %d уровень!", name, id, score, config.data.invite_helper.lvl)) |
|
|
|
|
return true, false |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
@ -414,7 +423,6 @@ antiflood.loop = function() |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-->> MAFIA CHECKER |
|
|
|
|
mafia_checker = {} |
|
|
|
|
mafia_checker.loop = function() |
|
|
|
@ -798,6 +806,19 @@ config.read = function() |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
events = {} |
|
|
|
|
events.handler = function(handler, param) |
|
|
|
|
for i = 1, #handler do |
|
|
|
|
local result, pack = handler[i](table.unpack(param)) |
|
|
|
|
if result then |
|
|
|
|
return pack |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
events.onSendCommand = { |
|
|
|
|
invite_helper.onSendCommand |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
-->> EVENTS |
|
|
|
|
function sampev.onServerMessage(color, message) |
|
|
|
|
timer_2min.onServerMessage(color, message) |
|
|
|
@ -820,13 +841,15 @@ function sampev.onSendPickedUpPickup(id) |
|
|
|
|
end |
|
|
|
|
function sampev.onSendCommand(cmd) |
|
|
|
|
antiflood.set() |
|
|
|
|
invite_helper.onSendCommand(cmd) |
|
|
|
|
local result = events.handler(events.onSendCommand, { cmd }) |
|
|
|
|
if result ~= nil then |
|
|
|
|
return result |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
function sampev.onSendChat(message) |
|
|
|
|
antiflood.set() |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-->> NEW FUNCTION |
|
|
|
|
function getLocalPlayerNickname() |
|
|
|
|
return sampGetPlayerNickname(select(2, sampGetPlayerIdByCharHandle(PLAYER_PED))) |
|
|
|
|