SA-MP Forums Archive
npc crash - 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 crash (/showthread.php?tid=284954)



npc crash - Globe2009 - 21.09.2011

hello guys can you help me put the reconnect code in this so my npcs spawn and dont crash after onplayerconnect or disconnect lol

if(IsPlayerNPC(playerid))
{
SpawnPlayer(playerid);
return 1;
}


Re: npc crash - Davz*|*Criss - 21.09.2011

This code is wrongly defined, You must do that at OnPlayerSpawn callback, and SpawnPlayer OnPlayerConnect? I actually think too it would crash you, because if you spawn the player OnPlayerConnect who will put him in vehicle lol? Try it OnPlayerSpawn.


Re: npc crash - [MG]Dimi - 21.09.2011

Maybe under OnPlayerRequestSpawn?


Re: npc crash - sleepysnowflake - 21.09.2011

I did not got what you want from us.


Re: npc crash - Globe2009 - 21.09.2011

ok on player spawn lol sorry my bad this is what i got

if(IsPlayerNPC(playerid)) return 1;


Re: npc crash - [MG]Dimi - 21.09.2011

EDIT: My fault


Re: npc crash - Globe2009 - 21.09.2011

ok i changed this part of the npc code and they spawn now but seem to teleport around rather than walk

from this
if(IsPlayerConnected(i) && !IsPlayerNPC(i))

to this
if(IsPlayerConnected(i) && !IsPlayerNPC(0))
seems to have worked maybe


Re: npc crash - Davz*|*Criss - 21.09.2011

Do you even do at the right way?

If not, read kc's tutorial more carefully and you will get it.


Re: npc crash - Globe2009 - 21.09.2011

it was the anti cheat and yea it was turned off on requestclass so 0 turns it on if im not wrong idk im a newb
they are still teleporting around though lol


Re: npc crash - Kingunit - 21.09.2011

But the main problem is fixed?