#1

Hey everyone, i have a few questions about NPC's.

1. I have, 6 NPC's made, and only 3 of them spawns, whats wrong? the NPC limit is 50, so that cant be the problem.
2. How do i set the skin of a NPC??
Reply
#2

Could you show us some code please
Reply
#3

OnPlayerSpawn, use the check function known as: IsPlayerNPC

Then simply set the NPCs skin as if a normal player
Reply
#4

pawn Code:
public OnPlayerConnect(playerid){
if(IsPlayerNPC(playerid)) SpawnPlayer(playerid);
//other stuff
return 1;
}
Reply
#5

Quote:
Originally Posted by Kurence
pawn Code:
public OnPlayerConnect(playerid){
if(IsPlayerNPC(playerid)) SpawnPlayer(playerid);
//other stuff
return 1;
}
so... if its an NPC, the player will spawn? or...
Reply
#6

Quote:
Originally Posted by [SF
robmob ]
Could you show us some code please
And on the set skin

pawn Code:
public OnPlayerSpawn(playerid)
{
if(IsPlayerNPC(playerid))
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
if(!strcmp("npc name here",name,true))
{
SetPlayerSkin(playerid,npc skin here);
return 1;
}
}
return 1;
}

Edit:

Quote:
Originally Posted by laser50
so... if its an NPC, the player will spawn? or...
NPC's will always spawn automatically and choose the skin classid 0 by default. But i think it should be possible to program it to do it diffrent.

But by default it spawns itself
Reply
#7

Quote:
Originally Posted by Kurence
pawn Code:
public OnPlayerConnect(playerid){
if(IsPlayerNPC(playerid)) SpawnPlayer(playerid);
//other stuff
return 1;
}
The NPC will spawn on its own, no need for this extra code...
Like I said, just do a NPC check with OnPlayerSpawn and then change the skin that way etc.

EDIT: Perfect example is set by Desert with the OnPlayerSpawn stuff
Reply
#8

Quote:
Originally Posted by XGh0stz
Quote:
Originally Posted by Kurence
pawn Code:
public OnPlayerConnect(playerid){
if(IsPlayerNPC(playerid)) SpawnPlayer(playerid);
//other stuff
return 1;
}
The NPC will spawn on its own, no need for this extra code...
Like I said, just do a NPC check with OnPlayerSpawn and then change the skin that way etc.

EDIT: Perfect example is set by Desert with the OnPlayerSpawn stuff
No, on my server i have to spawn them, otherwise they will be flying at X:0 Y:0 Z:0
Reply
#9

i have setted the skins, but their is still only 3 NPC's showing up
Reply
#10

No code. So im just shooting


You forgot ConnectNPC? Or put it somewhere wrong?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)