I’ve made a plugin to give the target player temporary instructor commands (instructor is a custom rank).
but it doesnt work, the command doesnt even show up on the cmds list. help me
--[[
SERVER PLUGINS' NAMES MUST START WITH "Server:" OR "Server-"
CLIENT PLUGINS' NAMES MUST START WITH "Client:" OR "Client-"
Plugins have full access to the server/client tables and most variables.
You can use the MakePluginEvent to use the script instead of setting up an event.
PlayerJoined will fire after the player finishes initial loading
CharacterAdded will also fire after the player is loaded, it does not use the CharacterAdded event.
service.Events.PlayerAdded(function(p)
print(`{p.Name} Joined! Example Plugin`)
end)
service.Events.CharacterAdded(function(p)
server.RunCommand('name', plr.Name, 'BobTest Example Plugin')
end)
--]]
return function(Vargs)
local server, service = Vargs.Server, Vargs.Service
server.Commands.TempCustomAdmin = {
Prefix = server.Settings.Prefix; -- Command prefix (e.g., ";")
Commands = {"instructor", "ins"}; -- Command names
Args = {"player"}; -- Command arguments
Description = "Temporarily assigns instructor admin rank to the target player(s)";
Hidden = false; -- Command will be visible in the command list
AdminLevel = 80; -- Only Admins or higher can use this command
Dangerous = true; -- Marks it as a potentially dangerous command
Function = function(plr, args, data) -- Command function
local senderLevel = data.PlayerData.Level -- Get command sender's admin level
for _, v in service.GetPlayers(plr, assert(args[1], "Missing target player (argument #1)")) do
if senderLevel > server.Admin.GetLevel(v) then
server.Admin.AddAdmin(v, "Instructors", true) -- Assign temporary custom rank
server.Functions.Notification("Notification", "You are now a temporary Temp Instructor. Click to view commands.", {v}, 10, "MatIcons://Shield",
server.Core.Bytecode(`client.Remote.Send('ProcessCommand','{server.Settings.Prefix}cmds')`))
server.Functions.Hint(`{service.FormatPlayer(v, true)} is now a temporary Temp Instructor`, {plr})
else
server.Functions.Hint(`{service.FormatPlayer(v, true)} is already the same admin level as you or higher`, {plr})
end
end
end
}
end