Skip to content

Commit bbbec4c

Browse files
committed
fix(entrypoint): ClientCommand crash
1 parent ae9a049 commit bbbec4c

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

src/entrypoint.cpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ SH_DECL_HOOK5_void(IServerGameClients, ClientDisconnect, SH_NOATTRIB, 0, CPlayer
3838
SH_DECL_HOOK1_void(IServerGameClients, ClientSettingsChanged, SH_NOATTRIB, 0, CPlayerSlot);
3939
SH_DECL_HOOK6_void(IServerGameClients, OnClientConnected, SH_NOATTRIB, 0, CPlayerSlot, const char*, uint64, const char*, const char*, bool);
4040
SH_DECL_HOOK6(IServerGameClients, ClientConnect, SH_NOATTRIB, 0, bool, CPlayerSlot, const char*, uint64, const char*, bool, CBufferString*);
41-
SH_DECL_HOOK2_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, CPlayerSlot, const CCommand&);
4241
SH_DECL_HOOK3_void(ICvar, DispatchConCommand, SH_NOATTRIB, 0, ConCommandHandle, const CCommandContext&, const CCommand&);
4342
SH_DECL_HOOK0_void(IServerGameDLL, GameServerSteamAPIActivated, SH_NOATTRIB, 0);
4443

@@ -136,7 +135,6 @@ bool Swiftly::Load(PluginId id, ISmmAPI* ismm, char* error, size_t maxlen, bool
136135
SH_ADD_HOOK_MEMFUNC(IServerGameClients, ClientDisconnect, gameclients, this, &Swiftly::Hook_ClientDisconnect, true);
137136
SH_ADD_HOOK_MEMFUNC(IServerGameClients, OnClientConnected, gameclients, this, &Swiftly::Hook_OnClientConnected, false);
138137
SH_ADD_HOOK_MEMFUNC(IServerGameClients, ClientConnect, gameclients, this, &Swiftly::Hook_ClientConnect, false);
139-
SH_ADD_HOOK_MEMFUNC(IServerGameClients, ClientCommand, gameclients, this, &Swiftly::Hook_OnClientCommand, false);
140138
SH_ADD_HOOK_MEMFUNC(INetworkServerService, StartupServer, g_pNetworkServerService, this, &Swiftly::Hook_StartupServer, true);
141139
SH_ADD_HOOK_MEMFUNC(ICvar, DispatchConCommand, icvar, this, &Swiftly::Hook_DispatchConCommand, false);
142140
SH_ADD_HOOK_MEMFUNC(IServerGameDLL, GameServerSteamAPIActivated, server, this, &Swiftly::Hook_GameServerSteamAPIActivated, false);
@@ -252,7 +250,6 @@ bool Swiftly::Unload(char* error, size_t maxlen)
252250
SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientDisconnect, gameclients, this, &Swiftly::Hook_ClientDisconnect, true);
253251
SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, OnClientConnected, gameclients, this, &Swiftly::Hook_OnClientConnected, false);
254252
SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientConnect, gameclients, this, &Swiftly::Hook_ClientConnect, false);
255-
SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientCommand, gameclients, this, &Swiftly::Hook_OnClientCommand, false);
256253
SH_REMOVE_HOOK_MEMFUNC(INetworkServerService, StartupServer, g_pNetworkServerService, this, &Swiftly::Hook_StartupServer, true);
257254
SH_REMOVE_HOOK_MEMFUNC(ICvar, DispatchConCommand, icvar, this, &Swiftly::Hook_DispatchConCommand, false);
258255
SH_REMOVE_HOOK_MEMFUNC(IServerGameDLL, GameServerSteamAPIActivated, server, this, &Swiftly::Hook_GameServerSteamAPIActivated, false);
@@ -532,6 +529,11 @@ void Swiftly::Hook_DispatchConCommand(ConCommandHandle cmd, const CCommandContex
532529

533530
if (slot.Get() != -1)
534531
{
532+
g_voiceManager.OnClientCommand(slot, args);
533+
534+
if (!OnClientCommand(slot.Get(), args.GetCommandString()))
535+
RETURN_META(MRES_SUPERCEDE);
536+
535537
if (command == "say" || command == "say_team")
536538
{
537539
Player* player = g_playerManager->GetPlayer(slot);
@@ -607,14 +609,6 @@ void Swiftly::Hook_DispatchConCommand(ConCommandHandle cmd, const CCommandContex
607609
}
608610
}
609611

610-
void Swiftly::Hook_OnClientCommand(CPlayerSlot slot, const CCommand& args)
611-
{
612-
g_voiceManager.OnClientCommand(slot, args);
613-
614-
if (!OnClientCommand(slot.Get(), args.GetCommandString()))
615-
RETURN_META(MRES_SUPERCEDE);
616-
}
617-
618612
void Swiftly::NextFrame(std::function<void()> fn)
619613
{
620614
m_nextFrame.push_back(fn);

0 commit comments

Comments
 (0)