mirror of
https://github.com/TES3MP/TES3MP.git
synced 2025-09-29 08:00:56 -04:00
[Server] Implement GetIP API function
This commit is contained in:
parent
1f3cbb46e2
commit
940ae5c2fb
@ -376,6 +376,11 @@ Networking *Networking::getPtr()
|
|||||||
return sThis;
|
return sThis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RakNet::SystemAddress Networking::getSystemAddress(RakNet::RakNetGUID guid)
|
||||||
|
{
|
||||||
|
return peer->GetSystemAddressFromGuid(guid);
|
||||||
|
}
|
||||||
|
|
||||||
PacketPreInit::PluginContainer Networking::getPluginListSample()
|
PacketPreInit::PluginContainer Networking::getPluginListSample()
|
||||||
{
|
{
|
||||||
PacketPreInit::PluginContainer pls;
|
PacketPreInit::PluginContainer pls;
|
||||||
|
@ -23,6 +23,7 @@ namespace mwmp
|
|||||||
void newPlayer(RakNet::RakNetGUID guid);
|
void newPlayer(RakNet::RakNetGUID guid);
|
||||||
void disconnectPlayer(RakNet::RakNetGUID guid);
|
void disconnectPlayer(RakNet::RakNetGUID guid);
|
||||||
void kickPlayer(RakNet::RakNetGUID guid);
|
void kickPlayer(RakNet::RakNetGUID guid);
|
||||||
|
RakNet::SystemAddress getSystemAddress(RakNet::RakNetGUID guid);
|
||||||
|
|
||||||
void processPlayerPacket(RakNet::Packet *packet);
|
void processPlayerPacket(RakNet::Packet *packet);
|
||||||
void processActorPacket(RakNet::Packet *packet);
|
void processActorPacket(RakNet::Packet *packet);
|
||||||
|
@ -154,3 +154,11 @@ void ScriptFunctions::SetRuleValue(const char *key, double value) noexcept
|
|||||||
if (mc)
|
if (mc)
|
||||||
mc->SetRuleValue(key, value);
|
mc->SetRuleValue(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *ScriptFunctions::GetIP(unsigned short pid) noexcept
|
||||||
|
{
|
||||||
|
Player *player;
|
||||||
|
GET_PLAYER(pid, player, "");
|
||||||
|
RakNet::SystemAddress addr = mwmp::Networking::getPtr()->getSystemAddress(player->guid);
|
||||||
|
return addr.ToString(false);
|
||||||
|
}
|
||||||
|
@ -69,6 +69,7 @@ public:
|
|||||||
static void FreeTimer(int timerId) noexcept;
|
static void FreeTimer(int timerId) noexcept;
|
||||||
static bool IsTimerElapsed(int timerId) noexcept;
|
static bool IsTimerElapsed(int timerId) noexcept;
|
||||||
|
|
||||||
|
static const char* GetIP(unsigned short pid) noexcept;
|
||||||
static void Kick(unsigned short pid) noexcept;
|
static void Kick(unsigned short pid) noexcept;
|
||||||
static const char *GetServerVersion() noexcept;
|
static const char *GetServerVersion() noexcept;
|
||||||
static const char *GetProtocolVersion() noexcept;
|
static const char *GetProtocolVersion() noexcept;
|
||||||
@ -105,6 +106,7 @@ public:
|
|||||||
{"SetRuleValue", ScriptFunctions::SetRuleValue},
|
{"SetRuleValue", ScriptFunctions::SetRuleValue},
|
||||||
{"CleanChatByPid", ScriptFunctions::CleanChatByPid},
|
{"CleanChatByPid", ScriptFunctions::CleanChatByPid},
|
||||||
{"CleanChat", ScriptFunctions::CleanChat},
|
{"CleanChat", ScriptFunctions::CleanChat},
|
||||||
|
{"GetIP", ScriptFunctions::GetIP},
|
||||||
|
|
||||||
ACTORAPI,
|
ACTORAPI,
|
||||||
BOOKAPI,
|
BOOKAPI,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user