NPC don't want to shoot another NPC
#1

pawn Код:
for_npcs(i)
    {
        if(guard[i] == 1)
        {
            for_npcs(u)
            {
                GetNPCPos(i,x,y,z);
                GetNPCPos(u,ux,uy,uz);
                if(IsPlayerInRangeOfPoint(i,15.0,ux,uy,uz))
                {
                    if(zombie[u] == 1)
                    {
                        SetNPCCameraFrontVector(i,ux,uy,uz);
                        NPC_ShotAt(i,ux,uy,uz-0.7);
                    }
                }
                else
                {
                    StopNPC(i);
                }
            }
            foreach(Player, p)
            {
                GetNPCPos(i,x,y,z);
                GetPlayerPos(p,px,py,pz);
                new pname[MAX_PLAYER_NAME];
                GetPlayerName(p,pname,sizeof(pname));
                if(IsPlayerInRangeOfPoint(p,15.0,x,y,z))
                {
                    if(zombiep[p] == 1)
                    {
                        NPC_ShotAt(i,px,py,pz-0.7);
                    }
                }
                else
                {
                    StopNPC(i);
                }
            }
        }
He is shooting at me but his not shooting to another NPC ...lol

EDIT:He is getting the angle to where is the other NPC but he just don't shoots.
Reply
#2

Didn't you solve that by using foreach instead of for_npcs I've already seen a topic like this -.-
Reply
#3

It was another bug :P.
This is a different one .
Reply
#4

pawn Код:
foreach(Player, p)
Change Player to Character, as Player just loops through all real players, and Character includes NPCs. That might be the problem I think.
Reply
#5

You have to determine if the player is a NPC or a real player.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)