Headshot Only, Infinite sprint & Overshield Verse code

<#######################################################################################



_       __      __       _   _    __     __    __     _____  __     __

| |     | __|    /  \     | \ | |  |  _ \   | __|  |  _ \   |  ___| \ \   / /

| |     |  |     / /\ \    |  | |  | | | |  |  |    | |) |  | |_    \ \ / /

| |__  | |__   / ____ \   | |\  |  | || |  | |__   |  _  /  |  __|    \ V /

|| || //    _\  || _|  |__/   |_____|  || _\  ||        _/



Code Written by:  L E A N D E R F V

########################################################################################>

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /Fortnite.com/Characters }
using { /Fortnite.com/Game }

EachP := class():
Player: player
var CurrentMaxShield : float
var CurrentMaxHealth : float

headshotonly := class(creative_device):
    @editable
    HealthRechargeTrigger : trigger_device = trigger_device{}
    @editable
    ShieldRechargeTrigger : trigger_device = trigger_device{}
    @editable
    Overshield : trigger_device = trigger_device{}
    @editable
    Sprint : trigger_device = trigger_device{}


var HealthRechargeEnabled : logic = false
var ShieldRechargeEnabled : logic = false
var OvershieldEnabled : logic = false
var SprintEnabled : logic = false

@editable
OvershieldSprintHealthAndShields1 : class_and_team_selector_device = class_and_team_selector_device{}
@editable
NoOvershieldSprintHealthAndShields2 : class_and_team_selector_device = class_and_team_selector_device{}
@editable
OvershieldNoSprintHealthAndShields3 : class_and_team_selector_device = class_and_team_selector_device{}
@editable
NoOvershieldNoSprintHealthAndShields4 : class_and_team_selector_device = class_and_team_selector_device{}
@editable
NoOvershieldNoSprintNoHealthAndShields5 : class_and_team_selector_device = class_and_team_selector_device{}
@editable
OvershieldSprintNoHealthAndShields6 : class_and_team_selector_device = class_and_team_selector_device{}
@editable
NoOvershieldSprintNoHealthAndShields7 : class_and_team_selector_device = class_and_team_selector_device{}
@editable
OvershieldNoSprintNoHealthAndShields8 : class_and_team_selector_device = class_and_team_selector_device{}


@editable PlayerSpawner : []player_spawner_device = array{}

var PlayerMap : [player]EachP = map{}



OnBegin<override>()<suspends>:void=

     for(Spawner:PlayerSpawner):
        Spawner.SpawnedEvent.Subscribe(OnPlayerSpawned)

    HealthRechargeTrigger.TriggeredEvent.Subscribe(ToggleHealthRecharge)
    ShieldRechargeTrigger.TriggeredEvent.Subscribe(ToggleShieldRecharge)
    Overshield.TriggeredEvent.Subscribe(ToggleOvershield)
    Sprint.TriggeredEvent.Subscribe(ToggleSprint)

    OvershieldSprintHealthAndShields1.ClassSwitchedEvent.Subscribe(ChangeHealthAndShield)
        NoOvershieldSprintHealthAndShields2.ClassSwitchedEvent.Subscribe(ChangeHealthAndShield)
        OvershieldNoSprintHealthAndShields3.ClassSwitchedEvent.Subscribe(ChangeHealthAndShield)
        NoOvershieldNoSprintHealthAndShields4.ClassSwitchedEvent.Subscribe(ChangeHealthAndShield)
        NoOvershieldNoSprintNoHealthAndShields5.ClassSwitchedEvent.Subscribe(ChangeHealthAndShield)
        OvershieldSprintNoHealthAndShields6.ClassSwitchedEvent.Subscribe(ChangeHealthAndShield)
        NoOvershieldSprintNoHealthAndShields7.ClassSwitchedEvent.Subscribe(ChangeHealthAndShield)
        OvershieldNoSprintNoHealthAndShields8.ClassSwitchedEvent.Subscribe(ChangeHealthAndShield)

        GetPlayspace().PlayerRemovedEvent().Subscribe(OnPlayerLeft)


ChangeHealthAndShield(Agent:agent):void=
    if(Player := player[Agent], ExistingPlayer := PlayerMap[Player], FC := Agent.GetFortCharacter[]):
        FC.SetMaxShield(ExistingPlayer.CurrentMaxShield)
        FC.SetMaxHealth(ExistingPlayer.CurrentMaxHealth)

ToggleHealthRecharge(Agent:?agent):void=
    if(NewAgent := Agent?):
        if(Player := player[NewAgent], PlayerExisting := PlayerMap[Player]):
            if(FC := NewAgent.GetFortCharacter[]):
                CurrentMaxShield := FC.GetMaxShield()
                CurrentMaxHealth := FC.GetMaxHealth()

                set PlayerExisting.CurrentMaxShield = CurrentMaxShield
                set PlayerExisting.CurrentMaxHealth = CurrentMaxHealth

                if (HealthRechargeEnabled = true):
                    set HealthRechargeEnabled = false
                else:
                    set HealthRechargeEnabled = true
            SwitchPlayers()

