diff --git a/[admin]/admin2/client/admin_session.lua b/[admin]/admin2/client/admin_session.lua
index 7f27762dc..31db0e2b3 100644
--- a/[admin]/admin2/client/admin_session.lua
+++ b/[admin]/admin2/client/admin_session.lua
@@ -22,7 +22,8 @@ addEventHandler(
end
aSession = data
-
+ aMap.UpdatePermissions()
+
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..385a11d0a 100644
--- a/[admin]/admin2/client/main/admin_map.lua
+++ b/[admin]/admin2/client/main/admin_map.lua
@@ -7,9 +7,9 @@
* Original File by lil_Toady
*
**************************************]]
-local aMap = {
+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 (isPlayerMapVisible() and button == "left") then
+ if (not aMap.permission) then
+ return
+ end
+ 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)
local px = 6000 * ((x - minX) / msx) - 3000
local py = 3000 - 6000 * ((y - minY) / msy)
- setElementPosition(localPlayer, px, py, 10)
+ enginePreloadWorldArea(px, py, 527, "collisions")
+
+ local pz = getGroundPosition(px, py, 527) 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 aMap.UpdatePermissions()
+ 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
+)