Refactpr whosniffer a lil

This commit is contained in:
2024-11-28 19:04:05 +01:00
parent 901d42fc71
commit 56a08b6cca

View File

@@ -309,10 +309,11 @@ aura_env.NotifyGone = function(player)
end end
-- CHANNEL fuckery -- CHANNEL fuckery
local channel = aura_env.config.channelName or "foobar" local channel = aura_env.config.channel or "foobar"
local password = aura_env.config.channelPassword local password = aura_env.config.channelPassword
local function GetChannelId(channelName) local function FindOrJoinChannel(channelName, password)
local function GetChannelId(channelName)
local channels = {GetChannelList()} local channels = {GetChannelList()}
for i = 1, #channels, 2 do for i = 1, #channels, 2 do
local id = channels[i] local id = channels[i]
@@ -321,19 +322,21 @@ local function GetChannelId(channelName)
return id return id
end end
end end
end
channelId = GetChannelId(channel)
if not channelId then
print(string.format("channel %s not found, joining", channel))
if password then
JoinPermanentChannel(channel, password)
else
JoinPermanentChannel(channel)
end end
channelId = GetChannelId(channelName)
if not channelId then
print(string.format("channel %s not found, joining", channelName))
if password then
JoinPermanentChannel(channelName, password)
else
JoinPermanentChannel(channelName)
end
end
channelId = GetChannelId(channelName)
return channelId
end end
channelId = GetChannelId(channel) aura_env.channelId = FindOrJoinChannel(channel, password)
aura_env.channelId = channelId
print(string.format("channel %s resolved to id %d", channel, channelId)) print(string.format("channel %s resolved to id %d", channel, channelId))
---@param player Player ---@param player Player