mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-05 06:50:04 +00:00
Added Player:message()
This commit is contained in:
parent
b25b229eb2
commit
2090062c75
@ -5,6 +5,7 @@
|
|||||||
#include "core/CNProtocol.hpp"
|
#include "core/CNProtocol.hpp"
|
||||||
#include "Player.hpp"
|
#include "Player.hpp"
|
||||||
#include "PlayerManager.hpp"
|
#include "PlayerManager.hpp"
|
||||||
|
#include "Chat.hpp"
|
||||||
|
|
||||||
#define LIBNAME "Player"
|
#define LIBNAME "Player"
|
||||||
#define PLRGONESTR "Player doesn't exist anymore, they left!"
|
#define PLRGONESTR "Player doesn't exist anymore, they left!"
|
||||||
@ -168,9 +169,21 @@ static int plr_teleport(lua_State *state) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int plr_msg(lua_State *state) {
|
||||||
|
CNSocket *sock = grabSock(state, 1);
|
||||||
|
const char *msg = luaL_checkstring(state, 2);
|
||||||
|
|
||||||
|
// sanity check
|
||||||
|
if (sock != NULL)
|
||||||
|
Chat::sendServerMessage(sock, std::string(msg));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static const luaL_Reg plr_methods[] = {
|
static const luaL_Reg plr_methods[] = {
|
||||||
{"kick", plr_kick},
|
{"kick", plr_kick},
|
||||||
{"teleport", plr_teleport},
|
{"teleport", plr_teleport},
|
||||||
|
{"message", plr_msg},
|
||||||
{0, 0}
|
{0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user