Comms Not Working?

Hello, I was working on adding a Comms function on my StarwarsRP server, and this is what I got.



local function PlayerComms(ply, args)
    if args == "" then
        DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", "argument", ""))
        return ""
    end
    local DoSay = function(text)
        if text == "" then
            DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", "argument", ""))
            return
        end
        for k,v in pairs(player.GetAll()) do
            local col = team.GetColor(ply:Team())
            DarkRP.talkToPerson(v, col, DarkRP.getPhrase("[Comms]") .. " " .. ply:Nick(), Color(255, 250, 162, 255), text, ply)
        end
    end
    return args, DoSay
end
DarkRP.defineChatCommand("comms", PlayerComms, 1.5)


This is placed inside /gamemodes/starwarsrp/gamemode/modules/chat/sh_chaatcommands.lua

I also have the following in the same file:



DarkRP.declareChatCommand{
    command = "comms",
    description = "Use Communications",
    delay = 1.5
}


[editline]30th October 2017[/editline]

It isnt working. The LUA error is;

Am I doing something wrong?

(Just added this to the main post so you dont have to scroll to see it)

What’s your issue? You just posted your code.

[editline]30th October 2017[/editline]

If the issue is about your command not existing, you can try adding a print in your file and see if it’s being ran.

I found the LUA error, the error is as follows.

Chat commands in DarkRP must be defined serverside. Just make a new file called sv_chatcommands and add the chat command serverside. Make sure you KEEP the declareChatCommand shared, however.