ToggleShieldRecharge(Agent:?agent):void=
    if(NewAgent := Agent?):
        if(Player := player[NewAgent], PlayerExisting := PlayerMap[Player]):
            if(FC := NewAgent.GetFortCharacter[]):
                CurrentMaxShield := FC.GetMaxShield()
                CurrentMaxHealth := FC.GetMaxHealth()

                set PlayerExisting.CurrentMaxShield = CurrentMaxShield
                set PlayerExisting.CurrentMaxHealth = CurrentMaxHealth

                if (ShieldRechargeEnabled = true):
                    set ShieldRechargeEnabled = false
                else:
                    set ShieldRechargeEnabled = true
                 SwitchPlayers()

ToggleOvershield(Agent : ?agent):void =
    if(NewAgent := Agent?):
        if(Player := player[NewAgent], PlayerExisting := PlayerMap[Player]):
            if(FC := NewAgent.GetFortCharacter[]):
                CurrentMaxShield := FC.GetMaxShield()
                CurrentMaxHealth := FC.GetMaxHealth()

                set PlayerExisting.CurrentMaxShield = CurrentMaxShield
                set PlayerExisting.CurrentMaxHealth = CurrentMaxHealth

                if (OvershieldEnabled?):
                    set OvershieldEnabled = false
                else:
                    set OvershieldEnabled = true
                SwitchPlayers()

           
            

ToggleSprint(Agent : ?agent):void =
    if(NewAgent := Agent?):
        if(Player := player[NewAgent], PlayerExisting := PlayerMap[Player]):
            if(FC := NewAgent.GetFortCharacter[]):

                CurrentMaxShield := FC.GetMaxShield()
                CurrentMaxHealth := FC.GetMaxHealth()

                set PlayerExisting.CurrentMaxShield = CurrentMaxShield
                set PlayerExisting.CurrentMaxHealth = CurrentMaxHealth

                if (SprintEnabled?):
                    set SprintEnabled = false
                else:
                    set SprintEnabled = true
                SwitchPlayers()


SwitchPlayers():void =
    for (Player : GetPlayspace().GetPlayers(), FC := Player.GetFortCharacter[], Agent := FC.GetAgent[]):
        if (HealthRechargeEnabled = true and ShieldRechargeEnabled = true and OvershieldEnabled = true and SprintEnabled = true):
            OvershieldSprintHealthAndShields1.ChangeClass(Agent)
        else if (HealthRechargeEnabled = true and ShieldRechargeEnabled = true and OvershieldEnabled = false and SprintEnabled = true):
            NoOvershieldSprintHealthAndShields2.ChangeClass(Agent)
        else if (HealthRechargeEnabled = true and ShieldRechargeEnabled = true and OvershieldEnabled = true and SprintEnabled = false):
            OvershieldNoSprintHealthAndShields3.ChangeClass(Agent)
        else if (HealthRechargeEnabled = true and ShieldRechargeEnabled = true and OvershieldEnabled = false and SprintEnabled = false):
            NoOvershieldNoSprintHealthAndShields4.ChangeClass(Agent)
        else if (HealthRechargeEnabled = false and ShieldRechargeEnabled = false and OvershieldEnabled = false and SprintEnabled = false):
            NoOvershieldNoSprintNoHealthAndShields5.ChangeClass(Agent)
        else if (HealthRechargeEnabled = false and ShieldRechargeEnabled = false and OvershieldEnabled = true and SprintEnabled = true):
            OvershieldSprintNoHealthAndShields6.ChangeClass(Agent)
        else if (HealthRechargeEnabled = false and ShieldRechargeEnabled = false and OvershieldEnabled = false and SprintEnabled = true):
            NoOvershieldSprintNoHealthAndShields7.ChangeClass(Agent)
        else if (HealthRechargeEnabled = false and ShieldRechargeEnabled = false and OvershieldEnabled = true and SprintEnabled = false):
            OvershieldNoSprintNoHealthAndShields8.ChangeClass(Agent)




OnPlayerSpawned(Agent:agent):void =
    if:
        Player := player[Agent]
        not EachP[Player]
        FC := Agent.GetFortCharacter[]
    then:
        if(set PlayerMap[Player] = EachP{Player := Player, CurrentMaxShield:=  FC.GetMaxShield(), CurrentMaxHealth := FC.GetMaxHealth()}):

OnPlayerLeft(Agent:agent):void=
    if(Player := player[Agent]):
        RemoveKeyFromMap(PlayerMap, Player)


RemoveKeyFromMap(OgMap:[player]EachP, Player:player):[player]EachP=
    var NewMap:[player]EachP = map{}
   
    for (Key -> Value : OgMap, Key <> Player):
        set NewMap = ConcatenateMaps(NewMap, map{Key => Value})
    return NewMap