Can't see my npc
#1

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.
Reply
#2

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

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"
Reply
#4

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

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 :)
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)