1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-11 17:51:04 +00:00

Add chat message callback and send functions

This commit is contained in:
Perttu Ahola 2011-11-27 19:39:36 +02:00
parent ab3911ba9e
commit 05df2ee8a4
5 changed files with 98 additions and 1 deletions

View file

@ -3422,6 +3422,13 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
// Get player name of this client
std::wstring name = narrow_to_wide(player->getName());
// Run script hook
bool ate = scriptapi_on_chat_message(m_lua, player->getName(),
wide_to_narrow(message));
// If script ate the message, don't proceed
if(ate)
return;
// Line to send to players
std::wstring line;
// Whether to send to the player that sent the line