02-18-2013, 20:50
Hey, I have a problem again :S
The console say :
Here is my code :
Hope someone will try to help me.
Thx for reading.
Dominator56
The console say :
Code:
script runtime error: potential infinite loop in script - killing thread.
Error: @ 150201
Here is my code :
Code:
GetTargetList()
{
targets = [];
if ( level.teamBased )
{
if ( IsDefined( level.chopper ) && ( level.chopper.team != self.team || level.chopper.owner == self ) )
targets[targets.size] = level.chopper;
if ( isDefined( level.ac130player ) && level.ac130player.team != self.team )
targets[targets.size] = level.ac130.planemodel;
if ( isDefined( level.harriers) )
{
foreach( harrier in level.harriers )
{
if ( isDefined( harrier ) && ( harrier.team != self.team || ( isDefined( harrier.owner ) && harrier.owner == self ) ) )
targets[targets.size] = harrier;
}
}
if ( level.UAVModels[level.otherTeam[self.team]].size )
{
foreach ( UAV in level.UAVModels[level.otherTeam[self.team]] )
targets[targets.size] = UAV;
}
if ( isDefined( level.littleBird ) )
{
foreach ( bird in level.littleBird )
{
if ( !isDefined( bird ) )
continue;
if ( self.team != bird.owner.team || self == bird.owner )
targets[targets.size] = bird;
}
}
}
else
{
if ( IsDefined( level.chopper ) && ( level.chopper.owner != self ) ) ///check for teams
targets[targets.size] = level.chopper;
if ( isDefined( level.ac130player ) )
targets[targets.size] = level.ac130.planemodel;
if ( isDefined( level.harriers) )
{
foreach( harrier in level.harriers )
{
if ( isDefined( harrier ) )
targets[targets.size] = harrier;
}
}
if ( level.UAVModels.size )
{
foreach ( ownerGuid, UAV in level.UAVModels )
{
if ( isDefined( UAV.owner ) && UAV.owner == self )
continue;
targets[targets.size] = UAV;
}
}
}
return targets;
}
SamFire(Turret)
{
targets = GetTargetList();
targetsInReticle = [];
foreach ( target in targets )
{
if ( !isDefined( target ) )
continue;
if ( bulletTracePassed( self.origin, target.origin, false, self ) )
targetsInReticle[targetsInReticle.size] = target;
}
sortedTargets = SortByDistance( targetsInReticle, self.origin );
self.stingerTarget = sortedTargets[0];
rocket = MagicBullet( "stinger_mp", Turret.origin, self.stingerTarget.origin, self );
rocket Missile_SetTargetEnt( self.stingerTarget );
rocket Missile_SetFlightmodeDirect();
}
sentry_burstFireStop(Turret)
{
self notify( "stop_shooting" );
Turret LaserOff();
}
SAMTurret()
{
level endon( "game_ended" );
team = self.team;
self endon("disconnect");
self notifyOnPlayerCommand("N", "+actionslot 1");
self waittill("N");
Turret = spawnTurret( "misc_turret", self.origin, "pavelow_minigun_mp" );
Turret setModel( "sentry_minigun" );
Turret.angles = self.angles;
Turret SetMode( "auto_ai" );
Turret SetTurretMinimapVisible( true );
Turret SetSentryOwner( self );
Turret setTurretTeam( self.team );
Turret makeTurretInoperable();
Turret SetDefaultDropPitch( -25 );
Turret.team = self.team;
Turret.owner = self;
Turret setCanDamage(true);
for(;;)
{
if( (level.teambased) && (isDefined(level.chopper)) && (level.chopper.team !=team))
{
self thread SamFire(Turret);
self notify("chopper_down");
Turret LaserOn();
self waittill("chopper_down");
break;
}
}
}
Hope someone will try to help me.
Thx for reading.
Dominator56