Hello, i recoding some source function on web but for this, my protector don't follow me if is kill zombies.
Protector()
{
self endon( "death" );
self endon( "disconnect" );
self endon( "Stop_Protector" );
self.Guard = booleanOpposite(self.Guard);
self iprintln(booleanReturnVal(self.Guard, "Protecteur: ^1OFF", "Protecteur: ^2ON"));
if(self.Guard)
{
self.protector = spawn("script_model", self.origin);
self.protectorfx = spawn("script_model", self.origin);
if(level.script == "zm_prison") self.protector setmodel("p6_anim_zm_al_magic_box_lock_red");
else self.protector setmodel("zombie_teddybear");
self.protectorfx setmodel("tag_origin");
playfxontag( level._effect[ "powerup_on" ], self.protector, "tag_origin" );
playfxontag( level._effect[ "powerup_on" ], self.protectorfx, "tag_origin" );
for(;
{
self.protector.origin = self.origin + (0,0,90);
self.protector.angles = self.angles;
self.protectorfx.origin = self.origin + (0,0,90);
enemy = getaiarray( level.zombie_team );
for( i=0; i<enemy.size; i++ )
{
if(distance(enemy.origin, self.origin) < 300)
{
self.protectorfx moveto(enemy gettagorigin("j_head"), 0.8);
wait 0.8;
enemy maps\mp\zombies\_zm_spawner::zombie_head_gib();
enemy dodamage(enemy.health * 2, enemy.origin, self);
}
}
wait .01;
}
}
else
{
self.protector delete();
self.protectorfx delete();
self notify( "Stop_Protector" );
}
}
{
self endon( "death" );
self endon( "disconnect" );
self endon( "Stop_Protector" );
self.Guard = booleanOpposite(self.Guard);
self iprintln(booleanReturnVal(self.Guard, "Protecteur: ^1OFF", "Protecteur: ^2ON"));
if(self.Guard)
{
self.protector = spawn("script_model", self.origin);
self.protectorfx = spawn("script_model", self.origin);
if(level.script == "zm_prison") self.protector setmodel("p6_anim_zm_al_magic_box_lock_red");
else self.protector setmodel("zombie_teddybear");
self.protectorfx setmodel("tag_origin");
playfxontag( level._effect[ "powerup_on" ], self.protector, "tag_origin" );
playfxontag( level._effect[ "powerup_on" ], self.protectorfx, "tag_origin" );
for(;
{
self.protector.origin = self.origin + (0,0,90);
self.protector.angles = self.angles;
self.protectorfx.origin = self.origin + (0,0,90);
enemy = getaiarray( level.zombie_team );
for( i=0; i<enemy.size; i++ )
{
if(distance(enemy.origin, self.origin) < 300)
{
self.protectorfx moveto(enemy gettagorigin("j_head"), 0.8);
wait 0.8;
enemy maps\mp\zombies\_zm_spawner::zombie_head_gib();
enemy dodamage(enemy.health * 2, enemy.origin, self);
}
}
wait .01;
}
}
else
{
self.protector delete();
self.protectorfx delete();
self notify( "Stop_Protector" );
}
}