Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion [admin]/admin/client/gui/admin_main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1408,7 +1408,7 @@ end

function setAnonAdmin( bOn )
guiCheckBoxSetSelected ( aTab1.AnonAdmin, bOn )
setElementData( localPlayer, "AnonAdmin", bOn )
triggerServerEvent("aAdmin", localPlayer, "adminpanel", "updateAnonymous", bOn)
aSetSetting ( "currentAnonState", bOn )
end

Expand Down
16 changes: 12 additions & 4 deletions [admin]/admin/server/admin_server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ end

-- Should admin name be hidden from public chatbox message?
function isAnonAdmin4All ( admin )
return getElementData( admin, "AnonAdmin" ) == true
return aPlayers[admin] and aPlayers[admin]["AnonymousAdmin"] or false
end

-- Should admin name be hidden from private chatbox message?
Expand Down Expand Up @@ -666,6 +666,7 @@ end )
local aAdminRights = {
["settings"] = "general.tab_resources",
["resourcelist"] = "general.tab_resources",
["adminpanel"] = "general.adminpanel",

["sync"] = "command.aclmanager",
["aclcreate"] = "command.aclcreate",
Expand Down Expand Up @@ -907,6 +908,13 @@ addEventHandler ( "aAdmin", root, function ( action, ... )
end
end
end
elseif ( action == "adminpanel" ) then
local cmd = arg[1]

if cmd == "updateAnonymous" then
local state = arg[2]
aPlayers[client]["AnonymousAdmin"] = state
end
end
end )

Expand Down Expand Up @@ -961,7 +969,7 @@ addEventHandler ( "aPlayer", root, function ( player, action, data, additional,
if ( action == "kick" ) then
local reason = data or ""
mdata = reason~="" and ( "(" .. reason .. ")" ) or ""
local isAnonAdmin = getElementData(source, "AnonAdmin")
local isAnonAdmin = isAnonAdmin4All(source)
if isAnonAdmin then
setTimer ( kickPlayer, 100, 1, player, "Anonymous admin", reason )
else
Expand All @@ -971,7 +979,7 @@ addEventHandler ( "aPlayer", root, function ( player, action, data, additional,
local reason = data or ""
local seconds = tonumber(additional) and tonumber(additional) > 0 and tonumber(additional)
local bUseSerial = additional2
local isAnonAdmin = getElementData(source, "AnonAdmin")
local isAnonAdmin = isAnonAdmin4All(source)
mdata = reason~="" and ( "(" .. reason .. ")" ) or ""
more = seconds and ( "(" .. secondsToTimeDesc(seconds) .. ")" ) or ""
if bUseSerial and getPlayerName ( player ) and not isAnonAdmin then
Expand Down Expand Up @@ -1034,7 +1042,7 @@ addEventHandler ( "aPlayer", root, function ( player, action, data, additional,
elseif ( action == "shout" ) then
local textDisplay = textCreateDisplay ()
local textItem
local anon = getElementData( admin, "AnonAdmin" )
local anon = isAnonAdmin4All( admin )
if (anon) then
textItem = textCreateTextItem ( "ADMIN:\n\n"..data, 0.5, 0.5, 2, 255, 100, 50, 255, 4, "center", "center" )
else
Expand Down
3 changes: 2 additions & 1 deletion [admin]/admin2/admin_definitions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ enum(
"EVENT_SCREEN_SHOT",
"EVENT_RESOURCE_START",
"EVENT_RESOURCE_STOP",
"EVENT_PLAYER_JOIN"
"EVENT_PLAYER_JOIN",
"EVENT_ANONYMOUS_UPDATE"
},
"ae"
)
Expand Down
2 changes: 1 addition & 1 deletion [admin]/admin2/client/main/admin_players.lua
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ function aPlayersTab.onClientClick(button)
end
end
elseif (source == aPlayersTab.AnonAdmin) then
setElementData(localPlayer, "AnonAdmin", guiCheckBoxGetSelected(aPlayersTab.AnonAdmin))
triggerServerEvent(EVENT_ANONYMOUS_UPDATE, localPlayer, guiCheckBoxGetSelected(aPlayersTab.AnonAdmin))
elseif (source == aPlayersTab.ColorCodes) then
aPlayersTab.Refresh()
aSetSetting('hideColorCodes', guiCheckBoxGetSelected(source))
Expand Down
11 changes: 11 additions & 0 deletions [admin]/admin2/server/admin_server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,17 @@ addEventHandler(
end
)

addEvent(EVENT_ANONYMOUS_UPDATE, true)
addEventHandler(
EVENT_ANONYMOUS_UPDATE,
root,
function(state)
if (hasObjectPermissionTo(client, "general.adminpanel", false)) then
aPlayers[client]["AnonymousAdmin"] = state
end
end
)

addCommandHandler(get("adminChatCommandName"),
function(thePlayer, cmd, ...)
if (hasObjectPermissionTo(thePlayer, "general.tab_adminchat", false) and #arg > 0) then
Expand Down
2 changes: 1 addition & 1 deletion [admin]/admin2/shared/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function isAnonAdmin(aplayer)
return false
end

return (getElementData(player, "AnonAdmin") == true)
return aPlayers[aplayer] and aPlayers[aplayer]["AnonymousAdmin"] or false
end

-- Source: https://wiki.multitheftauto.com/wiki/FormatDate
Expand Down