Skip to content

Commit

Permalink
More work on LR
Browse files Browse the repository at this point in the history
  • Loading branch information
MSWS committed Feb 13, 2024
1 parent dfe24dd commit 72a3535
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
16 changes: 16 additions & 0 deletions mod/Jailbreak.LastRequest/LastRequestCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core.Attributes.Registration;
using CounterStrikeSharp.API.Modules.Commands;
using Jailbreak.Public.Behaviors;

namespace Jailbreak.LastRequest;

public class LastRequestCommand : IPluginBehavior
{
[ConsoleCommand("css_lr", "Start a last request as a prisoner")]
[CommandHelper(whoCanExecute: CommandUsage.CLIENT_ONLY)]
public void Command_LastRequest(CCSPlayerController? executor, CommandInfo info)
{

}
}
22 changes: 20 additions & 2 deletions mod/Jailbreak.LastRequest/LastRequests/KnifeFight.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,38 @@ public class KnifeFight : AbstractLastRequest
public KnifeFight(BasePlugin plugin, CCSPlayerController prisoner, CCSPlayerController guard) : base(plugin,
prisoner, guard)
{
plugin.RegisterEventHandler<EventPlayerDeath>(OnPlayerDeath);
}

public HookResult OnPlayerDeath(EventPlayerDeath @event, GameEventInfo info)
{
if (@event.Userid != prisoner && @event.Userid != guard)
return HookResult.Continue;

if (@event.Userid == prisoner)
End(LRResult.GuardWin);
else
End(LRResult.PrisonerWin);
return HookResult.Continue;
}

public override void Setup()
{
// Strip weapons, teleport T to CT
prisoner.RemoveWeapons();
guard.RemoveWeapons();
this.state = LRState.Pending;
}

public override void Execute()
{
// Give knives
prisoner.GiveNamedItem("weapon_knife");
guard.GiveNamedItem("weapon_knife");
this.state = LRState.Active;
}

public override void End(LRResult result)
{
// Slay the loser
this.state = LRState.Completed;
}
}

0 comments on commit 72a3535

Please sign in to comment.