PDA

View Full Version : NPC Problem


andrejc999
13/10/2016, 03:29 PM
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;
}

Gotham
13/10/2016, 03:56 PM
Make it under OnPlayerRequestSpawn and also under OnPlayerConnect.Basicallu

//Under OnPlayerRequestSpawn
if(IsPlayerNPC(playerid))
{
print("NPC: Spawned.");
return 1;
}


OnPlayerConnect

//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

andrejc999
13/10/2016, 04:00 PM
Yeah thx I forgot about that, but my NPC still doesn't even attempt to connect. Idk why..

Gotham
13/10/2016, 04:02 PM
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!

andrejc999
13/10/2016, 04:06 PM
Nevermind I did something wrong but I've fixed it now... Thx for help