Skip to content

Commit

Permalink
1.2.8b
Browse files Browse the repository at this point in the history
- Changing connect event, in previous sometimes player == null
  • Loading branch information
daffyyyy committed Jan 25, 2024
1 parent 450a780 commit e584316
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CS2-SimpleAdmin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
public override string ModuleName => "CS2-SimpleAdmin";
public override string ModuleDescription => "Simple admin plugin for Counter-Strike 2 :)";
public override string ModuleAuthor => "daffyy";
public override string ModuleVersion => "1.2.8a";
public override string ModuleVersion => "1.2.8b";

public CS2_SimpleAdminConfig Config { get; set; } = new();

Expand Down
7 changes: 4 additions & 3 deletions Events.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ public partial class CS2_SimpleAdmin
private void registerEvents()
{
//RegisterListener<OnClientAuthorized>(OnClientAuthorized);
RegisterListener<OnClientConnect>(OnClientConnect);
//RegisterListener<OnClientConnect>(OnClientConnect);
RegisterListener<OnClientPutInServer>(OnClientPutInServer);
//RegisterEventHandler<EventPlayerConnectFull>(OnPlayerFullConnect);
RegisterListener<OnClientDisconnect>(OnClientDisconnect);
RegisterListener<OnMapStart>(OnMapStart);
Expand Down Expand Up @@ -125,14 +126,14 @@ private HookResult OnCommandCallVote(CCSPlayerController? player, CommandInfo in
return HookResult.Continue;
}

private void OnClientConnect(int playerSlot, string name, string ipAddress)
private void OnClientPutInServer(int playerSlot)
{
CCSPlayerController? player = Utilities.GetPlayerFromSlot(playerSlot);

if (player == null || !player.IsValid || player.IsBot || player.IsHLTV)
return;

ipAddress = ipAddress.Split(":")[0];
string? ipAddress = !string.IsNullOrEmpty(player.IpAddress) ? player.IpAddress.Split(":")[0] : null;

if (
ipAddress != null && bannedPlayers.Contains(ipAddress) ||
Expand Down

0 comments on commit e584316

Please sign in to comment.