I want to be able to make chat commands that work with multiple parameters. I can do single parameter commands, such as: /kick <plr> or /create <name>, but I want to be able to things such as: /add <plr> <name> or /ban <plr> <name>. I'm trying to accomplish this for my universe place, where each player can have their own place, but also be able to control who can come in it. Much like VIP servers, but more controlled in my honest opinion. :)
You could write a function which separates the input into a table of values (so for example "/kick <plr>" would produce {"/kick", "<plr>"}) and then work on those values. An example of such a function (which is probably much less efficient than what it could be; there are probably better examples out there) is this:
function Split(input) local CurrentWord, ToReturn = "", {} for i = 1, #input do if input:sub(i, i) == " " and CurrentWord ~= "" then table.insert(ToReturn, CurrentWord) CurrentWord = "" else CurrentWord = CurrentWord .. input:sub(i, i) end end table.insert(ToReturn, CurrentWord) return ToReturn end
I'm assuming you know how to make simple chat commands.