-
Notifications
You must be signed in to change notification settings - Fork 0
Documentation
We recommend you to first visit Getting Started, before getting deeper into the logic.
- ServerCommand Layout is the important thing to make Custom Command.
- Default ServerCommand Layout:
{
Command: string = "Name",
RequiredRank: number = 0,
Alias: array = {"Name2", "SecondName"},
UppercaseMatters: bool = false,
Loop: bool = false,
Client: bool = false,
ClientOnly: bool = false,
CallerClient: bool = false,
Arguments: array = {"Player;", "number;"},
References: array = {"Player", "Studs"},
ArgPermissions: array = {4},
Revoke: array = {"UnName", "UnName2"},
UnDo: (Caller, Arguments) = ...,
Function: (Caller, Arguments) = ...,
PreFunction: (Caller, Arguments) = ...,
}Explanation of every thing inside of the Layout:
Main name of the command which will show up in the Panel Commands Section.
Required rank to use the command.
Secondary names of the command that player can use.
Determines if Parser will care of incorrectly spelled case or not.
Determines if the command will run again after player's death or not.
Returns command to the client. Mostly useless.
Determines if the command is located at the ClientCommands and has ClientCommand Layout.
Determines if the command will run only on caller's computer.
If false and Argument[1] is a Player, will run on this player's computer.
Arguments of the command.
Will give Arguments as an array as a second argument in UnDo, Function, PreFunction functions.
See more about arguments here.
Will replace argument's name into the one, located here.
All of the names needs to be positioned right as in the Arguments array.
Sets rank for usage of the argument.
All of the numbers needs to be positioned right as in the Arguments array.
Same as Alias, but used for UnDo.
Arguments: Caller: Player, Arguments: array.
If ClientOnly is set to true, leave this method as boolean.
Main method of undoing the command.
If Loop is true, command will stop rerunning after undo.
Arguments: Caller: Player, Arguments: array.
If ClientOnly is set to true, leave this method as nil.
Main function of the command.
Argument: Caller: Player Arguments: array.
If ClientOnly is set to true, leave this method as nil. Client command doesn't have PreFunction.
Will run before command's main function.
Before running, Main Function will wait for PreFunction end.
- ClientCommand Layout is the important thing to make Custom Command on a client.
- Needs to have
ServerCommand Layouton the server. - Default ClientCommand Layout:
ClientCommands.CommandName = function(Caller, Arguments)
-- YOUR CODE HERE.
end
ClientCommands.UnCommandName = function(Caller, Arguments)
-- YOUR CODE HERE.
endExplanation of the layout:
Name of the command's function.
Needs to be identical to the ServerCommand Layout's command name.
Argument: Caller: Player, Arguments: array.
MainFunction of the command like in the ServerCommand Layout, but changes will be seen only for the client.
UnDo of the command.
If your function has UnDo, you must have name of the function like this: Un{NAME}. (Un must be the prefix.)
If UnDo set to false on the ServerCommand Layout, no need to have it here.
Argument: Caller: Player, Arguments: array.
If UnDo set to false on the ServerCommand Layout, no need to have it here.
UnDo function of the command like in the ServerCommand Layout, but changes will be seen only for the client.
An array, that will be second argument for the UnDo, Function and PreFunction of the command. Arguments will be placed order exactly like you placed them in the ServerCommand Layout Arguments table.
Needs to have Argument Types to work properly.
On the moment there's 7 arguments.
Here's what they return in an array:
Returns Player instance.
Returns Tool instance.
Returns rank id. (Rank Id - number from 1 to 5.)
Returns descendant of the workspace.
Returns name of the statistic in the player's leaderstats.
Due to limitations, we can only give a name of statistic, and not the object.
Use this to get statistic:
local Statistic = player:FindFirstChild(StatName, true)Returns number.
If nil, will be set to 0.
Returns string.
If nil, will be set to empty string.
Argument Type is a symbol, placed after an argument.
Example:
"Player;"
"Player@"
"Player!"
...etc.Default argument.
Only works with Player argument.
Determines if player needs to be online or not.
Determines if argument is optional or not.
Arguments as Tool, Rank, Object, Stat will return nil if set to true.
Only works with Player argument.
Player is an optional argument, but if given, player needs to be online.
Only works with string argument.
Filters the string, using TextService.
If filtering failed, will return [Unable to filter] as a string.
Only works with Rank argument.
Rank can't be higher or equal to player's rank.
Only works with Object argument.
Object must be certain class.
Example:
"Object:Folder"
"Object:Part"one argument can be multiple arguments and types.
Example:
"string#|number;"
"Stat?|Tool;"If you ever wanted to run a command in your own script, :GetParser() method will help you.
:GetParser() method is located at MainModule of the GAdmin.
Example:
task.wait(.5)
local GAdmin = require(_G.GAdmin)
local Parser = GAdmin:GetParser()You need to use task.wait() in the start for GAdmin to appear in the _G.
But how to actually use Parser?
Main method of Parser is :TriggerCommand(Caller, Command, Arguments).
But Player is the first argument, so you need to use method :RunOnComplete() of MainModule:
task.wait(.5)
local GAdmin = require(_G.GAdmin)
local Parser = GAdmin:GetParser()
GAdmin:RunOnComplete(function()
for i, player in ipairs(game.Players:GetPlayers()) do
Parser:TriggerCommand(player, "about", {player})
end
end)RunOnComplete method runs after GAdmin has been fully configurated.
Arguments: Caller: Player, Command: string, Arguments: array.
Arguments is an array table, which must contain arguments that was written in ServerCommand Layout.
If you don't actually want to type arguments yourself, use method :Parse() of Parser.
It's Deprecated because it can identify string argument as another command. Use :Parse() instead.
Arguments: Caller: Player, Message: string, NoPrefix: boolean.
Message - String of commands and arguments. Example: ;kill me ;view me ;god me.
NoPrefix - If set to true, you can type commands in Message without prefixes. (Example: kill me view me god me)
Returns MessageData type, that can be used in :TriggerCommands() method of Parser:
local MessageData = Parser:ParseMessage(Caller, "fly", true)
Parser:TriggerCommands(Caller, MessageData)Arguments: Caller: Player, Message: string, IgnoreCustomPrefix: boolean.
Message - String of commands and arguments. Example: ;kill me ;view me ;god me.
IgnoreCustomPrefix - Automaticly sets prefix in the message to default prefix (Settings.DefaultPrefix).
Returns MessageData type, that can be used in :TriggerCommands() method of Parser:
local MessageData = Parser:Parse(Caller, ";fly", true)
Parser:TriggerCommands(Caller, MessageData)Arguments: Caller: Player, Data: MessageData.
Used to trigger one command, or multiple of them.
Framework - main module on the client, which contains all of the important for GAdmin Panel methods.
You can get Framework in your own LocalScript with _G:
repeat task.wait() until _G.GFramework
local Framework = require(_G.GFramework)