Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
jlillis committed Jul 6, 2024
2 parents 38d57c2 + e9801cd commit 405f454
Show file tree
Hide file tree
Showing 21 changed files with 719 additions and 406 deletions.
7 changes: 0 additions & 7 deletions [admin]/admin/meta.xml
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,6 @@
desc="When enabled, admin will use the ip2c resource to determine players' countries by their IP."
/>

<setting name="*nickChangeDelay" value="5000"
friendlyname="Nick change delay"
group="Durations"
accept="500-60000"
desc="Time in miliseconds between a player being able to change their name to prevent nick change spam"
/>

<setting name="*maxchatmsgs" value="10"
friendlyname="Max chat log messages"
accept="1-1000"
Expand Down
13 changes: 0 additions & 13 deletions [admin]/admin/server/admin_server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ aInteriors = {}
aStats = {}
aReports = {}
aWeathers = {}
aNickChangeTime = {}

local aUnmuteTimerList = {}
local chatHistory = {}
Expand Down Expand Up @@ -465,7 +464,6 @@ end

addEventHandler ( "onPlayerQuit", root, function ()
aPlayers[source] = nil
aNickChangeTime[source] = nil
chatHistory[source] = nil
end )

Expand Down Expand Up @@ -1673,17 +1671,6 @@ function checkClient(checkAccess,player,...)
return false
end

function checkNickOnChange(old, new)
if aNickChangeTime[source] and aNickChangeTime[source] + tonumber(get("*nickChangeDelay")) > getTickCount() then
cancelEvent()
outputChatBox("You can only change your name once every "..(tonumber(get("*nickChangeDelay"))/1000).." seconds", source, 255, 0, 0)
return false
else
aNickChangeTime[source] = getTickCount()
end
end
addEventHandler("onPlayerChangeNick", root, checkNickOnChange)

