diff options
| -rw-r--r-- | gamemode/chatcommands.lua | 28 | ||||
| -rw-r--r-- | gamemode/server/database.lua | 1 |
2 files changed, 28 insertions, 1 deletions
diff --git a/gamemode/chatcommands.lua b/gamemode/chatcommands.lua index 9989054..39260a3 100644 --- a/gamemode/chatcommands.lua +++ b/gamemode/chatcommands.lua @@ -1,6 +1,32 @@ function GM:PlayerSay( ply, text, teamonly ) - local args = string.Explode( " ", text ) + local args = {} + args[1] = "" + local parsestring = string.ToTable(text) + local inquote = false + local argpart = 1 + print("Parseing: " .. text) + for k,v in pairs(parsestring) do + print("at " .. k .. ":" .. v) + if(v == " ") then + print("Hit delimiter") + if(inquote) then + args[argpart] = args[argpart] .. v + else + argpart = argpart + 1 + args[argpart] = "" + end + elseif(v == "\"") then + print("Hit quote") + inquote = !inquote + else + print("Adding to string") + args[argpart] = args[argpart] .. v + end + end + print("Finished, args:") + PrintTable(args) + --local args = string.Explode( " ", text ) if ( args == nil ) then args = {} end if ( teamonly ) then diff --git a/gamemode/server/database.lua b/gamemode/server/database.lua new file mode 100644 index 0000000..5ebce8e --- /dev/null +++ b/gamemode/server/database.lua @@ -0,0 +1 @@ +--Provides an interface to store data in a database of some kind |
