minetest.chat_send_player

From Minetest Developer Wiki
Jump to: navigation, search

Contents

Syntax

Description

Send a chat message to a specific player.

Examples

Send a message to player "foobar"

minetest.chat_send_player("foobar", "Hello, foobar!")

Send message to player initiating command

minetest.register_chatcommand("who", {
    params = "",
    description = "List all connected players.",
    func = function(name)
        connected_players_string = 'Players online: '
 
        for _,player in ipairs(minetest.get_connected_players()) do
            connected_players_string  =  connected_players_string .. 
                                         player:get_player_name() .. 
                                         ' '
        end
 
        minetest.chat_send_player(name, connected_players_string)
 
        return true
    end
})
Personal tools
Namespaces

Variants
Actions
Navigation
API
Toolbox