addEventHandler ("onUnban",root,function(theBan,responsibleElement)
if isElement(responsibleElement) and getElementType (responsibleElement)=="player" then
outputServerLog ("BAN: "..getPlayerName(responsibleElement).."["..getAccountName (getPlayerAccount(responsibleElement)).."] ["..getPlayerSerial (responsibleElement).."] ["..getPlayerIP (responsibleElement).."] unbanned player "..(getBanNick(theBan) or "unknown").." ["..(getBanIP (theBan) or getBanSerial(theBan)).."] ")
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 @@ -37,7 +37,7 @@ enum(
"EVENT_RESOURCE",
"EVENT_SERVER",
"EVENT_MESSAGE",
"EVENT_BANS",
"EVENT_BAN",
"EVENT_NETWORK",
"EVENT_PROXY",
"EVENT_ADMIN_CHAT",
Expand All @@ -62,6 +62,7 @@ enum(
"SYNC_RESOURCE",
"SYNC_ADMINS",
"SYNC_SERVER",
"SYNC_BAN",
"SYNC_BANS",
"SYNC_MESSAGES"
},
Expand Down
54 changes: 19 additions & 35 deletions [admin]/admin2/client/main/admin_bans.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@ function aBansTab.Create(tab)
guiGridListAddColumn(aBansTab.BansList, "Name", 0.22)
guiGridListAddColumn(aBansTab.BansList, "IP", 0.25)
guiGridListAddColumn(aBansTab.BansList, "Serial", 0.25)
guiGridListAddColumn(aBansTab.BansList, "Username", 0.25)
guiGridListAddColumn(aBansTab.BansList, "Date", 0.17)
guiGridListAddColumn(aBansTab.BansList, "Expires", 0.17)
guiGridListAddColumn(aBansTab.BansList, "Banned by", 0.22)
guiGridListAddColumn(aBansTab.BansList, "Temporary", 0.22)
aBansTab.Details = guiCreateButton(0.82, 0.07, 0.17, 0.04, "Details", true, aBansTab.Tab)
aBansTab.Unban = guiCreateButton(0.82, 0.12, 0.17, 0.04, "Unban", true, aBansTab.Tab, "unban")
aBansTab.Ban = guiCreateButton(0.82, 0.12, 0.17, 0.04, "Add ban", true, aBansTab.Tab, "ban")
aBansTab.Unban = guiCreateButton(0.82, 0.17, 0.17, 0.04, "Unban", true, aBansTab.Tab, "unban")
aBansTab.BansRefresh = guiCreateButton(0.82, 0.94, 0.17, 0.04, "Refresh", true, aBansTab.Tab, "listbans")

addEventHandler("onClientGUIChanged", aBansTab.BansListSearch, aBansTab.onBansListSearch)
Expand All @@ -41,26 +40,21 @@ function aBansTab.onClientClick(button)
if (button == "left") then
if (source == aBansTab.Details) then
if (guiGridListGetSelectedItem(aBansTab.BansList) == -1) then
messageBox("No ban row selected!", MB_ERROR, MB_OK)
messageBox("No ban selected!", MB_ERROR, MB_OK)
else
local ip = guiGridListGetItemText(aBansTab.BansList, guiGridListGetSelectedItem(aBansTab.BansList), 2)
aBanDetails(ip)
local banID =
guiGridListGetItemData(aBansTab.BansList, guiGridListGetSelectedItem(aBansTab.BansList), 1)
aBanDetails.Show(banID, false)
end
elseif source == aBansTab.Ban then
aBan.Show()
elseif (source == aBansTab.Unban) then
if (guiGridListGetSelectedItem(aBansTab.BansList) == -1) then
messageBox("No ban row selected!", MB_ERROR, MB_OK)
messageBox("No ban selected!", MB_ERROR, MB_OK)
else
local selected =
guiGridListGetItemText(aBansTab.BansList, guiGridListGetSelectedItem(aBansTab.BansList), 2)
if (aBans["Serial"][selected]) then
if (messageBox("Unban Serial " .. selected .. "?", MB_QUESTION, MB_YESNO ) == true) then
triggerServerEvent ( "aBans", localPlayer, "unbanserial", selected )
end
else
if (messageBox("Unban IP " .. selected .. "?", MB_QUESTION, MB_YESNO) == true) then
triggerServerEvent ( "aBans", localPlayer, "unbanip", selected )
end
end
local banID =
guiGridListGetItemData(aBansTab.BansList, guiGridListGetSelectedItem(aBansTab.BansList), 1)
aBanDetails.Show(banID, true)
end
elseif (source == aBansTab.BansRefresh) then
guiGridListClear(aBansTab.BansList)
Expand All @@ -80,7 +74,6 @@ function aBansTab.onBansListSearch()
((ban.nick and string.find(string.upper(ban.nick), text)) or
(ban.ip and string.find(string.upper(ban.ip), text)) or
(ban.serial and string.find(string.upper(ban.serial), text)) or
(ban.username and string.find(string.upper(ban.username), text)) or
(ban.banner and string.find(string.upper(ban.banner), text)))
then
aBansTab.AddRow(id, ban)
Expand Down Expand Up @@ -117,29 +110,20 @@ function aBansTab.AddRow(id, data)
guiGridListSetItemText(list, row, 1, data.nick or "Unknown", false, false)
guiGridListSetItemText(list, row, 2, data.ip or "", false, false)
guiGridListSetItemText(list, row, 3, data.serial or "", false, false)
guiGridListSetItemText(list, row, 4, data.username or "", false, false)
if (data.time) then
local time = getRealTime(data.time)
guiGridListSetItemText(
list,
row,
5,
time.monthday .. " " .. getMonthName(time.month) .. " " .. (1900 + time.year),
false,
false
)
if (data.unban) then
guiGridListSetItemText(list, row, 4, formatDate("m/d/y h:m", nil, data.unban), false, false)
else
guiGridListSetItemText(list, row, 5, "", false, false)
guiGridListSetItemText(list, row, 4, "Never", false, false)
end
guiGridListSetItemText(list, row, 6, data.banner or "", false, false)
guiGridListSetItemText(list, row, 7, iif(data.unban, "Yes", "No"), false, false)
guiGridListSetItemText(list, row, 5, data.banner or "", false, false)

guiGridListSetItemData(list, row, 1, id)
end

function aBansTab.DeleteRow(id)
local list = aBansTab.BansList
for i = 1, guiGridListGetRowCount(list) do
-- GridList row ids start at zero, not one
for i = 0, guiGridListGetRowCount(list) do
local data = guiGridListGetItemData(list, i, 1)
if (data == id) then
guiGridListRemoveRow(list, i)
Expand Down
5 changes: 1 addition & 4 deletions [admin]/admin2/client/main/admin_players.lua
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,7 @@ function aPlayersTab.onClientClick(button)
triggerServerEvent("aPlayer", localPlayer, player, "kick", reason)
end
elseif (source == aPlayersTab.Ban) then
local reason = inputBox("Ban player " .. name, "Enter the ban reason")
if (reason) then
triggerServerEvent("aPlayer", localPlayer, player, "ban", reason)
end
aBan.Show(player)
elseif (source == aPlayersTab.Slap) then
triggerServerEvent("aPlayer", localPlayer, player, "slap",
guiComboBoxGetItemText(aPlayersTab.SlapOptions, guiComboBoxGetSelected(aPlayersTab.SlapOptions))
Expand Down
Loading

0 comments on commit 405f454

Please sign in to comment.