Plugins - fatesc/fates-admin GitHub Wiki

So you may be wondering how to write plugins that extend the capability of Fate's admin? Well, it's fairly simple and easy to get started.

Before we start

We recommend you read the Lua 5.1 documentation before developing your first plugin.

Usage and using

It's extremely simple to load and use plugins. To get started, locate your exploit's workspace folder.

  • go to fates-admin
  • throw your plugins in the plugins folder (make sure it is a .lua file or it'll be ignored)

use the command refreshplugins or re-execute the script and all the plugins in that file will automatically load.

Usage and using End


Disabling plugins

  • load the config UI
  • navigate yourself to the plugins section
  • click "enabled" on the plugin you'd like to disable, once the text is "disabled" the plugin will be disabled and saved in config.

OR

  • go to your exploits workspace folder
  • go to fates-admin/plugins/plugin-conf.json
  • add a plugin name to the DisabledPlugins list
  • re-execute

Disabling plugins End


Making

To make a fate's admin plugin it's relatively easy.

local FatesAdminPlugin = {
    ["Name"] = "PluginName", -- set the name of the plugin
    ["Author"] = "fate", -- set the author of the plugin (optional)
    ["Init"] = function() -- init function of when the plugin loads 
        print("Plugin Loaded!");
    end,
    ["Commands"] = { -- table of commands (so you can set more than 1)
        {
            ["Name"] = "CommandName", -- set the command name
            ["Description"] = "Command Description", -- set the command description
            ["Aliases"] = {"CommandAlias1", "CommandAlias2"}, -- set aliases for the command
            ["Requirements"] = {}, -- requirements for the command (scroll down or more information)
            ["Func"] = function(Caller, Args, CommandEnv) 
                print("Command Ran!");
                
                return "Command has been loaded" -- return a string if you'd like to notify the user
            end
        },

        {
            -- you can add more commands in only a plugin!
        }
    }
}

return FatesAdminPlugin -- return the plugin so it can be used

Requirements Table

We use the command requirements table so we know what we need to run a command. You can fill your requirements with a function e.g:

Requirements = {
    function() -- the function you need to fulfill to use the command
        return true -- this function will now pass a requirement
    end,
    function()
        return false -- this function won't pass a requirement, the command will now not be able to run (https://i.imgur.com/40jI8fN.png)
    end
}

You can also add the number of arguments for the command to have mandatory e.g:

Requirements = {
    "2" -- two arguments will be needed to run the command
}

There is also default requirements made that you can use as a number e.g:

Requirements = { 3, 2 } -- requirements 3 (need to be spawned in) and 2 (need to be r6) will be needed to run this command

-- all default requirements:
local CommandRequirements = {
    [1] = {
        Func = HasTool,
        Message = "You need a tool for this command"
    },
    [2] = {
        Func = isR6,
        Message = "You need to be R6 for this command"
    },
    [3] = {
        Func = function()
            return GetCharacter() ~= nil
        end,
        Message = "You need to be spawned for this command"
    }
}

Making End


Plugin Settings / Config

Plugins also come with a config section:

  • PluginDebug - boolean
  • PluginsEnabled - boolean
  • SafePlugins - boolean
  • DisabledPlugins - table

PluginDebug

With this setting enabled, you'll receive notifications about your plugins loading/erroring (recommended for plugin developers)

PluginsEnabled

With this setting enabled, you'll have plugins enabled and working. With this setting disabled, you'll not be able to use plugins (they won't load)

SafePlugins

Although this is recommended to keep on, whilst disabled you are vulnerable for your plugins to execute anything they want. (scroll down for more information)

DisabledPlugins

A table of disabled plugins you would like, has to be the plugin name and not the plugin file.

Plugins Config UI Currently look like this:

Plugin Conf UI

Plugin Settings / Config End


Command Environment

As you've probably seen in the plugin example, there is a "CEnv" argument in the command function.

What is the "CEnv"?

It's the command environment.

What can it be used for?

It can be used for custom functions/tools that are provided for plugins

Is this environment safe?

Yes, this environment removes your executors' functions that can be malicious

What custom functions/tools are there?

  • Services - Services table
local ReplicatedStorage = Services.ReplicatedStorage
local Players = Services.Players

Why is this recommended to use?

using a table of cached services would be faster than normal.

  • LocalPlayer - Your LocalPlayer
  • GetPlayer - Gets the Player(s) from a string
local AllPlayers = GetPlayer("all");
local RandomPlayer = GetPlayer("random");
local FarthestPlayer = GetPlayer("farthest");
-- multiple players can also be selected by seperating the arg with a "," e.g
local TwoRandomPlayersAndFarthestPlayer = GetPlayer("random,random,farthest");

arguments: (all/others/me/random/farthest/nearest/npcs/enemies/allies)

  • GetCharacter - Gets the Character of the first arg (player) (LocalPlayers Character if no args)
local LocalCharacter = GetCharacter();
  • GetRoot - Gets the Root of the first arg (player) (LocalPlayers root if no args)
  • GetMagnitude - Gets the magnitude distance from 2 players
  • GetHumanoid - Gets the Humanoid of the first arg (player) (LocalPlayers Humanoid if no args)
  • GetCommandEnv - Gets the environment of the first arg (command) and returns it
  • ProtectInstance - Protects the instance from any Index/ChildAdded/DescendantAdded/FindFirstChild/GetChildren methods
  • ReplaceCharacter - Replaces your character (used in the 're' command)
  • ReplaceHumanoid - Replaces your humanoid which can be used for attach methods
  • GetCorrectToolWithHandle - Finds a tool with a handle and remove all scripts/cameras/sounds
  • DisableAnimate - Removes animation on your character
local ProtectedBodyGyro = ProtectInstance(Instance.new("BodyGyro"));
ProtectedBodyGyro.Parent = GetRoot();
  • SpoofInstance - Spoofs the first arg (Instance) to the second arg (Instance)
  • SpoofProperty - Spoofs the Instance's (first arg) Property (second arg) to return a value (3rd arg - optional). This also does not fire any .Changed or .GetPropertyChangedSignal events
local Humanoid = GetHumanoid();
SpoofProperty(Humanoid, "WalkSpeed", 30);
Humanoid.WalkSpeed = 100 -- if a game index's this it'll return 30
  • ExecuteCommand - Executes first arg (command) with the args (table) as the second argument with the command caller as the third arg (optional)
  • isR6 - Returns true if the first arg (Player) is in RigType R6
  • Notify - Notifies the first arg (Player) with second arg (text) as a title; third arg (text) as the message with a duration of the fourth arg (number)
Notify(LocalPlayer, "Title", "Text", 10);
  • Request - Your request function (see your exploits request function documentation on that)
  • CThread - Creates a new coroutine and returns a function to resume the coroutine
  • AddConnection - Adds a connection to the connections table, it is very recommended to use this when creating events so that we can kill the script with ease.
local Connection = AddConnection(Services.Players.PlayerAdded:Connect(function(Player)
    print(Player.Name);
end));
  • filter - filters a table with your second arg (callback table)
local Table = {1, 2, 3, 4, 5}
local FilteredTable = filter(Table, function(k, v) -- make the table only even numbers
    return v % 2 == 0 
end)
  • map - Creates a new table populated with the results of calling a provided function on every element in the calling array.
local Table = {1, 2, 3, 4, 5}
local DoubleFiguresTable = map(Table, function(k, v) -- make the table double all it's integers
    return v * 2
end)

Others

  • Drawing - Exploits Drawing Library
  • decompile - decompiles a script (exploit must have luau decompiler)
  • getnilinstances - gets all the nil instances in the game
  • getinstances - gets all the instances in the game