This look right?

Sorry i am not the best at coding could someone see if i did my table right. If i only wanted to do one chat command this would of been easy but i thought it would be nice to add in a table with a bunch of chat commands that are similar.

rtv = {


hook.Add(“PlayerSay”, “ChatCommand”, function(pl, text, _)
local chat = (rtv)
if text == “chat” then


No, don’t do that. Here, use this as an example:


function COMMANDS:New( cmd, func )
if ( !cmd or !func ) then return end

self[ cmd ] = func


function GM:PlayerSay( player, text, public)

for k,v in pairs ( COMMANDS ) do

local cmd_len = string.len(tostring(k))

if ( string.sub(k, 1, cmd_len) == string.sub(text, 1, cmd_len) ) then
	local raw = string.sub(text, cmd_len + 1)
	v( player, raw );
	return ""

Talk( player, 300, player:Nick() … " says ‘" … text … "’" )
return “”

Adding a new command,:

COMMANDS:New( “/all”, function( playerr, raw )
for k,v in pairs( player.GetAll() ) do
print("[all]" … raw );

You should probably string.low the command to check incase of case sensitivity.

you are really throwing me for a loop with that man haha, i can only make sense of a small fraction of that. Is mine really that far off? i know it worked before i added in the table.