-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAutoUnmutePlayers.lua
29 lines (24 loc) · 1.04 KB
/
AutoUnmutePlayers.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
local userid_to_entindex = client.userid_to_entindex
local entity_get_local_player, entity_get_player_name = entity.get_local_player, entity.get_player_name
local globals_maxplayers = globals.maxplayers
local GameStateAPI = panorama.open().GameStateAPI
local function UnmutePlayer(playerEntIndex)
local player_xuid = GameStateAPI.GetPlayerXuidStringFromEntIndex(playerEntIndex)
if player_xuid ~= '0' and GameStateAPI.IsSelectedPlayerMuted(player_xuid) then
GameStateAPI.ToggleMute(player_xuid)
print('Unmuted player: ', entity_get_player_name(playerEntIndex))
end
end
client.set_event_callback('player_connect_full', function (event)
local playerUserID = event.userid
local playerEntIndex = userid_to_entindex(playerUserID)
-- Run through all players, unmute them if muted and then return.
if (playerEntIndex == entity_get_local_player()) then
for player=1, globals_maxplayers() do
UnmutePlayer(player)
end
return
end
-- Unmute player
UnmutePlayer(playerEntIndex)
end)