@@ -4644,6 +4644,21 @@ void ServerGameState::AttachToObject(fx::ServerInstanceBase* instance)
4644
4644
4645
4645
console::Printf (" net" , " ---------------- END OBJECT ID DUMP ----------------\n " );
4646
4646
});
4647
+
4648
+ // event is either eventNameHash for msgNetGameEventV2, or eventId when using v1
4649
+ static auto blockNetGameEvent = instance->AddCommand (" block_net_game_event" , [this ](uint32_t event)
4650
+ {
4651
+ auto & blockedEvents = this ->blockedEvents ;
4652
+ if (blockedEvents.find (event) != blockedEvents.end ())
4653
+ return ;
4654
+ blockedEvents.insert (event);
4655
+ });
4656
+
4657
+ static auto allowNetGameEvent = instance->AddCommand (" allow_net_game_event" , [this ](uint32_t event)
4658
+ {
4659
+ auto & blockedEvents = this ->blockedEvents ;
4660
+ blockedEvents.erase (event);
4661
+ });
4647
4662
}
4648
4663
}
4649
4664
@@ -7512,6 +7527,15 @@ std::function<bool()> fx::ServerGameState::GetGameEventHandler(const fx::ClientS
7512
7527
}
7513
7528
#endif
7514
7529
7530
+ // This checks for event id rather than eventNameHash for compatibility until msgNetGameEventV2 is ready
7531
+ if (blockedEvents.find (eventType) != blockedEvents.end ())
7532
+ {
7533
+ return []()
7534
+ {
7535
+ return false ;
7536
+ };
7537
+ }
7538
+
7515
7539
// RDR3 remaps eventType on the client (netEventMgr_MapEventId)
7516
7540
7517
7541
#if defined(STATE_FIVE) || defined(STATE_RDR3)
@@ -7640,7 +7664,15 @@ std::function<bool()> fx::ServerGameState::GetGameEventHandlerWithEvent(const fx
7640
7664
auto instance = m_instance;
7641
7665
7642
7666
const bool isReply = netGameEvent.isReply ;
7643
- const uint32_t eventNameHash = netGameEvent.eventNameHash ;
7667
+ const uint32_t eventNameHash = netGameEvent.eventNameHash ;
7668
+
7669
+ if (blockedEvents.find (eventNameHash) != blockedEvents.end ())
7670
+ {
7671
+ return []()
7672
+ {
7673
+ return false ;
7674
+ };
7675
+ }
7644
7676
7645
7677
#if defined(STATE_FIVE) || defined(STATE_RDR3)
7646
7678
#ifdef STATE_FIVE
0 commit comments