SA-MP Forums Archive
I need help for Attacking NPC (+REP ) - 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)
+--- Thread: I need help for Attacking NPC (+REP ) (/showthread.php?tid=611513)



I need help for Attacking NPC (+REP ) - MarkNelson - 07.07.2016

Hi, i tried to fix those errors but i can't so i hope you to help me
here is the codes:
Code:
C:\Users\infogenie\Desktop\Zombies VS Humans V1.1\filterscripts\bot.pwn(67) : error 017: undefined symbol "GetPlayerid"
C:\Users\infogenie\Desktop\Zombies VS Humans V1.1\filterscripts\bot.pwn(240) : error 017: undefined symbol "CreateAttackingNPC"
lines here :
Code:
public OnPlayerSpawn(playerid)
{
        if(IsPlayerNPC(playerid))
	    {
        if(playerid == GetPlayerid("Attack_NPC")) SetTimer("AttackNPC", 5000, 0);
	    }
	    return 0;
}

forward AttackNPC();
public AttackNPC()
{
	CreateAttackingNPC("Attack_NPC",230,2052.1956 ,2173.7727, 10.8203);
	return 0;
}
i hope you to help me as soon as possible and +reputation for the person who helps me here


Re: I need help for Attacking NPC (+REP ) - Napst34 - 07.07.2016

Hello, Can I see the function GetPlayerid ?


Re: I need help for Attacking NPC (+REP ) - MarkNelson - 07.07.2016

You see it in OnPlayerSpawn Function check
and here is reputation for you. because you will help me


Re: I need help for Attacking NPC (+REP ) - Napst34 - 07.07.2016

Code:
 public OnPlayerSpawn(playerid)
{
  if(IsPlayerNPC(playerid))
  {
    new npc[MAX_PLAYER_NAME];
    GetPlayerName(playerid, npc, sizeof(npc)); 
    if(!strcmp(npcname, "Attack_NPC", true))
    {
      SetTimer("AttackNPC", 5000, 0);
    }
    return 1;
  }
  return 1;
}

But, I don't really understand what you want to do can you explain please?


Re: I need help for Attacking NPC (+REP ) - MarkNelson - 07.07.2016

now i have those errors
Code:
C:\Users\infogenie\Desktop\Zombies VS Humans V1.1\filterscripts\bot.pwn(69) : error 017: undefined symbol "npcname"
C:\Users\infogenie\Desktop\Zombies VS Humans V1.1\filterscripts\bot.pwn(247) : error 017: undefined symbol "CreateAttackingNPC"
anyway npcname is in your fixing line.
and about CreateAttackingNPC?
it's this
Code:
forward AttackNPC();
public AttackNPC()
{
	CreateAttackingNPC("Attack_NPC",230,2052.1956 ,2173.7727, 10.8203);
	return 0;
}



Re: I need help for Attacking NPC (+REP ) - Napst34 - 07.07.2016

Sorry try this


Code:

 public OnPlayerSpawn(playerid)
{
  if(IsPlayerNPC(playerid))
  {
    new npc[MAX_PLAYER_NAME];
    GetPlayerName(playerid, npc, sizeof(npc)); 
    if(!strcmp(npc, "Attack_NPC", true))
    {
      SetTimer("AttackNPC", 5000, 0);
    }
    return 1;
  }
  return 1;
}

But for the CreateAttackingNPC, I don't really understand what you want to do if the player is an npc and the npcname is Attack_NPC ^^


Re: I need help for Attacking NPC (+REP ) - MarkNelson - 07.07.2016

Please do anything help me i want createattackingnpc to attack players
and for his position


Re: I need help for Attacking NPC (+REP ) - MarkNelson - 07.07.2016

help please?


Re: I need help for Attacking NPC (+REP ) - Napst34 - 07.07.2016

So you want to create an NPC who will attack players..
https://sampwiki.blast.hk/wiki/Category:NPC


Re: I need help for Attacking NPC (+REP ) - MarkNelson - 07.07.2016

Okay ty. but how to set the NPC Position, Skin , and the allowed range to start attacking?
there is no CreateAttackingNPC or i need FCNPC?