I am making a simple ban command for a project. However it’s turning out to be “not so simple”.
concommand.Add("banplayer", function( ply, cmd, args, str ) local banTableData = string.Explode( " ", str ) local player_id = banTableData local banTime = banTableData local banReason = banTableData PrintTable(banTableData) print (banReason) end)
Also, ignore my prints, I was just looking in console at what it was returning. Which is how I found the issue.
What I’m trying to achieve here, is when someone types “banplayer steamid bantime banreason”
it will do a ban (I can do the ban action part), however, if I were to just use
args etc, this breaks the SteamID up to the first colon
Example: args returns STEAM_0
If I do it as breaking the table down into a string with explode, it works fine, however, since my explode def is a space, it now takes the ban reason, and breaks it down. So now I can only have a “one word ban reason”.
Obviously enclosing the ban reason in quotations does nothing, because the explode is on the space.
Any ideas, or an easier way to do this?
Thanks in advance.