Mass NPC Creation problem - Crash error?
#1

Hi.

I was trying to efficently and quickly make npc's rather than doing them one by one by one etc. And when i went to test my script, i get a rather depressing crash report from samp. I am sure it is my scripting which is the problem so i am hoping someone can give me a solution or fix this problem.

Note: All variables have been defined and do not return errors.


Код:
	new i = 0;
	new script[50];
	while(i<50)
	{
	new Randomscript = random(5);

	format(NConnect,sizeof(NConnect),"NVehicle%d",i);
	format(script,sizeof(script),"car%d",Randomscript);
	ConnectNPC(NConnect[i],script[i]);
	halt(20);
	}
On 'OnPlayerSpawn'
Код:
	if(IsPlayerNPC(playerid))
	{
	new RandomCar = random(6);



	if (RandomCar == 0)
	{
  	new Float:x, Float:y, Float:z;
  	GetPlayerPos(playerid, x, y, z);
	NCar[playerid]=CreateVehicle(400,x,y,z,0,0,1,1);
	}

	if (RandomCar == 1)
	{
  	new Float:x, Float:y, Float:z;
  	GetPlayerPos(playerid, x, y, z);
	NCar[playerid]=CreateVehicle(404,x,y,z,0,0,1,1);
	}

	if (RandomCar == 2)
	{
  	new Float:x, Float:y, Float:z;
  	GetPlayerPos(playerid, x, y, z);
	NCar[playerid]=CreateVehicle(410,x,y,z,0,0,1,1);
	}

	if (RandomCar == 3)
	{
  	new Float:x, Float:y, Float:z;
  	GetPlayerPos(playerid, x, y, z);
	NCar[playerid]=CreateVehicle(421,x,y,z,0,0,1,1);
	}

	if (RandomCar == 4)
	{
  	new Float:x, Float:y, Float:z;
  	GetPlayerPos(playerid, x, y, z);
	NCar[playerid]=CreateVehicle(439,x,y,z,0,0,1,1);
	}

	if (RandomCar == 5)
	{
  	new Float:x, Float:y, Float:z;
  	GetPlayerPos(playerid, x, y, z);
	NCar[playerid]=CreateVehicle(445,x,y,z,0,0,1,1);
	}

	PutPlayerInVehicle(playerid,NCar[playerid],0);

	return 1;
	}
I am possibly thinking that it maybe that i am trying to halt a script in a while loop which may cause some kind of conflict i guess? If so is there anyway to get around this or fix it?

The Idea:


The idea is that i use a few path recordings to make plenty of NPC's to use so i make the road look busy.

Edit:

This is the serverlog when i start the server. I have done these npcs on grandlarc just so you know.

Quote:

SA-MP Dedicated Server
----------------------
v0.3a R3, ©2005-2009 SA-MP Team

[00:23:05]
[00:23:05] Server Plugins
[00:23:05] --------------
[00:23:05] Loaded 0 plugins.

[00:23:05]
[00:23:05] Filter Scripts
[00:23:05] ---------------
[00:23:05] Loaded 0 filter scripts.

[00:23:07] --- Server Shutting Down.

Reply


Messages In This Thread
Mass NPC Creation problem - Crash error? - by millzyman - 07.12.2009, 10:09
Re: Mass NPC Creation problem - Crash error? - by DJDhan - 07.12.2009, 11:27
Re: Mass NPC Creation problem - Crash error? - by millzyman - 07.12.2009, 18:05
Re: Mass NPC Creation problem - Crash error? - by Joe Staff - 07.12.2009, 18:31
Re: Mass NPC Creation problem - Crash error? - by millzyman - 07.12.2009, 18:53

Forum Jump:


Users browsing this thread: 1 Guest(s)