SA-MP Forums Archive
Can't see my 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)
+--- Thread: Can't see my npc (/showthread.php?tid=403600)



Can't see my npc - PDChaseOfficial - 30.12.2012

Hey guys.

I am creating an npc but I cant see him when he spawns.

my npc code (its a small code. he is just a stationary dude :P):
Код:
#include <a_npc>
main() {}
gamemode code:
Код:
public OnGameModeInit()
{
    ConnectNPC("Player","NPC") // im pretty sure the "NPC" is right as I have it in the correct folder
}

public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid)) // it does write "NPC spawned" in my console all the time
    {
	printf("NPC Spawned");
	SetPlayerPos(playerid,pos_insurance); // pos_insurance is 100% right. can't be more sure.
	SetPlayerSkin(playerid,12);
    }
}

public OnPlayerConnect(playerid)
{
    if(IsPlayerNPC(playerid)) return 1; // due to login system
}

public OnPlayerRequestClass(playerid,classid)
{
    if(IsPlayerNPC(playerid)) return 1;
}
Gives me no errrors || warnings (see what I did there?)

Thanks for any help attempt.


Re: Can't see my npc - Threshold - 30.12.2012

Look in your server.cfg is there a max_npc limit?? Make sure that is at least 1.


Re: Can't see my npc - PDChaseOfficial - 30.12.2012

Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
Look in your server.cfg is there a max_npc limit?? Make sure that is at least 1.
Did that. "maxnpc 10"


Re: Can't see my npc - hydravink - 31.12.2012

Can you please post pos_insurace? There might be some errors, even though you're sure about it. Just saying.


Re: Can't see my npc - -=Dar[K]Lord=- - 31.12.2012

well instead of return 1; on OnRequestClass in npc replace it with

pawn Код:
public OnPlayerRequestClass(playerid,classid)
{
    if(IsPlayerNPC(playerid))
    {
          SpawnPlayer(playerid);
          printf("A NPC Has beed spawned while its on onrequestclass");// this will ensure that this npc is spawned :)
    }
}