Skip to content

Commit

Permalink
add vip flag, fix sd cancel
Browse files Browse the repository at this point in the history
  • Loading branch information
destoer committed May 13, 2024
1 parent b395096 commit a2647fb
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 11 deletions.
2 changes: 1 addition & 1 deletion WardenService/WardenService.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.215" />
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.233" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/Cs2Jailbreak.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<ItemGroup>

<PackageReference Include="CounterStrikeSharp.API" Version="1.0.215" />
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.233" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="8.0.1" />
<PackageReference Include="MySqlConnector" Version="2.3.1" />

Expand Down
2 changes: 1 addition & 1 deletion src/Lib/Lib.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ static public void MuteT()
{
foreach(CCSPlayerController player in Lib.GetPlayers())
{
if(player.IsT())
if(player.IsT() && !player.IsVip())
{
player.Mute();
}
Expand Down
11 changes: 11 additions & 0 deletions src/Lib/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,17 @@ static public void SetColour(this CCSPlayerController? player, Color colour)
}
}

static public bool IsVip(this CCSPlayerController? player)
{
if(!player.IsLegal())
{
return false;
}

return AdminManager.PlayerHasPermissions(player,new String[] {"@css/vip"});
}


static public bool IsGenericAdmin(this CCSPlayerController? player)
{
if(!player.IsLegal())
Expand Down
4 changes: 2 additions & 2 deletions src/Lib/Timer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ static public void RespawnDelay(this CCSPlayerController? player, float delay)
}

// ent
static public void RemoveDelay(this CEntityInstance entity, float delay, String name)
static public void RemoveDelay(this CEntityInstance? entity, float delay, String name)
{
// remove projectile
if(entity.DesignerName == name)
if(entity != null && entity.DesignerName == name)
{
int index = (int)entity.Index;

Expand Down
7 changes: 5 additions & 2 deletions src/SpecialDay/SDBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ public void CleanupPlayers()
{
foreach(CCSPlayerController player in Lib.GetAlivePlayers())
{
player.StripWeapons();
CleanupPlayer(player);
}
}
Expand All @@ -170,8 +171,10 @@ public void ResurectPlayer(CCSPlayerController player,float delay)
JailPlugin.globalCtx.AddTimer(delay, () =>
{
CCSPlayerController? target = Utilities.GetPlayerFromSlot(victimSlot);
target.Respawn();

if(target.IsLegal())
{
target.Respawn();
}
},CSTimer.TimerFlags.STOP_ON_MAPCHANGE);

JailPlugin.globalCtx.AddTimer(delay + 0.5f,() =>
Expand Down
14 changes: 10 additions & 4 deletions src/Warden/WardenCmd.cs
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,13 @@ public void ColourCallback(CCSPlayerController? invoke, ChatMenuOption option)

CCSPlayerController? player = Utilities.GetPlayerFromSlot(colourSlot);

Color colour = Lib.COLOUR_CONFIG_MAP[option.Text];
if(player.IsLegalAlive())
{
Color colour = Lib.COLOUR_CONFIG_MAP[option.Text];

Chat.Announce(WARDEN_PREFIX,$"Setting {player.PlayerName} colour to {option.Text}");
player.SetColour(colour);
Chat.Announce(WARDEN_PREFIX,$"Setting {player.PlayerName} colour to {option.Text}");
player.SetColour(colour);
}
}

public void ColourPlayerCallback(CCSPlayerController? invoke, ChatMenuOption option)
Expand Down Expand Up @@ -448,7 +451,10 @@ public void TakeWardenCmd(CCSPlayerController? player, CommandInfo command)
{
var warden = Utilities.GetPlayerFromSlot(wardenSlot);

player.LocalizePrefix(WARDEN_PREFIX,"warden.warden_taken",warden.PlayerName);
if(warden.IsLegal())
{
player.LocalizePrefix(WARDEN_PREFIX,"warden.warden_taken",warden.PlayerName);
}
}

// player is valid to take warden
Expand Down

0 comments on commit a2647fb

Please sign in to comment.