Basic Admin Custom Commands | Argument Help
Hello wonderful developers and scripters. I've been working with basic admin-plugins recently (again) and trying to create a warning command (again). When I first made this it had no warning argument, so I tried to make one however it only takes the first word.
Issue
I would use the command: `warn usedspxse trolling baristas.` it would send them the notification of 'trolling', instead of the full 'trolling baristas.'
My Script:
My script is below any help is appreciated.
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 = 'warn'
local pluginPrefix = Prefix
local pluginLevel = 2
local pluginUsage = "reason" -- leave blank if the command has no arguments
local pluginDescription = "Warn users for violating rules!"
-- Example Plugin Function --
local function pluginFunction(Args) -- keep the name of the function as "pluginFunction"
local Player = Args[1]
local Victims = returnPlayers(Player,Args[3],Args[2]) if not Victims then return end -- this will ignore the command if you're not include the player(s).
local Reason = Args[4]
for a,b in next,Victims do
remoteEvent:FireClient(b, 'PM', 'System', 'You have been warned by ' .. Player.Name .. '. This is warning ' .. game.Players[b.Name].Warns.Value +1 .. '/3.' .. 'You were warned for: ' ..Reason)
print(game.Players[b.Name].Warns.Value)
game.Players[b.Name].Warns.Value = game.Players[b.Name].Warns.Value + 1
print(game.Players[b.Name].Warns.Value)
if game.Players[b.Name].Warns.Value >= 3 then
game.Players[b.Name]:Kick("\n You have reached the maxium amount of warnings and have been automatically disconnected from the server!")
end
end
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
also yes I do see the issue with no space before the reason I’ll fix it shortly.
thanks,
UsedSpxse, Chairman of Popsiz Parlor
any help is appreciated!