SA-MP Forums Archive
NPC Help. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: NPC Help. (/showthread.php?tid=613924)



NPC Help. - SpikY_ - 02.08.2016

Hello, Its me again, I am using Kruence NPC creator but the problem is... After creating NPC, It automatically gets connected to server and I am using Roleplay script where NPC gets stuck in Tutorial and then They never spawn, I also tried TogglePlayerSpectating But no desire results.

EDIT: its only happen when i Create NPC in Vehicle. Onfoot spawns and work fine.


Re: NPC Help. - SpikY_ - 02.08.2016

Ok So now I tried something, and the NPC spawned successfully but now, Its on foot instead NPC should be inside the vehicle as i recorded it inside Vehicle...


Re: NPC Help. - Sew_Sumi - 02.08.2016

Even though you recorded it in a vehicle, you still need to place the NPC in that vehicle, and commence the playback.

Quote:

I am using Roleplay script where NPC gets stuck in Tutorial and then They never spawn

And that is because you're not checking whether the player connecting to the script, is an NPC and avoiding the hang that's happening. After all the script will be waiting for something like a login or something else, so it stops them spawning.

Then they will simply sit there.


Re: NPC Help. - SpikY_ - 02.08.2016

Look, I have placed the NPC inside the Vehicle on Its spawn...

PHP код:
public OnVehicleSpawn(vehicleid)
{
public 
OnPlayerConnect(playerid)
{
    if(
IsPlayerNPC(playerid))
    {
         
TogglePlayerSpectating(playerid0);
         new 
npcname[MAX_PLAYER_NAME];
         
GetPlayerName(playeridnpcnamesizeof(npcname));
         if(!
strcmp(npcname"DevilBusNPC"true))
         {
              
PutPlayerInVehicle(playeridDevilBusNPCVehicle0);
         }
         return 
1;
     }
     return 
1;




Re: NPC Help. - Sew_Sumi - 02.08.2016

We'll start again shall we...



What happens currently, as we stand now.

You have an NPC that connects, spawns, and stands idle, wihtout being in the vehicle they should be, and without them doing the playback they are supposed to be. Correct?

Have you tried it on a clean script, such as GrandLarceny, without anything else loaded but the gamemode, and the NPC FS, and seen whether it's loading on that?


Re: NPC Help. - SpikY_ - 02.08.2016

Its working fine on Other clean gamemodes.


Re: NPC Help. - Sew_Sumi - 02.08.2016

That, again, is your gamemode, (or maybe another filterscript) holding it back somewhere. Maybe try disabling all FSes except for the game and the NPC script to check entirely.

There'll be something stopping it getting in a vehicle seeing as you've got it spawned (Depending on where it actually spawned).

You may want to compare GrandLarceny and its callbacks that check for the NPCs, to your gamemode, and see where you are possibly missing one or 2.