Hey! I am using “Basic Admin Essentials” for my game, and I was wondering how I could have my one level of admin, (VIP Gamepass Admin) not be able to do commands on anyone but them selfs. Example: They can do “fly me” but they can’t do “fly bob123” and they can’t do “fly all”
I have tried youtube, and dev forum but I cannot find anything on it. I have also PMed a developer them selfs, they explained the outline of it but I still don’t understand.
Another example could be, VIP admin can’t do “sit bob234”, but can do “sit me”. A Moderator level of admin can do “sit bob234” and can do “sit me” etc.
I have at least found where the line of code I would do this is, and I have a list of commands that I need to be changed for VIP admin. An example of 1 that needs to be changed is here, once we can figure out this one I can change it for all.
Edit: This line of code is in the BAE starting at line: 1591
function Funcs.Fly(Args)
local Player = Args[1]
local Command = Args[2]
local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
if Command == "fly" then
for a,b in next,Players do
essentialsEvent:FireClient(b,'Fly',true)
end
elseif Command == "unfly" then
for a,b in next,Players do
essentialsEvent:FireClient(b,'Fly',false)
end
end
end
Hmmm. So some if statement that checks to see if the player is using arg 1 on them selfs, and if they are then continue with firing the event, if not give them a hint or something saying you can’t use this on other people. And if the player isn’t even VIP admin and is higher then it just skips the if statement? Right?
You need to adjust the command function to check the admin level of the player issuing the command and restrict the targets they can affect.
function Funcs.Fly(Args)
local Player = Args[1]
local Command = Args[2]
local targetPlayer = Args[3]
-- Check if the player is a VIP Gamepass Admin
if isVIPGamepassAdmin(Player) then
-- Restrict to self-commands only
if targetPlayer:lower() ~= "me" then
return
end
end
local Players = returnPlayers(Player, Args[3], Args[2])
if not Players then return end
if Command == "fly" then
for a, b in next, Players do
essentialsEvent:FireClient(b, 'Fly', true)
end
elseif Command == "unfly" then
for a, b in next, Players do
essentialsEvent:FireClient(b, 'Fly', false)
end
end
end
-- Function to check if a player is a VIP Gamepass Admin
function isVIPGamepassAdmin(player)
end
This didn’t seem to work, I tested it on a alt account by giving it VIP admin, and my alt could still fly other people. It may be the “isVIPGamepassAdmin” since the level of admin is just called “VIP” I will test changing that rn.
function Funcs.Fly(Args)
local Player = Args[1]
local Command = Args[2]
local targetPlayer = Args[3]
-- Check if the player is a VIP Gamepass Admin
if isVIP(Player) then
-- Restrict to self-commands only
if targetPlayer:lower() ~= "me" then
return
end
end
local Players = returnPlayers(Player, Args[3], Args[2])
if not Players then return end
if Command == "fly" then
for a, b in next, Players do
essentialsEvent:FireClient(b, 'Fly', true)
end
elseif Command == "unfly" then
for a, b in next, Players do
essentialsEvent:FireClient(b, 'Fly', false)
end
end
end
-- Function to check if a player is a VIP Gamepass Admin
function isVIP(player)
end
--function Funcs.Fly(Args)
-- local Player = Args[1]
-- local Command = Args[2]
-- local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
-- if Command == "fly" then
-- for a,b in next,Players do
-- essentialsEvent:FireClient(b,'Fly',true)
-- end
-- elseif Command == "unfly" then
-- for a,b in next,Players do
-- essentialsEvent:FireClient(b,'Fly',false)
-- end
-- end
--end
Hello, as on the devforum users are supposed to get help and guide themselves to create code I won’t give you the exact code but since I have lots of experience I will give you an outline!
Basic admin uses a function to find the players admin level by doing:
local Perms = returnPermission(Player)
So in the VIP check function you can use this to help find the admin level of the user.
Here is the VIP outline i have made:
function isVIP(player)
local Perms = returnPermission(player)
if Perms == "admin level" then
return true
else
return false
end
end
function Funcs.Fly(Args)
local Player = Args[1]
local Command = Args[2]
local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
if Command == "fly" then
essentialsEvent:FireClient(Player,'Fly',true)
elseif Command == "unfly" then
essentialsEvent:FireClient(Player,'Fly',false)
end
end
Couldn’t you just do that? (Assuming the “Player” variable is the player running the command.)
As for different levels of admin, you could check their level and adjust the event firing based on that. So top level admins can do it on everyone, which means you’d run the loop from your code before if it’s a top level admin. But the other levels you’d just fire the event for the player who ran the command.