I have an question,
Recently I saw an post on the DevForum called “Basic Admin Essentials complete guide”, in there I scrolled down and saw an dropdown with “Sending PMs through a custom command” (The Ultimate Basic Admin Essentials Guide - Community Tutorials - Developer Forum | Roblox) and there I saw that you can create an command that will not allow players to reply to it, but I dont understand how to do that. This is what is stated there and here are the scripts that are in there:
“Sending BAE PMs to multiple players is possible using the Commands table that is automatically passed into Basic Admin Plugins. Let’s take a look at how to get that function, and how to use it to send PMs.”
“For my example, I’m going to make a command to send a PM to all the admins in the game. I know that this is obsolete as you can just do “:pm admins”, though for proof of concept let’s figure out how to make this command.”
“This is slightly more complex because we want the PMs to act as real Basic Admin PMs that can be replied to. If you don’t want your PMs to be able to be replied to, you can simply fire the RemoteEvent as we do in step 1 but exclude the “ID” argument.”
“1. The existing PM command in the MainModule is not suitable for our needs here, so let’s create our own. We’re going to add the following code directly below the function that starts around Line 900 called “Funcs.PM”.
function Funcs.CustomPM(Args)
local playerSending = Args[1]
local players = Args[2]
local message = Args[3]
if playerSending and players and message then
for _,v in players do
local sending = true
local filtered, filterResult = cleanUserData(message, playerSending, v)
if filtered and filterResult then
local newId = generateID()
sysTable.outboundMessages[newId] = v
remoteEvent:FireClient(v, "PM", playerSending.Name, filterResult, nil, newId)
end
end
end
end
“Your MainModule will now have this function directly underneath the real PM function:”
“ 2. Near the bottom of the MainModule in the commands table, add the following code underneath the Commands table:”
local customFuncs = {
{"custompm", sysTable.Prefix, Funcs.CustomPM, #sysTable.Permissions, { "custompm", "", "" }},
}
“The reason we’re putting this in a separate table is because we don’t want this command to be able to be ran through the command bar, though it should be able to be used by other scripts. You should now see your custom PM function at the bottom of the commands table:”
“ 3. Finally, let’s add our new
customFuncs
table to our list of arguments when requiring the Plugin script. With this done, we can then use the custom PM function in a plugin.”
Now all we have to do in our plugin is use that function. See the code below for a basic “PM admins” plugin
--[[
____
/\ _`\ __
\ \ \L\ \ __ ____/\_\ ___
\ \ _ <' /'__`\ /',__\/\ \ /'___\
\ \ \L\ \/\ \L\.\_/\__, `\ \ \/\ \__/
\ \____/\ \__/.\_\/\____/\ \_\ \____\
\/___/ \/__/\/_/\/___/ \/_/\/____/
Admin Essentials v2
Plugin Documentation
*coming soon^tm
If you have any questions regarding Plugins, contact TheFurryFish.
--]]
local Plugin = function(...)
local Data = {...}
-- Included Functions and Info --
local remoteEvent = Data[1][1]
local remoteFunction = Data[1][2]
local returnPermissions = Data[1][3]
local Commands = Data[1][4]
local Prefix = Data[1][5]
local actionPrefix = Data[1][6]
local returnPlayers = Data[1][7]
local cleanData = Data[1][8] -- cleanData(Sender,Receiver,Data)
-- Practical example, for a gui specifically for a player, from another player
-- cleanData(Sender,Receiver,"hi") -- You need receiver because it's being sent to everyone
-- Or for a broadcast (something everyone sees, from one person, to nobody specific)
-- cleanData(Sender,nil,"hi") -- Receiver is nil because it is a broadcast
-- Plugin Configuration --
local pluginName = 'pmadmins'
local pluginPrefix = Prefix
local pluginLevel = 1
local pluginUsage = "" -- leave blank if the command has no arguments
local pluginDescription = "Sends a PM to all admins."
-- Example Plugin Function --
local function pluginFunction(Args) -- keep the name of the function as "pluginFunction"
local playerRunningCommand = Args[1]
-- get custom PM command
local customCommands = Data[1][10]
local pmCommand
for _,info in customCommands do
if info[1] == "custompm" then
pmCommand = info[3]
break
end
end
-- filter admins
local admins = {}
for _,v in game.Players:GetPlayers() do
if returnPermissions(v) >= 2 then -- check if they have the "Administrator" perm level
table.insert(admins, v)
end
end
-- try to send pm to players
return pmCommand({ playerRunningCommand, admins, table.concat(Args, " ", 3) })
end
-- Return Everything to the MainModule --
local descToReturn
if pluginUsage ~= "" then
descToReturn = pluginPrefix..pluginName..' '..pluginUsage..'\n'..pluginDescription
else
descToReturn = pluginPrefix..pluginName..'\n'..pluginDescription
end
return pluginName,pluginFunction,pluginLevel,pluginPrefix,{pluginName,pluginUsage,pluginDescription}
end
return Plugin
“Members who receive the PM can now reply to it like a real PM, which is much better than other solutions that members have suggested previously. As stated before, if you want people not to be able to reply to PMs, you can just fire the PM remote to create a “fake PM” with the ID parameter left out.”
So, my question is, how do I make it so all admins / receivers will not be able to reply to it? They say “you can fire the PM remote to create a fake PM with the ID parameter left out. | How do I do that?