chat

register_command

Register a command on the server, connected players will be able to call it from the chat box.

chat.register_command(name --[[ string ]], handler --[[ func ]])

Example:

chat.register_command("test", function(src, args)

    -- This message is showing in the server console.
    print("Command 'test' has been called by " ..src.. " with args "..args)
end)

send_message

Send a message to a specific player.

chat.send_message(src --[[ integer ]], msg --[[ string ]])

Example:

chat.register_command("test", function(src, args)

    -- This message is showing on the client chatbox.
    chat.send_message(src, "Command 'test' has been sent back to src player !")
end)

broadcast_message

Send a message to all connected players.

chat.broadcast_message(msg --[[ string ]])

Example:

chat.register_command("test", function(src, args)

    -- This message is showing on all the clients chatbox.
    chat.broadcast_message("Command 'test' has been sent to all connected players !")
end)

Last updated