Skip to content

Commit

Permalink
uhhhhhhhhhg
Browse files Browse the repository at this point in the history
  • Loading branch information
ShookEagle committed Aug 3, 2024
1 parent 3e6bd06 commit 98e3f96
Showing 1 changed file with 27 additions and 24 deletions.
51 changes: 27 additions & 24 deletions mod/Jailbreak.LastRequest/LastRequests/BulletForBullet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class BulletForBullet : TeleportingRequest {
private bool magForMag = false;

private static readonly string[] GUNS = new string[] {
"weapon_deagle", "weapon_glock", "weapon_hkp2000", "weapon_tec9",
"weapon_deagle", "weapon_glock", "weapon_usp_silencer", "weapon_tec9",
"weapon_cz75a", "weapon_revolver"
};

Expand All @@ -28,8 +28,8 @@ public BulletForBullet(BasePlugin plugin, ILastRequestManager manager,
CCSPlayerController prisoner, CCSPlayerController guard,
bool magForMag) : base(plugin, manager, prisoner, guard) {
chatMenu = new ChatMenu(magForMag ? "Mag for Mag" : "Shot for Shot");
foreach (var pistol in Tag.PISTOLS) {
chatMenu.AddMenuOption(pistol.GetFriendlyWeaponName(), OnSelect);
foreach (var pistol in GUN_NAMES) {
chatMenu.AddMenuOption(pistol, OnSelect);
}
}

Expand Down Expand Up @@ -117,27 +117,30 @@ private void timeout() {

private HookResult OnPlayerShoot(EventBulletImpact @event,
GameEventInfo info) {
if (State != LRState.ACTIVE) return HookResult.Continue;

var player = @event.Userid;
if (player == null || whosShot == null || !player.IsValid
|| magSize == null)
return HookResult.Continue;

if (player.Slot != Prisoner.Slot && player.Slot != Guard.Slot)
return HookResult.Continue;
if (player.Slot != whosShot) {
PrintToParticipants(player.PlayerName + " cheated.");
player.Pawn.Value?.CommitSuicide(false, true);
return HookResult.Handled;
}

if (player.GetWeaponBase(CHOSEN_PISTOL).Clip1 != 0)
return HookResult.Continue;

var opponent = player.Slot == Prisoner.Slot ? Guard : Prisoner;
opponent.GetWeaponBase(CHOSEN_PISTOL).SetAmmo(magSize.Value, 0);
whosShot = opponent.Slot;
if (State != LRState.ACTIVE) return HookResult.Continue;

var player = @event.Userid;
if (player == null || whosShot == null || !player.IsValid
|| magSize == null)
return HookResult.Continue;

if (player.Slot != Prisoner.Slot && player.Slot != Guard.Slot)
return HookResult.Continue;

if (player.Slot != whosShot) {
PrintToParticipants(player.PlayerName + " cheated.");
player.Pawn.Value?.CommitSuicide(false, true);
return HookResult.Handled;
}

if (player.GetWeaponBase(CHOSEN_PISTOL!)?.Clip1 != 0)
return HookResult.Continue;
Server.NextFrame(() => {

var opponent = player.Slot == Prisoner.Slot ? Guard : Prisoner;
opponent.GetWeaponBase(CHOSEN_PISTOL!).SetAmmo(magSize.Value, 0);
whosShot = opponent.Slot;
});
return HookResult.Continue;
}

Expand Down

0 comments on commit 98e3f96

Please sign in to comment.