diff --git a/mafia-tools.lua b/mafia-tools.lua index 1787927..a808b4f 100644 --- a/mafia-tools.lua +++ b/mafia-tools.lua @@ -369,6 +369,14 @@ invite_helper.onServerMessage = function(color, message) 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 end end @@ -910,6 +918,20 @@ function getNickNameByPlayerId(id) 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 -->> UPDATE MODULE function openURL(url, fpath, message_off)