NPC don't want to shoot another NPC - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: NPC don't want to shoot another NPC (
/showthread.php?tid=258819)
NPC don't want to shoot another NPC -
SkizzoTrick - 01.06.2011
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.
Re: NPC don't want to shoot another NPC -
Sasino97 - 01.06.2011
Didn't you solve that by using foreach instead of for_npcs

I've already seen a topic like this -.-
Re: NPC don't want to shoot another NPC -
SkizzoTrick - 01.06.2011
It was another bug :P.
This is a different one

.
Re: NPC don't want to shoot another NPC -
Mauzen - 01.06.2011
Change Player to Character, as Player just loops through all real players, and Character includes NPCs. That might be the problem I think.
Respuesta: NPC don't want to shoot another NPC -
Rule111 - 01.06.2011
You have to determine if the player is a NPC or a real player.