@@ -16,7 +16,7 @@ namespace CnD_Sound;
16
16
public class MainPlugin : BasePlugin
17
17
{
18
18
public override string ModuleName => "Connect Disconnect Sound (Continent , Country , City , Message , Sounds , Logs , Discord)" ;
19
- public override string ModuleVersion => "1.1.0 " ;
19
+ public override string ModuleVersion => "1.1.1 " ;
20
20
public override string ModuleAuthor => "Gold KingZ" ;
21
21
public override string ModuleDescription => "https://github.com/oqyh" ;
22
22
public static MainPlugin Instance { get ; set ; } = new ( ) ;
@@ -212,7 +212,7 @@ private async Task HandlePlayerConnectionsAsync(CCSPlayerController Getplayer, b
212
212
213
213
await Server . NextFrameAsync ( async ( ) =>
214
214
{
215
- if ( ! player . IsValid ( ) ) return ;
215
+ if ( ! player . IsValid ( ) || ! g_Main . Player_Data . ContainsKey ( player ) ) return ;
216
216
217
217
var ( ConnectionSettingsMessage , ConnectionSettingsSound , ConnectionSettingsSoundVolume ) = Helper . GetPlayerConnectionSettings ( player , Disconnect ? "DISCONNECT" : "CONNECT" ) ;
218
218
string formatted = "" ;
@@ -238,7 +238,7 @@ await Server.NextFrameAsync(async () =>
238
238
239
239
foreach ( var allplayers in Helper . GetPlayersController ( ) )
240
240
{
241
- if ( ! allplayers . IsValid ( ) ) continue ;
241
+ if ( ! allplayers . IsValid ( ) || ! g_Main . Player_Data . ContainsKey ( allplayers ) ) continue ;
242
242
243
243
if ( ! string . IsNullOrEmpty ( formatted ) && ( g_Main . Player_Data [ allplayers ] . Toggle_Messages == 1 || g_Main . Player_Data [ allplayers ] . Toggle_Messages == - 1 ) )
244
244
{
@@ -362,25 +362,25 @@ private HookResult OnPlayerDisconnect(EventPlayerDisconnect @event, GameEventInf
362
362
var reasonInt = @event . Reason ;
363
363
var reason = Helper . GetDisconnectReason ( reasonInt ) ;
364
364
365
- if ( ! player . IsValid ( ) ) return HookResult . Continue ;
365
+ if ( ! player . IsValid ( ) ) return HookResult . Continue ;
366
366
367
- if ( g_Main . Player_Data . ContainsKey ( player ) )
367
+ if ( Configs . GetConfigData ( ) . DisableLoopConnections && reasonInt == 55 )
368
368
{
369
- if ( Configs . GetConfigData ( ) . RemoveDefaultDisconnect == 2 )
369
+ if ( ! g_Main . OnLoop . ContainsKey ( player ) )
370
370
{
371
- g_Main . Player_Data [ player ] . Remove_Icon = true ;
371
+ g_Main . OnLoop . Add ( player , true ) ;
372
+ }
373
+ if ( g_Main . OnLoop . ContainsKey ( player ) )
374
+ {
375
+ return HookResult . Continue ;
372
376
}
377
+ }
373
378
374
- if ( Configs . GetConfigData ( ) . DisableLoopConnections && reasonInt == 55 )
379
+ if ( Configs . GetConfigData ( ) . RemoveDefaultDisconnect == 2 )
380
+ {
381
+ if ( g_Main . Player_Data . ContainsKey ( player ) )
375
382
{
376
- if ( ! g_Main . OnLoop . ContainsKey ( player ) )
377
- {
378
- g_Main . OnLoop . Add ( player , true ) ;
379
- }
380
- if ( g_Main . OnLoop . ContainsKey ( player ) )
381
- {
382
- return HookResult . Continue ;
383
- }
383
+ g_Main . Player_Data [ player ] . Remove_Icon = true ;
384
384
}
385
385
}
386
386
0 commit comments