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..aff7dea91 100644 --- a/[admin]/admin2/client/main/admin_map.lua +++ b/[admin]/admin2/client/main/admin_map.lua @@ -7,13 +7,14 @@ * Original File by lil_Toady * **************************************]] -local aMap = { +aMap = { check = 0, - permission = true, + permission = false, players = false, coords = false, cursor = false, - last = false + last = false, + teleportHeight = 527 } addEventHandler( @@ -88,13 +89,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, aMap.teleportHeight, "collisions") + + local pz = getGroundPosition(px, py, aMap.teleportHeight) or 10 + triggerServerEvent("aMapWarp", resourceRoot, px, py, pz + 1) end end end @@ -104,6 +111,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 +125,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 +143,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..f3eebed9d 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 pX, pY, pZ = tonumber(x), tonumber(y), tonumber(z) + if not pX or not pY or not pZ then + return + end + + if (not hasObjectPermissionTo(client, "general.adminMapWarp", false)) then + return + end + + setElementPosition(client, pX, pY, pZ) + outputServerLog("ADMIN: ".. getPlayerName(client) .. " warped to map coordinates: " .. tostring(pX) .. ", " .. tostring(pY) .. ", " .. tostring(pZ)) + end +)