NPc's - 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's (
/showthread.php?tid=134929)
NPc's -
laser50 - 18.03.2010
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??
Re: NPc's -
[SF]RobMob - 18.03.2010
Could you show us some code please
Re: NPc's -
XGh0stz - 18.03.2010
OnPlayerSpawn, use the check function known as: IsPlayerNPC
Then simply set the NPCs skin as if a normal player
Re: NPc's -
Kurence - 18.03.2010
pawn Code:
public OnPlayerConnect(playerid){
if(IsPlayerNPC(playerid)) SpawnPlayer(playerid);
//other stuff
return 1;
}
Re: NPc's -
laser50 - 18.03.2010
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...
Re: NPc's -
Desert - 18.03.2010
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
Re: NPc's -
XGh0stz - 18.03.2010
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
Re: NPc's -
Kurence - 18.03.2010
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
Re: NPc's -
laser50 - 18.03.2010
i have setted the skins, but their is still only 3 NPC's showing up
Re: NPc's -
Desert - 18.03.2010
No code. So im just shooting
You forgot ConnectNPC? Or put it somewhere wrong?