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
3 changes: 2 additions & 1 deletion [admin]/admin2/client/admin_session.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
24 changes: 20 additions & 4 deletions [admin]/admin2/client/main/admin_map.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
* Original File by lil_Toady
*
**************************************]]
local aMap = {
aMap = {
check = 0,
permission = true,
permission = false,
players = false,
coords = false,
cursor = false,
Expand Down Expand Up @@ -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
Expand All @@ -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"
Expand All @@ -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
Expand All @@ -130,3 +142,7 @@ bindKey(
end
end
)

function aMap.UpdatePermissions()
aMap.permission = hasPermissionTo("general.adminMapWarp")
end
4 changes: 4 additions & 0 deletions [admin]/admin2/conf/ACL.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
<right name="general.tab_bans" access="true" />
<right name="general.tab_adminchat" access="true" />
<right name="general.tab_acl" access="true" />
<!-- Utils -->
<right name="general.adminMapWarp" access="true" />
<!--Player Related-->
<right name="command.kick" access="true" />
<right name="command.freeze" access="true" />
Expand Down Expand Up @@ -101,6 +103,8 @@
<right name="general.tab_bans" access="true" />
<right name="general.tab_adminchat" access="true" />
<right name="general.tab_acl" access="false" />
<!-- Utils -->
<right name="general.adminMapWarp" access="true" />
<!--Player Related-->
<right name="command.kick" access="true" />
<right name="command.freeze" access="true" />
Expand Down
21 changes: 20 additions & 1 deletion [admin]/admin2/server/admin_server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -435,4 +435,23 @@ addCommandHandler(get("adminChatCommandName"),
triggerEvent("aAdminChat", thePlayer, table.concat(arg, " "))
end
end
)
)

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
)