Lag problem
#1

Hi, when the cars spawn much lag. What is the problem ?
I'm sorry for my bad English.


Code:
public OnVehicleSpawn(vehicleid)
{
for(new h = 1; h < MAX_EV; h++)
{
	    for(new x = 1; x < _a@SL; x++)
		{
		    if(EvIslem[h][aracCount][x] != 0)
		    {
		    
		        ChangeVehicleColor(EvIslem[h][aracCount][x], EvIslem[h][aracRenk1][x],EvIslem[h][aracRenk2][x]);
		    
            	if(EvIslem[h][aracPaintjobuVarmi][x] != 0)
				{
				ChangeVehiclePaintjob(EvIslem[h][aracCount][x], EvIslem[h][aracPaintjob][x]);
				}
				
				for (new i; i < 14; i++)
				{
				RemoveVehicleComponent(EvIslem[h][aracCount][x], GetVehicleComponentInSlot(EvIslem[h][aracCount][x], i));
				}
				
				if(EvIslem[h][aracModifiyeParca1][x] != 0)
				{
				AddVehicleComponent(EvIslem[h][aracCount][x], EvIslem[h][aracModifiyeParca1][x]);
				}
				if(EvIslem[h][aracModifiyeParca2][x] != 0)
				{
				AddVehicleComponent(EvIslem[h][aracCount][x], EvIslem[h][aracModifiyeParca2][x]);
				}
				if(EvIslem[h][aracModifiyeParca3][x] != 0)
				{
				AddVehicleComponent(EvIslem[h][aracCount][x], EvIslem[h][aracModifiyeParca3][x]);
				}
				if(EvIslem[h][aracModifiyeParca4][x] != 0)
				{
				AddVehicleComponent(EvIslem[h][aracCount][x], EvIslem[h][aracModifiyeParca4][x]);
				}
				if(EvIslem[h][aracModifiyeParca5][x] != 0)
				{
				AddVehicleComponent(EvIslem[h][aracCount][x], EvIslem[h][aracModifiyeParca5][x]);
				}
				if(EvIslem[h][aracModifiyeParca6][x] != 0)
				{
				AddVehicleComponent(EvIslem[h][aracCount][x], EvIslem[h][aracModifiyeParca6][x]);
				}
				if(EvIslem[h][aracModifiyeParca7][x] != 0)
				{
				AddVehicleComponent(EvIslem[h][aracCount][x], EvIslem[h][aracModifiyeParca7][x]);
				}
				if(EvIslem[h][aracModifiyeParca8][x] != 0)
				{
				AddVehicleComponent(EvIslem[h][aracCount][x], EvIslem[h][aracModifiyeParca8][x]);
				}
				if(EvIslem[h][aracModifiyeParca9][x] != 0)
				{
				AddVehicleComponent(EvIslem[h][aracCount][x], EvIslem[h][aracModifiyeParca9][x]);
				}
				if(EvIslem[h][aracModifiyeParca10][x] != 0)
				{
				AddVehicleComponent(EvIslem[h][aracCount][x], EvIslem[h][aracModifiyeParca10][x]);
				}
				if(EvIslem[h][aracModifiyeParca11][x] != 0)
				{
				AddVehicleComponent(EvIslem[h][aracCount][x], EvIslem[h][aracModifiyeParca11][x]);
				}
				if(EvIslem[h][aracModifiyeParca12][x] != 0)
				{
				AddVehicleComponent(EvIslem[h][aracCount][x], EvIslem[h][aracModifiyeParca12][x]);
				}
				if(EvIslem[h][aracModifiyeParca13][x] != 0)
				{
				AddVehicleComponent(EvIslem[h][aracCount][x], EvIslem[h][aracModifiyeParca13][x]);
				}
				if(EvIslem[h][aracModifiyeParca14][x] != 0)
				{
				AddVehicleComponent(EvIslem[h][aracCount][x], EvIslem[h][aracModifiyeParca14][x]);
				}
			}
		}
	}
    return 1;
}
Reply
#2

Simply: To many "for"`s.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)