Problems with NPC (spawn problems)
#1

I cant spawn NPC's. I dont know why.
Here is the code of how I added it:

PHP Code:
ConnectNPC("[BOT]GroveStreet","NPC"); //This is on game mode init
    
if(IsPlayerNPC(playerid)) //OnPlayerSpawn
    
{
        
SetPlayerSkin(playerid,12);
        
GivePlayerWeapon(playerid,24,99999);
        return 
1;
    } 
I have file named "NPC" in my npcmodes and I have a file called "twinkisnpc" in my recordings.


I do not get any errors but it's not spawning them :/

my npc mode
PHP Code:
#include <a_npc>
main() {}
NextPlayBack()
{
    
StartRecordingPlayback(PLAYER_RECORDING_TYPE_ONFOOT,"NPC");
}
public 
OnRecordingPlaybackEnd()
{
    
NextPlayBack();
}
public 
OnNPCSpawn()
{
    
NextPlayBack();
}
public 
OnNPCExitVehicle()
{
    
StopRecordingPlayback();

It's connecting the NPC but not actually spawning it...
PHP Code:
[20:24:43] [npc:join] [BOT]GroveStreet has joined the server (0:127.0.0.1
Reply
#2

Well, you haven't set them up for spawning, For my NPC, in the npcmode it looks like this:


Code:
#define RECORDING "DealerNPC2" //This is the filename of your recording without the extension.
#define RECORDING_TYPE 2 //1 for in vehicle and 2 for on foot.

#include <a_npc>
main(){}
public OnRecordingPlaybackEnd() StartRecordingPlayback(RECORDING_TYPE, RECORDING);

#if RECORDING_TYPE == 1
  public OnNPCEnterVehicle(vehicleid, seatid) StartRecordingPlayback(RECORDING_TYPE, RECORDING);
  public OnNPCExitVehicle() StopRecordingPlayback();
#else
  public OnNPCSpawn() 
  {
                
		 SetMyPos(1091.7188,-1791.7927,13.6404); <------  Maybe try Putting this in yours?
		 StartRecordingPlayback(RECORDING_TYPE, RECORDING);
  }
#endif
Reply
#3

Is that in your npcmodes or in your GM?
Reply
#4

Npcmodes
Reply
#5

Thanks mate. I finally did it. It's just spawning correctly Just to add few more things in it and I will be one happy panda.
+rep!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)