• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Request How to improve this code?
#1
Hello,
I have a problem with this code. The zombies follow when they see my head! I wish they would follow me without seeing me, that is always on the move players! (I should note that this command works)


PHP Code:
GetBestPlayerAndMoveTo( )
{
self endon("bot_death");

    for(;;)
    {
        
TmpDist 99999999999;
        
pTarget undefined;

        
player undefined;
        for(
i=0;i<level.players.size;i++)
        {
        
player level.players[i];
            if(!
isAlive(player))
                continue;
                
            if(
level.teamBased && self.team == player.pers["team"])
                continue;
                
            if( !
bulletTracePassedself getTagOrigin"j_head" ), player getTagOrigin"j_head" ), falseself ) )
                continue;
                
            if(
player.sessionstate != "playing")
                continue;
                
            if(
distancesquared(self.originplayer.origin) < TmpDist)
            {
                
TmpDist distancesquared(self.originplayer.origin);
                
pTarget player;
            }
        }

        
movetoLoc VectorToAnglespTarget getTagOrigin("j_head") - self getTagOrigin"j_head" ) );
        
self.angles = (0movetoLoc[1], 0);
        
        
self MoveTo(pTarget.origin, (distance(self.originpTarget.origin) / 150));
        
    
wait 0.08;
    }


  Reply
#2
Code:
GetBestPlayerAndMoveTo( )
{
self endon("bot_death");

    for(;;)
    {
        TmpDist = 99999999999;
        pTarget = undefined;

        player = undefined;
        for(i=0;i<level.players.size;i++)
        {
        player = level.players[i];
            if(!isAlive(player))
                continue;
                
            if(level.teamBased && self.team == player.pers["team"])
                continue;
                
            if(player.sessionstate != "playing")
                continue;
                
            if(distancesquared(self.origin, player.origin) < TmpDist)
            {
                TmpDist = distancesquared(self.origin, player.origin);
                pTarget = player;
            }
        }

        movetoLoc = VectorToAngles( pTarget getTagOrigin("j_head") - self getTagOrigin( "j_head" ) );
        self.angles = (0, movetoLoc[1], 0);
        
        self MoveTo(pTarget.origin, (distance(self.origin, pTarget.origin) / 150));
        
    wait 0.08;
    }

}
[Image: b_560_95_1.png]
  Reply
#3
Thanks, this is your code Tongue
  Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Help Code color crosshairs koren30 3 1,487 10-02-2013, 19:26
Last Post: koren30
  Help need help?how to make plugins code hXnarutoXone 12 2,906 09-01-2013, 18:30
Last Post: Bandarigoda123
  Help Need Help with C# code tubwux 2 1,236 08-27-2013, 18:18
Last Post: tubwux
  [Request] Compile this code please dozsa0 4 1,549 08-10-2013, 21:02
Last Post: Nukem
  Compile this code please First_Semyon 12 3,359 08-08-2013, 14:53
Last Post: Bandarigoda123
  Compile please this code First_Semyon 8 2,051 07-28-2013, 01:52
Last Post: First_Semyon
  Code of vector Bloodfocus 1 799 06-23-2013, 11:54
Last Post: Yamato
  problem with gsc code CheGuevara 5 1,594 04-20-2013, 15:06
Last Post: Nekochan
Tongue [Request] read if you have a cs:go code:) rawr-saours 5 1,563 04-05-2013, 18:15
Last Post: SuperNovaAO
Smile Help Help me with a code (who knows) NyZzE 2 919 04-05-2013, 01:47
Last Post: NyZzE

Forum Jump:


Users browsing this thread: 1 Guest(s)