diff --git a/Classic/scripts/autoexec/FlagEscortFix.cs b/Classic/scripts/autoexec/FlagEscortFix.cs index ed15d4b..de14186 100644 --- a/Classic/scripts/autoexec/FlagEscortFix.cs +++ b/Classic/scripts/autoexec/FlagEscortFix.cs @@ -1,48 +1,41 @@ package FlagEscortFix { -function CTFGame::onClientDamaged(%game, %clVictim, %clAttacker, %damageType, %implement, %damageLoc) -{ +function CTFGame::onClientDamaged(%game, %clVictim, %clAttacker, %damageType, %implement, %damageLoc){ parent::onClientDamaged(%game, %clVictim, %clAttacker, %damageType, %implement, %damageLoc); - //if victim is carrying a flag and is not on the attackers team, mark the attacker as a threat for x seconds(for scoring purposes) if ((%clVictim.player.holdingFlag !$= "") && (%clVictim.team != %clAttacker.team)) - { - %clAttacker.dmgdFlagCarrier = true; - cancel(%clAttacker.threatTimer); //restart timer - %clAttacker.threatTimer = schedule(%game.TIME_CONSIDERED_FLAGCARRIER_THREAT,0,"dmgFlagReset",%clAttacker); - } + %clAttacker.dmgdFlagTime = getSimTime(); +} +function CTFGame::testEscortAssist(%game, %victimID, %killerID){ + if((getSimTime() - %victimID.dmgdFlagTime) < %game.TIME_CONSIDERED_FLAGCARRIER_THREAT) + return true; + return false; } -function SCtFGame::onClientDamaged(%game, %clVictim, %clAttacker, %damageType, %implement, %damageLoc) -{ +function SCtFGame::onClientDamaged(%game, %clVictim, %clAttacker, %damageType, %implement, %damageLoc){ parent::onClientDamaged(%game, %clVictim, %clAttacker, %damageType, %implement, %damageLoc); - //if victim is carrying a flag and is not on the attackers team, mark the attacker as a threat for x seconds(for scoring purposes) if ((%clVictim.player.holdingFlag !$= "") && (%clVictim.team != %clAttacker.team)) - { - %clAttacker.dmgdFlagCarrier = true; - cancel(%clAttacker.threatTimer); //restart timer - %clAttacker.threatTimer = schedule(%game.TIME_CONSIDERED_FLAGCARRIER_THREAT,0,"dmgFlagReset",%clAttacker); - } + %clAttacker.dmgdFlagTime = getSimTime(); +} +function SCtFGame::testEscortAssist(%game, %victimID, %killerID){ + if((getSimTime() - %victimID.dmgdFlagTime) < %game.TIME_CONSIDERED_FLAGCARRIER_THREAT) + return true; + return false; } -function PracticeCTFGame::onClientDamaged(%game, %clVictim, %clAttacker, %damageType, %implement, %damageLoc) -{ +function PracticeCTFGame::onClientDamaged(%game, %clVictim, %clAttacker, %damageType, %implement, %damageLoc){ parent::onClientDamaged(%game, %clVictim, %clAttacker, %damageType, %implement, %damageLoc); - //if victim is carrying a flag and is not on the attackers team, mark the attacker as a threat for x seconds(for scoring purposes) if ((%clVictim.player.holdingFlag !$= "") && (%clVictim.team != %clAttacker.team)) - { - %clAttacker.dmgdFlagCarrier = true; - cancel(%clAttacker.threatTimer); //restart timer - %clAttacker.threatTimer = schedule(%game.TIME_CONSIDERED_FLAGCARRIER_THREAT,0,"dmgFlagReset",%clAttacker); - } + %clAttacker.dmgdFlagTime = getSimTime(); +} +function PracticeCTFGame::testEscortAssist(%game, %victimID, %killerID){ + if((getSimTime() - %victimID.dmgdFlagTime) < %game.TIME_CONSIDERED_FLAGCARRIER_THREAT) + return true; + return false; } }; -function dmgFlagReset(%clAttacker){ - %clAttacker.dmgdFlagCarrier = false; -} - // Prevent package from being activated if it is already if (!isActivePackage(FlagEscortFix)) activatePackage(FlagEscortFix); \ No newline at end of file