Restrict to Debug Only and Server Admin

This commit is contained in:
2026-02-15 23:50:43 -05:00
parent cacf4eb701
commit b93cee7afb
3 changed files with 71 additions and 0 deletions

View File

@@ -6,6 +6,24 @@ local SERVER_MODULE = "PROJECTRVTools"
local SERVER_COMMAND_REASSIGN = "ReassignVehicleToCurrentRoom"
local CLIENT_COMMAND_RESULT = "ReassignVehicleResult"
local function isDebugModeEnabled()
if type(isDebugEnabled) == "function" then
return isDebugEnabled() == true
end
return false
end
local function isAdminPlayer(player)
if not isClient() then
return true
end
if not player or not player.getAccessLevel then
return false
end
local accessLevel = tostring(player:getAccessLevel() or ""):lower()
return accessLevel == "admin"
end
-- Get the room type based on the player's coordinates
local function getRoomTypeAtPosition(x, y, z)
local RV = require("RVVehicleTypes")
@@ -98,6 +116,13 @@ local function reassignVehicleToCurrentRoom(player)
end
local function requestReassignVehicleToCurrentRoom(player)
if not isDebugModeEnabled() then
return
end
if not isAdminPlayer(player) then
return
end
if isClient() then
sendClientCommand(SERVER_MODULE, SERVER_COMMAND_REASSIGN, {})
return
@@ -141,6 +166,13 @@ end
-- Main function that adds the context menu option
local function addReassignOption(player, context)
if not isDebugModeEnabled() then
return
end
if not isAdminPlayer(player) then
return
end
local inRoom, roomType, room = isPlayerInValidRoom(player)
if not inRoom then