11using CounterStrikeSharp . API ;
2+ using CounterStrikeSharp . API . Core ;
3+ using CounterStrikeSharp . API . Modules . Commands ;
24using CounterStrikeSharp . API . Core . Attributes ;
35using CounterStrikeSharp . API . Modules . Entities ;
46
57using static RetakesAllocator . Modules . Core ;
68using static RetakesAllocator . Modules . Utils ;
9+ using static RetakesAllocator . Modules . Weapons . Menu ;
710
811namespace RetakesAllocator . Modules . Handlers ;
912
@@ -15,6 +18,9 @@ public static void RegisterListeners()
1518 Plugin . RegisterListener < CounterStrikeSharp . API . Core . Listeners . OnClientAuthorized > ( OnClientAuthorized ) ;
1619 Plugin . RegisterListener < CounterStrikeSharp . API . Core . Listeners . OnClientConnected > ( OnClientConnected ) ;
1720 Plugin . RegisterListener < CounterStrikeSharp . API . Core . Listeners . OnClientDisconnect > ( OnClientDisconnect ) ;
21+
22+ Plugin . AddCommandListener ( "say" , OnSay ) ;
23+ Plugin . AddCommandListener ( "say_team" , OnSay ) ;
1824 }
1925
2026 private static void OnMapStart ( string map_name )
@@ -49,4 +55,30 @@ private static void OnClientDisconnect(int playerSlot)
4955 var player = Utilities . GetPlayerFromSlot ( playerSlot ) ;
5056 RemovePlayerFromList ( player ) ;
5157 }
58+
59+ private static HookResult OnSay ( CCSPlayerController ? player , CommandInfo command )
60+ {
61+ if ( player == null || ! player . IsValid )
62+ return HookResult . Continue ;
63+
64+ if ( command . ArgCount < 2 )
65+ return HookResult . Continue ;
66+
67+ var message = command . GetArg ( 1 ) ;
68+
69+ if ( ! Core . Config . triggerWords . Any ( word => word . Equals ( message ) ) )
70+ return HookResult . Continue ;
71+
72+ var playerObj = FindPlayer ( player ) ;
73+
74+ if ( playerObj == null ! )
75+ {
76+ ReplyToCommand ( command , $ "{ PREFIX } This command can only be executed by a valid player.") ;
77+ return HookResult . Continue ;
78+ }
79+
80+ OpenTPrimaryMenu ( player ) ;
81+
82+ return HookResult . Continue ;
83+ }
5284}
0 commit comments