@@ -34,7 +34,17 @@ public class PlayerChat
34
34
{
35
35
public HookResult OnPlayerChat ( CCSPlayerController ? player , CommandInfo info , bool TeamChat )
36
36
{
37
- if ( ! player . IsValid ( ) ) return HookResult . Continue ;
37
+ if ( ! player . IsValid ( ) || ! MainPlugin . Instance . g_Main . Player_Data . ContainsKey ( player ) ) return HookResult . Continue ;
38
+
39
+ if ( Configs . GetConfigData ( ) . CompatibilityWithCS2Fixes )
40
+ {
41
+ if ( ( DateTime . Now - MainPlugin . Instance . g_Main . Player_Data [ player ] . Time ) . TotalSeconds < 2 )
42
+ {
43
+ return HookResult . Continue ;
44
+ }
45
+ MainPlugin . Instance . g_Main . Player_Data [ player ] . Time = DateTime . Now ;
46
+ }
47
+
38
48
var playerid = player . SteamID ;
39
49
var eventmessage = info . ArgString ;
40
50
eventmessage = eventmessage . TrimStart ( '"' ) ;
@@ -52,17 +62,13 @@ public HookResult OnPlayerChat(CCSPlayerController? player, CommandInfo info, bo
52
62
Helper . AdvancedPlayerPrintToChat ( player , MainPlugin . Instance . Localizer [ "PrintChatToPlayer.Toggle.Messages.Not.Allowed" ] ) ;
53
63
} else
54
64
{
55
- if ( MainPlugin . Instance . g_Main . Player_Data . ContainsKey ( player ) )
65
+ MainPlugin . Instance . g_Main . Player_Data [ player ] . Toggle_Messages = MainPlugin . Instance . g_Main . Player_Data [ player ] . Toggle_Messages . ToggleOnOff ( ) ;
66
+ if ( MainPlugin . Instance . g_Main . Player_Data [ player ] . Toggle_Messages == - 1 )
56
67
{
57
- MainPlugin . Instance . g_Main . Player_Data [ player ] . Toggle_Messages = MainPlugin . Instance . g_Main . Player_Data [ player ] . Toggle_Messages . ToggleOnOff ( ) ;
58
-
59
- if ( MainPlugin . Instance . g_Main . Player_Data [ player ] . Toggle_Messages == - 1 )
60
- {
61
- Helper . AdvancedPlayerPrintToChat ( player , MainPlugin . Instance . Localizer [ "PrintChatToPlayer.Toggle.Messages.Enabled" ] ) ;
62
- } else if ( MainPlugin . Instance . g_Main . Player_Data [ player ] . Toggle_Messages == - 2 )
63
- {
64
- Helper . AdvancedPlayerPrintToChat ( player , MainPlugin . Instance . Localizer [ "PrintChatToPlayer.Toggle.Messages.Disabled" ] ) ;
65
- }
68
+ Helper . AdvancedPlayerPrintToChat ( player , MainPlugin . Instance . Localizer [ "PrintChatToPlayer.Toggle.Messages.Enabled" ] ) ;
69
+ } else if ( MainPlugin . Instance . g_Main . Player_Data [ player ] . Toggle_Messages == - 2 )
70
+ {
71
+ Helper . AdvancedPlayerPrintToChat ( player , MainPlugin . Instance . Localizer [ "PrintChatToPlayer.Toggle.Messages.Disabled" ] ) ;
66
72
}
67
73
}
68
74
}
@@ -75,21 +81,16 @@ public HookResult OnPlayerChat(CCSPlayerController? player, CommandInfo info, bo
75
81
Helper . AdvancedPlayerPrintToChat ( player , MainPlugin . Instance . Localizer [ "PrintChatToPlayer.Toggle.Sounds.Not.Allowed" ] ) ;
76
82
} else
77
83
{
78
- if ( MainPlugin . Instance . g_Main . Player_Data . ContainsKey ( player ) )
84
+ MainPlugin . Instance . g_Main . Player_Data [ player ] . Toggle_Sounds = MainPlugin . Instance . g_Main . Player_Data [ player ] . Toggle_Sounds . ToggleOnOff ( ) ;
85
+ if ( MainPlugin . Instance . g_Main . Player_Data [ player ] . Toggle_Sounds == - 1 )
79
86
{
80
- MainPlugin . Instance . g_Main . Player_Data [ player ] . Toggle_Sounds = MainPlugin . Instance . g_Main . Player_Data [ player ] . Toggle_Sounds . ToggleOnOff ( ) ;
81
-
82
- if ( MainPlugin . Instance . g_Main . Player_Data [ player ] . Toggle_Sounds == - 1 )
83
- {
84
- Helper . AdvancedPlayerPrintToChat ( player , MainPlugin . Instance . Localizer [ "PrintChatToPlayer.Toggle.Sounds.Enabled" ] ) ;
85
- } else if ( MainPlugin . Instance . g_Main . Player_Data [ player ] . Toggle_Sounds == - 2 )
86
- {
87
- Helper . AdvancedPlayerPrintToChat ( player , MainPlugin . Instance . Localizer [ "PrintChatToPlayer.Toggle.Sounds.Disabled" ] ) ;
88
- }
87
+ Helper . AdvancedPlayerPrintToChat ( player , MainPlugin . Instance . Localizer [ "PrintChatToPlayer.Toggle.Sounds.Enabled" ] ) ;
88
+ } else if ( MainPlugin . Instance . g_Main . Player_Data [ player ] . Toggle_Sounds == - 2 )
89
+ {
90
+ Helper . AdvancedPlayerPrintToChat ( player , MainPlugin . Instance . Localizer [ "PrintChatToPlayer.Toggle.Sounds.Disabled" ] ) ;
89
91
}
90
92
}
91
93
}
92
-
93
94
return HookResult . Continue ;
94
95
}
95
96
}
0 commit comments