NPC Problem
#1

So guys I'm making a NPC system and I have a problem...

I want an NPC to drive a bus through the city so i made a recording and i made a code for the npc to connect and enter the vehicle (bus) but it doesn't seem that he is connecting at all idk why...

I checked in my script if there is like if(IsNPC(playerid)) return 0; but I didn't find it.

Here is the code:

Код:
//Under a timer (5 sec) that calls when gamemode starts..

ConnectNPC("BusVozac", "BuS");

//Under public OnPlayerConnect

	if(IsPlayerNPC(playerid))
	{
        printf("NPC: Connection is allowed.");
        return 1;
	}
Reply
#2

Make it under OnPlayerRequestSpawn and also under OnPlayerConnect.Basicallu
PHP код:
//Under OnPlayerRequestSpawn
   
if(IsPlayerNPC(playerid))
  {
     print(
"NPC: Spawned.");
     return 
1;
  } 
OnPlayerConnect
PHP код:
//Under OnPlayerConnect
  
if(IsPlayerNPC(playerid))
  {
     print(
"NPC:Connection is allowed");
     return 
1;
  } 
And also Try to make it "if(IsPlayerNPC(playerid)) return 1;" as you simply print it :P
Reply
#3

Yeah thx I forgot about that, but my NPC still doesn't even attempt to connect. Idk why..
Reply
#4

Don't make a timer for the NPC to connect.you may have forgot something in the timer which doesn't let the NPC connect!
Reply
#5

Nevermind I did something wrong but I've fixed it now... Thx for help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)