Posts: 143
Threads: 40
Joined: Aug 2014
Hi guys.
I would like to know how we can force a npc to spawn. I have a RP gamemode i added a NPC for a command im making it appears on the console he connects but i cant see any new id's ingame and he doesnt spawn. Any sugestions?
cumpz
vasco
Posts: 928
Threads: 13
Joined: Feb 2016
Reputation:
0
You can't see the ID's of NPC in the players list (aka tab) but make sure you are in the correct world where the NPC is spawned.
Posts: 519
Threads: 21
Joined: Nov 2012
Reputation:
0
NPCs start at like ID 0 since they usually connect/spawn before any players do.
Posts: 143
Threads: 40
Joined: Aug 2014
Quote:
Originally Posted by CalvinC
Make sure you don't try to show the login/register dialogs to it, and even if it spawned it probably spawned at coodinates 0, 0, 0.
Add something like this:
Код:
public OnPlayerConnect(playerid)
{
if(IsPlayerNPC(playerid))
{
SetPlayerPos(playerid, x, y, z); // Replace with the coordinates he should spawn at
return 1;
}
// The rest of your code
}
|
Hum i did that and it still doesnt spawn him cuz id 0 should be him like it says on the console but when i join im the id 0 and the bot just doesnt exist. Imma leave here the scripts:
OnGamemodeInit:
PHP код:
deliveryplane = CreateVehicle(512,-13.0069,-122.7030,2.0356,85.8541,0,0,0);
ConnectNPC("deliveryguy", "delivery");
OnPlayerConnect
PHP код:
if(IsPlayerNPC(playerid))
{
SetPlayerPos(playerid, -13.0069,-122.7030,2.0356); // Replace with the coordinates he should spawn at
return 1;
}
// the rest of the login script is here
OnPlayerSpawn
PHP код:
if(IsPlayerNPC(playerid))
{
new npcname[MAX_PLAYER_NAME];
GetPlayerName(playerid, npcname, sizeof(npcname));
if(!strcmp(npcname, "deliveryguy", true))
{
PutPlayerInVehicle(playerid, deliveryplane, 0);
}
return 1;
}
Please can anyone help me?
Posts: 143
Threads: 40
Joined: Aug 2014
28.04.2016, 17:29
(
Последний раз редактировалось GunZsmd; 28.04.2016 в 18:28.
)
anyone??
Posts: 143
Threads: 40
Joined: Aug 2014
plz i really need this npc can anyone help me? ill +rep
Posts: 143
Threads: 40
Joined: Aug 2014
Well it didnt spawn. But imma give up trying to use NPC's it was suppost to be like a command that a player did and then a NPC delivered them the materials he asked for. All was ready but NPC aint working so imma go for like airdroping a crate. But thanks i +rep u guys
thx rly for trying