Well, maybe this post can help you out a bit!
I see you want to create an information
command with the custom prefix !
(which is also Basic Admin Essential’s default action-prefix). I believe you’d want it to run the message
command and display information.
Parameters
Basic Admin Essentials runs plugins by giving them an execution-function, where it provides a table with the following data.
{essentialsEvent, essentialsFunction, returnPermission, Commands, sysTable.Prefix, sysTable.actionPrefix, returnPlayers, cleanUserData, pluginEvent}
This may seem like a lot of stuff, but let me break it down for you.
-
essentialsEvent
and essentialsFunction
are basically just the RemoteEvent and RemoteFunction that Basic Admin uses to communicate with it’s client script.
-
returnPermission
is a function that returns the permissions of the given player.
-
sysTable
is what’s known as the SystemTable, which is basically a table where data is stored, so sysTable.Prefix
is the prefix (default is :
), and sysTable.ActionPrefix
is the action prefix (default is !
).
-
returnPlayers
is the “GetPlayer” function, which takes the speaker of the command and the call, and returns a list of targets for the command to be executed on. For example, if i entered a player and “all”, it’d return all the players in the server.
-
cleanUserData
is just a function that cleans the user’s data.
-
pluginEvent
is a bindable event that is fired whenever something happens in the core.
Note, all these things are in an array so you’ll have to index them by their number.
Returns
Basic Admin Essentials also expects a number of things to be returned by the plugin. It expects the command’s name, execution function, level, prefix, and description. That’s all
Now that we’ve covered how to make plugins, let’s talk more about the execution-function. The execution-function is ran whenever the player calls the command. It has only 1 parameter, which is a table with holds a variety of data. It follows the following format:
{Player, Segments}
Let’s break this down real quick
-
Player
is the player who is the speaker of the command
-
Segments
is an array of segments of the command. For example, if I entered the command :tp all me
, the segments would be {tp, all, me}
Making your command
Here’s a quick execution-function I’ve made for you.
local information = 'Replace this with your information!'
local pluginFunction = function(Args)
local Player = Args[1]
remoteEvent:FireClient(Player, 'Message', 'Information', information)
end
In total, the whole plugin would look like this:
local Plugin = function(Data)
local remoteEvent = Data[1]
local pluginName = "information"
local pluginPrefix = "!"
local pluginLevel = 1
local pluginUsage = ""
local pluginDescription = "Gives you information"
local information = "Your information here!"
local pluginFunction = function(Args)
local Player = Args[1]
remoteEvent:FireClient(Player, 'Message', 'Information', information)
end
pluginDescription = pluginName .. " " .. pluginDescription
return pluginName, pluginFunction, pluginLevel, pluginPrefix, {pluginName, pluginUsage, pluginDescription}
end