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

@@ -4,6 +4,14 @@ local SERVER_MODULE = "PROJECTRVTools"
local SERVER_COMMAND_REASSIGN = "ReassignVehicleToCurrentRoom"
local CLIENT_COMMAND_RESULT = "ReassignVehicleResult"
local function isAdminPlayer(player)
if not player or not player.getAccessLevel then
return false
end
local accessLevel = tostring(player:getAccessLevel() or ""):lower()
return accessLevel == "admin"
end
local function getRoomTypeAtPosition(x, y, z)
local RV = require("RVVehicleTypes")
local vehicleTypes = RV.VehicleTypes
@@ -112,6 +120,16 @@ local function onClientCommand(module, command, player, args)
end
if command == SERVER_COMMAND_REASSIGN then
if not isAdminPlayer(player) then
if player then
sendServerCommand(player, SERVER_MODULE, CLIENT_COMMAND_RESULT, {
ok = false,
message = "Only admins can use this action."
})
end
return
end
local ok, message = reassignVehicleToCurrentRoom(player)
if player then
sendServerCommand(player, SERVER_MODULE, CLIENT_COMMAND_RESULT, {