how to spawn npc?
#5

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(playeridnpcnamesizeof(npcname));
    if(!
strcmp(npcname"deliveryguy"true))
    {
      
PutPlayerInVehicle(playeriddeliveryplane0);
    }
    return 
1;
  } 
Please can anyone help me?
Reply


Messages In This Thread
how to spawn npc? - by GunZsmd - 27.04.2016, 22:45
Re: how to spawn npc? - by oMa37 - 28.04.2016, 05:32
Re: how to spawn npc? - by itsCody - 28.04.2016, 05:46
Re: how to spawn npc? - by CalvinC - 28.04.2016, 05:46
Respuesta: Re: how to spawn npc? - by GunZsmd - 28.04.2016, 16:30
Respuesta: how to spawn npc? - by GunZsmd - 28.04.2016, 17:29
Respuesta: how to spawn npc? - by GunZsmd - 28.04.2016, 19:11
Re: how to spawn npc? - by thaKing - 28.04.2016, 20:08
Respuesta: how to spawn npc? - by GunZsmd - 28.04.2016, 20:24

Forum Jump:


Users browsing this thread: 1 Guest(s)