Skip to content

Commit 829f96d

Browse files
authored
1.1.1
1 parent b57aa47 commit 829f96d

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

Config/Helper.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,13 +217,13 @@ public static async Task LoadPlayerData(CCSPlayerController player)
217217
try
218218
{
219219
var g_Main = MainPlugin.Instance.g_Main;
220-
if (!player.IsValid() || g_Main.Player_Data.ContainsKey(player)) return;
220+
if (!player.IsValid()) return;
221221

222222
var steamId = player.SteamID;
223223

224224
await Server.NextFrameAsync(() =>
225225
{
226-
if (!player.IsValid() || g_Main.Player_Data.ContainsKey(player)) return;
226+
if (!player.IsValid()) return;
227227

228228
var initialData = new Globals.PlayerDataClass(
229229
player,
@@ -280,7 +280,8 @@ await Server.NextFrameAsync(() =>
280280

281281
private static void UpdatePlayerData(CCSPlayerController player, Globals_Static.PersonData data)
282282
{
283-
if (!player.IsValid() || !MainPlugin.Instance.g_Main.Player_Data.TryGetValue(player, out var handle))return;
283+
if (!player.IsValid() || !MainPlugin.Instance.g_Main.Player_Data.ContainsKey(player))return;
284+
if (!MainPlugin.Instance.g_Main.Player_Data.TryGetValue(player, out var handle))return;
284285

285286
if(data.Toggle_Messages < 0 || data.Toggle_Sounds < 0)
286287
{

Connect-Disconnect-Sound-GoldKingZ.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace CnD_Sound;
1616
public class MainPlugin : BasePlugin
1717
{
1818
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";
2020
public override string ModuleAuthor => "Gold KingZ";
2121
public override string ModuleDescription => "https://github.com/oqyh";
2222
public static MainPlugin Instance { get; set; } = new();
@@ -212,7 +212,7 @@ private async Task HandlePlayerConnectionsAsync(CCSPlayerController Getplayer, b
212212

213213
await Server.NextFrameAsync(async () =>
214214
{
215-
if (!player.IsValid()) return;
215+
if (!player.IsValid() || !g_Main.Player_Data.ContainsKey(player))return;
216216

217217
var (ConnectionSettingsMessage, ConnectionSettingsSound, ConnectionSettingsSoundVolume) = Helper.GetPlayerConnectionSettings(player, Disconnect?"DISCONNECT":"CONNECT");
218218
string formatted = "";
@@ -238,7 +238,7 @@ await Server.NextFrameAsync(async () =>
238238

239239
foreach (var allplayers in Helper.GetPlayersController())
240240
{
241-
if (!allplayers.IsValid()) continue;
241+
if (!allplayers.IsValid() || !g_Main.Player_Data.ContainsKey(allplayers))continue;
242242

243243
if (!string.IsNullOrEmpty(formatted) && (g_Main.Player_Data[allplayers].Toggle_Messages == 1 || g_Main.Player_Data[allplayers].Toggle_Messages == -1))
244244
{
@@ -362,25 +362,25 @@ private HookResult OnPlayerDisconnect(EventPlayerDisconnect @event, GameEventInf
362362
var reasonInt = @event.Reason;
363363
var reason = Helper.GetDisconnectReason(reasonInt);
364364

365-
if (!player.IsValid()) return HookResult.Continue;
365+
if (!player.IsValid())return HookResult.Continue;
366366

367-
if (g_Main.Player_Data.ContainsKey(player))
367+
if (Configs.GetConfigData().DisableLoopConnections && reasonInt == 55)
368368
{
369-
if(Configs.GetConfigData().RemoveDefaultDisconnect == 2)
369+
if (!g_Main.OnLoop.ContainsKey(player))
370370
{
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;
372376
}
377+
}
373378

374-
if (Configs.GetConfigData().DisableLoopConnections && reasonInt == 55)
379+
if(Configs.GetConfigData().RemoveDefaultDisconnect == 2)
380+
{
381+
if (g_Main.Player_Data.ContainsKey(player))
375382
{
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;
384384
}
385385
}
386386

0 commit comments

Comments
 (0)