Hmm,npc attacking the other NPC instead me.
#1

pawn Code:
new Float:x,Float:y,Float:z;
    new Float:px,Float:py,Float:pz;
    for(new p = 0;p < MAX_PLAYERS;p++)
    {
        for_npcs(i)
        {
            if(guard[i] == 1)
            {
                GetNPCPos(i,x,y,z);
                GetPlayerPos(p,px,py,pz);
                if(IsPlayerInRangeOfPoint(p,12.0,x,y,z))
                {
                    NPC_ShotAt(i,px,py,pz);
                }
            }
        }
    }
So this is what i mean,im trying to make a function that will make the NPC attack all the players in range but:

I also made a function that makes a NPC protect me and his coming with me anywhere but now,i have a problem.

If i spawn a Guard NPC,his not going to shoot me.If i also spawn a Protecting NPC wich will follow me,the Guard will attack him instead me,lol.
Why?
Reply
#2

Since I'm kind of new I can't really understand your function too well but try changing it so the NPC will search for other players within range rather than NPC's. Also try using Foreach it makes things a tad simpler.
Reply
#3

Quote:
Originally Posted by PCheriyan007
View Post
Since I'm kind of new I can't really understand your function too well but try changing it so the NPC will search for other players within range rather than NPC's. Also try using Foreach it makes things a tad simpler.
I tried that too but unfortunatelly it is not working...
Reply
#4

Foreach worked :X:X
Thank you Chariyan,moderators can close this topic,thank you.
Reply
#5

Your welcome, just trying to help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)