Browse Source

Added RenX_OnPlayerCreate() and RenX_OnPlayerDelete() events.

pull/3/head
JustinAJ 10 years ago
parent
commit
6e2722777b
  1. BIN
      Release/Plugins/RenX.Core.lib
  2. 10
      RenX.Core/RenX_Plugin.cpp
  3. 4
      RenX.Core/RenX_Plugin.h
  4. 6
      RenX.Core/RenX_Server.cpp

BIN
Release/Plugins/RenX.Core.lib

Binary file not shown.

10
RenX.Core/RenX_Plugin.cpp

@ -35,6 +35,16 @@ RenX::Plugin::~Plugin()
} }
} }
void RenX::Plugin::RenX_OnPlayerCreate(Server *, const RenX::PlayerInfo *)
{
return;
}
void RenX::Plugin::RenX_OnPlayerDelete(Server *, const RenX::PlayerInfo *)
{
return;
}
void RenX::Plugin::RenX_OnJoin(Server *, const RenX::PlayerInfo *) void RenX::Plugin::RenX_OnJoin(Server *, const RenX::PlayerInfo *)
{ {
return; return;

4
RenX.Core/RenX_Plugin.h

@ -37,6 +37,10 @@ namespace RenX
class RENX_API Plugin : public Jupiter::Plugin class RENX_API Plugin : public Jupiter::Plugin
{ {
public: public:
/** Non-RCON RenX logs */
virtual void RenX_OnPlayerCreate(Server *server, const PlayerInfo *player);
virtual void RenX_OnPlayerDelete(Server *server, const PlayerInfo *player);
/** Player type logs */ /** Player type logs */
virtual void RenX_OnJoin(Server *server, const PlayerInfo *player); virtual void RenX_OnJoin(Server *server, const PlayerInfo *player);
virtual void RenX_OnPart(Server *server, const PlayerInfo *player); virtual void RenX_OnPart(Server *server, const PlayerInfo *player);

6
RenX.Core/RenX_Server.cpp

@ -254,6 +254,9 @@ bool RenX::Server::removePlayer(int id)
if (node->data->id == id) if (node->data->id == id)
{ {
RenX::PlayerInfo *p = RenX::Server::players.remove(node); RenX::PlayerInfo *p = RenX::Server::players.remove(node);
Jupiter::ArrayList<RenX::Plugin> &xPlugins = *RenX::getCore()->getPlugins();
for (size_t i = 0; i < xPlugins.size(); i++)
xPlugins.get(i)->RenX_OnPlayerDelete(this, p);
delete p; delete p;
return true; return true;
} }
@ -479,6 +482,9 @@ inline RenX::PlayerInfo *getPlayerOrAdd(RenX::Server *server, const Jupiter::Rea
r->isBot = isBot; r->isBot = isBot;
r->joinTime = time(nullptr); r->joinTime = time(nullptr);
if (id != 0) server->players.add(r); if (id != 0) server->players.add(r);
Jupiter::ArrayList<RenX::Plugin> &xPlugins = *RenX::getCore()->getPlugins();
for (size_t i = 0; i < xPlugins.size(); i++)
xPlugins.get(i)->RenX_OnPlayerCreate(server, r);
} }
else if (r->name.size() == 0) r->name = name; else if (r->name.size() == 0) r->name = name;
r->team = team; r->team = team;

Loading…
Cancel
Save