Skip to content

Commit 1b99a05

Browse files
xLuxyqaisjp
authored andcommitted
admin2: add anonymous mode
1 parent c663d40 commit 1b99a05

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

[admin]/admin2/client/main/admin_players.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ function aPlayersTab.Create(tab)
103103
aPlayersTab.VehicleBlow = guiCreateButton(0.87, 0.805, 0.12, 0.04, "Blow", true, tab, "blowvehicle")
104104
aPlayersTab.VehicleCustomize = guiCreateButton(0.87, 0.85, 0.12, 0.04, "Customize", true, tab, "customize")
105105

106+
aPlayersTab.AnonAdmin = guiCreateCheckBox(0.745, 0.942, 0.20, 0.04, "Anonymous Admin", isAnonAdmin(), true, tab)
107+
106108
aPlayersTab.Refresh()
107109

108110
-- EVENTS
@@ -265,6 +267,8 @@ function aPlayersTab.onClientClick(button)
265267
end
266268
end
267269
end
270+
elseif (source == aPlayersTab.AnonAdmin) then
271+
setElementData(localPlayer, "AnonAdmin", guiCheckBoxGetSelected(aPlayersTab.AnonAdmin))
268272
elseif (source == aPlayersTab.ColorCodes) then
269273
aPlayersTab.Refresh()
270274
elseif (source == aPlayersTab.PlayerList) then

[admin]/admin2/shared/utils.lua

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,13 @@ function RGBToHex(red, green, blue, alpha)
3030
return string.format("#%.2X%.2X%.2X", red, green, blue)
3131
end
3232
end
33+
34+
function isAnonAdmin(player)
35+
local player = (player or localPlayer)
36+
37+
if (not isElement(player)) then
38+
return false
39+
end
40+
41+
return (getElementData(player, "AnonAdmin") == true)
42+
end

0 commit comments

Comments
 (0)