Hi. I'm making a game with a custom adonis command that needs to know which player eecuted the command.. It is a setrank command, and here is the script:
server = nil -- Mutes warnings about unknown globals service = nil return function() server.Commands.ExampleCommand = { Prefix = '!'; Commands = {"setrank", "setgroup"}; Args = {"arg1"}; Description = "Set group tag."; Hidden = false; Fun = false; AdminLevel = "Players"; Function = function(plr,args) -- Find Player here end } end
It gives the player with function(plr,args), heres an example of how to use it:
server = nil -- Mutes warnings about unknown globals service = nil return function() server.Commands.ExampleCommand = { Prefix = '!'; Commands = {"setrank", "setgroup"}; Args = {"arg1"}; Description = "Set group tag."; Hidden = false; Fun = false; AdminLevel = "Players"; Function = function(plr,args) print(plr.Name .. ' executed the command: !setrank') end } end
Also, if you are going to also ask about how to get the player specified it would be args[1], for example:
server = nil -- Mutes warnings about unknown globals service = nil return function() server.Commands.ExampleCommand = { Prefix = '!'; Commands = {"setrank", "setgroup"}; Args = {"arg1"}; Description = "Set group tag."; Hidden = false; Fun = false; AdminLevel = "Players"; Function = function(plr,args) print(plr.Name .. ' executed the command: !setrank on ' .. tostring(args[1])) end } end