Skip to content

Commit 0d3391f

Browse files
committed
feat(events): OnClientPutInServer
1 parent 80bd1a1 commit 0d3391f

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
Over here will be noted all the update change logs.
44

5+
## v1.6.27 - [Release](https://github.com/swiftly-solution/swiftly/releases/tag/v1.6.27)
6+
7+
### Events
8+
9+
- [OnClientPutInServer](https://swiftlys2.net/plugin-docs/scripting/events/core/onclientputinserver)
10+
511
## v1.6.26 - [Release](https://github.com/swiftly-solution/swiftly/releases/tag/v1.6.26)
612

713
### Websockets

src/core/entrypoint.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ SH_DECL_HOOK3_void(ICvar, DispatchConCommand, SH_NOATTRIB, 0, ConCommandRef, con
7373
SH_DECL_HOOK6(IServerGameClients, ClientConnect, SH_NOATTRIB, 0, bool, CPlayerSlot, const char*, uint64, const char*, bool, CBufferString*);
7474
SH_DECL_HOOK7_void(ISource2GameEntities, CheckTransmit, SH_NOATTRIB, 0, CCheckTransmitInfo**, int, CBitVec<16384>&, const Entity2Networkable_t**, const uint16_t*, int, bool);
7575
SH_DECL_HOOK6_void(IServerGameClients, OnClientConnected, SH_NOATTRIB, 0, CPlayerSlot, const char*, uint64, const char*, const char*, bool);
76+
SH_DECL_HOOK4_void(IServerGameClients, ClientPutInServer, SH_NOATTRIB, 0, CPlayerSlot, char const*, int, uint64);
7677
SH_DECL_HOOK5_void(IServerGameClients, ClientDisconnect, SH_NOATTRIB, 0, CPlayerSlot, ENetworkDisconnectionReason, const char*, uint64, const char*);
7778
SH_DECL_HOOK8_void(IGameEventSystem, PostEventAbstract, SH_NOATTRIB, 0, CSplitScreenSlot, bool, int, const uint64*, INetworkMessageInternal*, const CNetMessage*, unsigned long, NetChannelBufType_t);
7879
SH_DECL_HOOK3(IVEngineServer2, SetClientListening, SH_NOATTRIB, 0, bool, CPlayerSlot, CPlayerSlot, bool);

src/server/player/manager.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
SH_DECL_EXTERN3_void(IServerGameDLL, GameFrame, SH_NOATTRIB, 0, bool, bool, bool);
1313
SH_DECL_EXTERN6(IServerGameClients, ClientConnect, SH_NOATTRIB, 0, bool, CPlayerSlot, const char*, uint64, const char*, bool, CBufferString*);
1414
SH_DECL_EXTERN6_void(IServerGameClients, OnClientConnected, SH_NOATTRIB, 0, CPlayerSlot, const char*, uint64, const char*, const char*, bool);
15+
SH_DECL_EXTERN4_void(IServerGameClients, ClientPutInServer, SH_NOATTRIB, 0, CPlayerSlot, char const*, int, uint64);
1516
SH_DECL_EXTERN5_void(IServerGameClients, ClientDisconnect, SH_NOATTRIB, 0, CPlayerSlot, ENetworkDisconnectionReason, const char*, uint64, const char*);
1617

1718
uint64_t playerMask = 0;
@@ -93,6 +94,7 @@ void PlayerManager::Initialize()
9394
SH_ADD_HOOK_MEMFUNC(IServerGameClients, ClientConnect, gameclients, this, &PlayerManager::ClientConnect, false);
9495
SH_ADD_HOOK_MEMFUNC(IServerGameClients, OnClientConnected, gameclients, this, &PlayerManager::OnClientConnected, false);
9596
SH_ADD_HOOK_MEMFUNC(IServerGameClients, ClientDisconnect, gameclients, this, &PlayerManager::ClientDisconnect, true);
97+
SH_ADD_HOOK_MEMFUNC(IServerGameClients, ClientPutInServer, gameclients, this, &PlayerManager::OnClientPutInServer, true);
9698
}
9799

98100
void PlayerManager::Shutdown()
@@ -101,6 +103,7 @@ void PlayerManager::Shutdown()
101103
SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientConnect, gameclients, this, &PlayerManager::ClientConnect, false);
102104
SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, OnClientConnected, gameclients, this, &PlayerManager::OnClientConnected, false);
103105
SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientDisconnect, gameclients, this, &PlayerManager::ClientDisconnect, true);
106+
SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientPutInServer, gameclients, this, &PlayerManager::OnClientPutInServer, true);
104107
}
105108

106109
void PlayerManager::GameFrame(bool a, bool b, bool c)
@@ -175,4 +178,9 @@ void PlayerManager::OnValidateAuthTicket(ValidateAuthTicketResponse_t* response)
175178
player->SetAuthorized(response->m_eAuthSessionResponse == k_EAuthSessionResponseOK);
176179
break;
177180
}
181+
}
182+
183+
void PlayerManager::OnClientPutInServer(CPlayerSlot slot, char const* pszName, int type, uint64 xuid)
184+
{
185+
g_pluginManager.ExecuteEvent("core", "OnClientPutInServer", { slot.Get(), type }, nullptr);
178186
}

src/server/player/manager.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class PlayerManager
3232
bool ClientConnect(CPlayerSlot slot, const char* pszName, uint64 xuid, const char* pszNetworkID, bool unk1, CBufferString* pRejectReason);
3333
void OnClientConnected(CPlayerSlot slot, const char* pszName, uint64 xuid, const char* pszNetworkID, const char* pszAddress, bool bFakePlayer);
3434
void ClientDisconnect(CPlayerSlot slot, ENetworkDisconnectionReason reason, const char* pszName, uint64 xuid, const char* pszNetworkID);
35+
void OnClientPutInServer(CPlayerSlot slot, char const* pszName, int type, uint64 xuid);
3536

3637
void SteamAPIServerActivated();
3738

0 commit comments

Comments
 (0)