From fe2c6942028d87e7a31cfb60497a35848867bcc6 Mon Sep 17 00:00:00 2001 From: DmitriyColeman Date: Tue, 6 Jan 2026 16:59:44 +0300 Subject: [PATCH 1/5] admin2: refine radar teleport functionality --- [admin]/admin2/client/admin_session.lua | 3 ++- [admin]/admin2/client/main/admin_map.lua | 20 ++++++++++++++++++-- [admin]/admin2/conf/ACL.xml | 4 ++++ [admin]/admin2/server/admin_server.lua | 21 ++++++++++++++++++++- 4 files changed, 44 insertions(+), 4 deletions(-) diff --git a/[admin]/admin2/client/admin_session.lua b/[admin]/admin2/client/admin_session.lua index 7f27762dc..6daf2fd7e 100644 --- a/[admin]/admin2/client/admin_session.lua +++ b/[admin]/admin2/client/admin_session.lua @@ -22,7 +22,8 @@ addEventHandler( end aSession = data - + UpdateMapPermissions() + if (hasPermissionTo("general.adminpanel")) then outputChatBox("Press 'p' to open your admin panel", player) bindKey("p", "down", "adminpanel") diff --git a/[admin]/admin2/client/main/admin_map.lua b/[admin]/admin2/client/main/admin_map.lua index 0b7714666..49ad3d3fa 100644 --- a/[admin]/admin2/client/main/admin_map.lua +++ b/[admin]/admin2/client/main/admin_map.lua @@ -9,7 +9,7 @@ **************************************]] local aMap = { check = 0, - permission = true, + permission = false, players = false, coords = false, cursor = false, @@ -88,13 +88,19 @@ addEventHandler( "onClientClick", root, function(button, state, x, y) + if (not aMap.permission) then + return + end if (isPlayerMapVisible() and button == "left") then local minX, minY, maxX, maxY = getPlayerMapBoundingBox() if ((x >= minX and x <= maxX) and (y >= minY and y <= maxY)) then local msx, msy = -(minX - maxX), -(minY - maxY) local px = 6000 * ((x - minX) / msx) - 3000 local py = 3000 - 6000 * ((y - minY) / msy) - setElementPosition(localPlayer, px, py, 10) + enginePreloadWorldArea(px, py, 10, "collisions") + + local pz = getGroundPosition(px, py, 100) or 10 + triggerServerEvent("aMapWarp", resourceRoot, px, py, pz + 1) end end end @@ -104,6 +110,9 @@ bindKey( "mouse2", "both", function(key, state) + if (not aMap.permission) then + return + end if (isPlayerMapVisible()) then showCursor(state == "down") aMap.cursor = state == "down" @@ -115,6 +124,9 @@ bindKey( "num_7", "down", function(key, state) + if (not aMap.permission) then + return + end if (isPlayerMapVisible()) then aMap.players = not aMap.players end @@ -130,3 +142,7 @@ bindKey( end end ) + +function UpdateMapPermissions() + aMap.permission = hasPermissionTo("general.adminMapWarp") +end \ No newline at end of file diff --git a/[admin]/admin2/conf/ACL.xml b/[admin]/admin2/conf/ACL.xml index 35d2574d7..d4a152e27 100644 --- a/[admin]/admin2/conf/ACL.xml +++ b/[admin]/admin2/conf/ACL.xml @@ -14,6 +14,8 @@ + + @@ -101,6 +103,8 @@ + + diff --git a/[admin]/admin2/server/admin_server.lua b/[admin]/admin2/server/admin_server.lua index dae2daa36..7fc546bf8 100644 --- a/[admin]/admin2/server/admin_server.lua +++ b/[admin]/admin2/server/admin_server.lua @@ -435,4 +435,23 @@ addCommandHandler(get("adminChatCommandName"), triggerEvent("aAdminChat", thePlayer, table.concat(arg, " ")) end end -) \ No newline at end of file +) + +addEvent("aMapWarp", true) +addEventHandler( + "aMapWarp", + resourceRoot, + function(x, y, z) + local x, y, z = tonumber(x), tonumber(y), tonumber(z) + if not x or not y or not z then + return + end + + if (not hasObjectPermissionTo(client, "general.adminMapWarp", false)) then + return + end + + setElementPosition(client, x, y, z) + outputServerLog("ADMIN: ".. getPlayerName(client) .. " warped to map coordinates: " .. tostring(x) .. ", " .. tostring(y) .. ", " .. tostring(z)) + end +) From 076da3f502b552381153174e5ac06d35dcb9ebb1 Mon Sep 17 00:00:00 2001 From: DmitriyColeman <47474886+DmitriyColeman@users.noreply.github.com> Date: Wed, 7 Jan 2026 00:24:25 +0300 Subject: [PATCH 2/5] admin2: add missed button state check in map teleport --- [admin]/admin2/client/main/admin_map.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/[admin]/admin2/client/main/admin_map.lua b/[admin]/admin2/client/main/admin_map.lua index 49ad3d3fa..f984d21ef 100644 --- a/[admin]/admin2/client/main/admin_map.lua +++ b/[admin]/admin2/client/main/admin_map.lua @@ -91,7 +91,7 @@ addEventHandler( if (not aMap.permission) then return end - if (isPlayerMapVisible() and button == "left") then + if (isPlayerMapVisible() and button == "left" and state == "down") then local minX, minY, maxX, maxY = getPlayerMapBoundingBox() if ((x >= minX and x <= maxX) and (y >= minY and y <= maxY)) then local msx, msy = -(minX - maxX), -(minY - maxY) @@ -145,4 +145,5 @@ bindKey( function UpdateMapPermissions() aMap.permission = hasPermissionTo("general.adminMapWarp") -end \ No newline at end of file + +end From ef90704c14503f492ec3c9492a4931ab6b8b2e73 Mon Sep 17 00:00:00 2001 From: DmitriyColeman <47474886+DmitriyColeman@users.noreply.github.com> Date: Wed, 7 Jan 2026 00:54:40 +0300 Subject: [PATCH 3/5] admin2: increased the Z coordinate in enginePreloadWorldArea to handle high points on the map --- [admin]/admin2/client/main/admin_map.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/[admin]/admin2/client/main/admin_map.lua b/[admin]/admin2/client/main/admin_map.lua index f984d21ef..585e07e3e 100644 --- a/[admin]/admin2/client/main/admin_map.lua +++ b/[admin]/admin2/client/main/admin_map.lua @@ -97,7 +97,7 @@ addEventHandler( local msx, msy = -(minX - maxX), -(minY - maxY) local px = 6000 * ((x - minX) / msx) - 3000 local py = 3000 - 6000 * ((y - minY) / msy) - enginePreloadWorldArea(px, py, 10, "collisions") + enginePreloadWorldArea(px, py, 527, "collisions") local pz = getGroundPosition(px, py, 100) or 10 triggerServerEvent("aMapWarp", resourceRoot, px, py, pz + 1) @@ -147,3 +147,4 @@ function UpdateMapPermissions() aMap.permission = hasPermissionTo("general.adminMapWarp") end + From bbf8e049002e4b3176cbe4f5a2f873ba2e3f9244 Mon Sep 17 00:00:00 2001 From: DmitriyColeman Date: Thu, 8 Jan 2026 11:59:20 +0300 Subject: [PATCH 4/5] admin2: Code-style fixes --- [admin]/admin2/client/admin_session.lua | 2 +- [admin]/admin2/client/main/admin_map.lua | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/[admin]/admin2/client/admin_session.lua b/[admin]/admin2/client/admin_session.lua index 6daf2fd7e..31db0e2b3 100644 --- a/[admin]/admin2/client/admin_session.lua +++ b/[admin]/admin2/client/admin_session.lua @@ -22,7 +22,7 @@ addEventHandler( end aSession = data - UpdateMapPermissions() + aMap.UpdatePermissions() if (hasPermissionTo("general.adminpanel")) then outputChatBox("Press 'p' to open your admin panel", player) diff --git a/[admin]/admin2/client/main/admin_map.lua b/[admin]/admin2/client/main/admin_map.lua index 585e07e3e..69ead0a4d 100644 --- a/[admin]/admin2/client/main/admin_map.lua +++ b/[admin]/admin2/client/main/admin_map.lua @@ -7,7 +7,7 @@ * Original File by lil_Toady * **************************************]] -local aMap = { +aMap = { check = 0, permission = false, players = false, @@ -143,8 +143,6 @@ bindKey( end ) -function UpdateMapPermissions() +function aMap.UpdatePermissions() aMap.permission = hasPermissionTo("general.adminMapWarp") - -end - +end \ No newline at end of file From 0d834b9b0f9299f5484299ad02482e2a5f50dea8 Mon Sep 17 00:00:00 2001 From: DmitriyColeman Date: Thu, 8 Jan 2026 12:01:54 +0300 Subject: [PATCH 5/5] admin2: Use 527 as Z coord in getGroundPosition --- [admin]/admin2/client/main/admin_map.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/[admin]/admin2/client/main/admin_map.lua b/[admin]/admin2/client/main/admin_map.lua index 69ead0a4d..385a11d0a 100644 --- a/[admin]/admin2/client/main/admin_map.lua +++ b/[admin]/admin2/client/main/admin_map.lua @@ -99,7 +99,7 @@ addEventHandler( local py = 3000 - 6000 * ((y - minY) / msy) enginePreloadWorldArea(px, py, 527, "collisions") - local pz = getGroundPosition(px, py, 100) or 10 + local pz = getGroundPosition(px, py, 527) or 10 triggerServerEvent("aMapWarp", resourceRoot, px, py, pz + 1) end end