Thread Rating:
  • 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 4,015 10-02-2013, 19:26
Last Post: koren30
  Help need help?how to make plugins code hXnarutoXone 12 8,544 09-01-2013, 18:30
Last Post: Bandarigoda123
  Help Need Help with C# code tubwux 2 3,313 08-27-2013, 18:18
Last Post: tubwux
  [Request] Compile this code please dozsa0 4 4,132 08-10-2013, 21:02
Last Post: Nukem
  Compile this code please First_Semyon 12 9,681 08-08-2013, 14:53
Last Post: Bandarigoda123
  Compile please this code First_Semyon 8 5,637 07-28-2013, 01:52
Last Post: First_Semyon
  Code of vector Bloodfocus 1 2,411 06-23-2013, 11:54
Last Post: Yamato
  problem with gsc code CheGuevara 5 5,617 04-20-2013, 15:06
Last Post: Nekochan
Tongue [Request] read if you have a cs:go code:) rawr-saours 5 4,061 04-05-2013, 18:15
Last Post: SuperNovaAO
Smile Help Help me with a code (who knows) NyZzE 2 2,540 04-05-2013, 01:47
Last Post: NyZzE

Forum Jump:


Users browsing this thread:
2 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.