Рекомендованные сообщения



9 posts in this topic

Было всё в порядке но потом обратил внимание на это в логах,предположительно началось после того как создал транспорт на продажу.

Очень надеюсь на вашу помощь 

[09:45:10] [debug] Run time error 4: "Array index out of bounds"
[09:45:10] [debug]  Attempted to read/write array element at index 65535 in array of size 1000
[09:45:10] [debug] AMX backtrace:
[09:45:10] [debug] #0 006b01c0 in J_AddStaticVehicleEx (model=904, Float:x=56.22650, Float:y=1002.40002, Float:z=11.51420, Float:a=183.88000, color_1=0, color_2=0, spawntime=60000, interior=0, world=0) at C:\Users\123123\Downloads\ffff\ffff\gamemodes\ffff.pwn:56143
[09:45:10] [debug] #1 00431878 in public fo_OnGameModeInit () at C:\Users\123123\Downloads\ffff\ffff\gamemodes\ffff.pwn:10045
[09:45:10] [debug] #2 00009800 in public SSCANF_OnGameModeInit () at C:\Users\123123\Downloads\ffff\ffff\pawno\include\fixobject.inc:266
[09:45:10] [debug] #3 000035f8 in public OnGameModeInit () at C:\Users\123123\Downloads\ffff\ffff\pawno\include\sscanf2.inc:205
[09:45:10] _____________________________________________________________________
[09:45:10]  QQQQWWWWWQQQ X
[09:45:10] (vk.com/m22vtw) © 2018 (FFFF FFFFF)
[09:45:10] _____________________________________________________________________
[09:45:10] Number of vehicle models: 11

#0 006b01c0 in J_AddStaticVehicleEx

J_AddStaticVehicleEx(model,Float:x,Float:y,Float:z,Float:a,color_1,color_2,spawntime = 300,interior = 0,world = 0)
{
	new carid = AddStaticVehicleEx(model, x, y, z, a, color_1, color_2, spawntime);
	VehicleInfo[carid][vAntiRepair]=2;
	VehicleInfo[carid][vLock]=0;
	//VehicleHealth[carid] = 1000;
	VehicleInfo[carid][vModel] = model;
	VehicleInfo[carid][vPos_X] = x;
	VehicleInfo[carid][vPos_Y] = y;
	VehicleInfo[carid][vPos_Z] = z;
	VehicleInfo[carid][vPos_A] = a;
	VehicleInfo[carid][vColor_1] = color_1;
	VehicleInfo[carid][vColor_2] = color_2;
	VehicleInfo[carid][vSpawnTime] = spawntime;
	LinkVehicleToInterior(carid, interior);
	SetVehicleVirtualWorld(carid, world);
	VehicleInfo[carid][vTuning] = GetVehicleTuningState( model );
	switch(model)
	{
	case 430, 446, 452, 453, 454, 472, 473, 484, 493: VehicleState[carid] = VEHICLE_STATE_BOAT;
	case 417, 425, 447, 460, 469, 476, 487, 488, 497, 511, 512, 513, 519, 520, 548, 553,
		563, 577, 592, 593:  VehicleState[carid] = VEHICLE_STATE_PLANE;
	case 581, 522, 461, 521, 523, 463, 468, 471, 586: VehicleState[carid] = VEHICLE_STATE_BIKE;
	case 509, 481, 510: VehicleState[carid] = VEHICLE_STATE_VELIK;
	case 462,448: VehicleState[carid] = VEHICLE_STATE_MOPED;
	case 538, 537: VehicleState[carid] = VEHICLE_STATE_TRAIN;
	default: VehicleState[carid] = VEHICLE_STATE_CAR;
	}
	return carid;
}

#1 00431878 in public fo_OnGameModeInit

	//Загрузка автомобилей
	for(new i = 0;i < OWNABLECARS;i ++)
	{
		OwnableCar[i] = J_AddStaticVehicleEx(CarInfo[i][cModel],CarInfo[i][cPos_X],CarInfo[i][cPos_Y],CarInfo[i][cPos_Z],CarInfo[i][cPos_A],CarInfo[i][cColor_1],CarInfo[i][cColor_2],60000);
		CarText[i] = CreateDynamic3DTextLabel("-",-1,0,0,0.5,5.0,INVALID_PLAYER_ID,OwnableCar[i]);
		ReSetCarPrice(i);
		new number = OwnableCar[i];
		new virt = CarInfo[i][cVirt];
		if(!GetString(CarInfo[i][cOwner],"The State")) SetVehicleVirtualWorld(number, virt);

	}
	

 

Edited by edikzver
Причина: Дополнил

Share this post


Link to post
Share on other sites

@edikzver, ты пытался создать транспорт с моделью 904. Такой в SA и CR не существует. Поэтому транспорт не был создан и в carid записалось значение INVALID_VEHICLE_ID (= 65535). Далее система искала эту ячейку в массиве, но не нашла, ведь VehicleInfo размером с 1000, что меньше, чем 65535. Получается и выход за пределы массива. Достаточно добавить проверку на то, верна ли модель транспорта:

Спойлер

 


J_AddStaticVehicleEx(model,Float:x,Float:y,Float:z,Float:a,color_1,color_2,spawntime = 300,interior = 0,world = 0)
{
	if(model < 400 || model > 611)
		return INVALID_VEHICLE_ID;
	
	new carid = AddStaticVehicleEx(model, x, y, z, a, color_1, color_2, spawntime);
	VehicleInfo[carid][vAntiRepair]=2;
	VehicleInfo[carid][vLock]=0;
	//VehicleHealth[carid] = 1000;
	VehicleInfo[carid][vModel] = model;
	VehicleInfo[carid][vPos_X] = x;
	VehicleInfo[carid][vPos_Y] = y;
	VehicleInfo[carid][vPos_Z] = z;
	VehicleInfo[carid][vPos_A] = a;
	VehicleInfo[carid][vColor_1] = color_1;
	VehicleInfo[carid][vColor_2] = color_2;
	VehicleInfo[carid][vSpawnTime] = spawntime;
	LinkVehicleToInterior(carid, interior);
	SetVehicleVirtualWorld(carid, world);
	VehicleInfo[carid][vTuning] = GetVehicleTuningState( model );
	switch(model)
	{
		case 430, 446, 452, 453, 454, 472, 473, 484, 493: VehicleState[carid] = VEHICLE_STATE_BOAT;
		case 417, 425, 447, 460, 469, 476, 487, 488, 497, 511, 512, 513, 519, 520, 548, 553,
			563, 577, 592, 593:  VehicleState[carid] = VEHICLE_STATE_PLANE;
		case 581, 522, 461, 521, 523, 463, 468, 471, 586: VehicleState[carid] = VEHICLE_STATE_BIKE;
		case 509, 481, 510: VehicleState[carid] = VEHICLE_STATE_VELIK;
		case 462,448: VehicleState[carid] = VEHICLE_STATE_MOPED;
		case 538, 537: VehicleState[carid] = VEHICLE_STATE_TRAIN;
		default: VehicleState[carid] = VEHICLE_STATE_CAR;
	}
	return carid;
}

 

Share this post


Link to post
Share on other sites

@TalexУ вы не успел проверить :)  теперь это хотя я ничего не создавал даже бд от транспорта и теперь это ..

[13:12:27] [debug] Run time error 4: "Array index out of bounds"
[13:12:27] [debug]  Attempted to read/write array element at negative index -1
[13:12:27] [debug] AMX backtrace:
[13:12:27] [debug] #0 004e5610 in IsAOwnableCar (carid=781) at C:\Users\123123\Downloads\fffff\fffff\gamemodes\fffff.pwn:15812
[13:12:27] [debug] #1 004dffdc in public OnVehicleSpawn (vehicleid=781) at C:\Users\123123\Downloadys\fffff\fffff\fffff\fffff.pwn:15355
[13:12:27] [debug] #2 native SetVehicleToRespawn () from samp-server-cr.exe
[13:12:27] [debug] #3 004b43d8 in public fo_OnGameModeInit () at C:\Users\123123\Downloads\fffff\fffff\gamemodes\fffff.pwn:11979
[13:12:27] [debug] #4 00009800 in public SSCANF_OnGameModeInit () at C:\Users\123123\Downloads\fffff\fffff\pawno\include\fffff.inc:266
[13:12:27] [debug] #5 000035f8 in public OnGameModeInit () at C:\Users\123123\Downloads\fffff\fffffpawno\include\sscanf2.inc:205

 

Share this post


Link to post
Share on other sites

@edikzver, покажи, где вызывается эта функция при старте сервера.

Edited by Talex

Share this post


Link to post
Share on other sites

@Talex Какая именно?9_9

Share this post


Link to post
Share on other sites

@edikzverJ_AddStaticVehicleEx. 

Share this post


Link to post
Share on other sites

@Talex 

	for(new i = 0;i < OWNABLECARS;i ++)
	{
		OwnableCar[i] = J_AddStaticVehicleEx(CarInfo[i][cModel],CarInfo[i][cPos_X],CarInfo[i][cPos_Y],CarInfo[i][cPos_Z],CarInfo[i][cPos_A],CarInfo[i][cColor_1],CarInfo[i][cColor_2],60000);
		CarText[i] = CreateDynamic3DTextLabel("-",-1,0,0,0.5,5.0,INVALID_PLAYER_ID,OwnableCar[i]);
		ReSetCarPrice(i);
		new number = OwnableCar[i];
		new virt = CarInfo[i][cVirt];
		if(!GetString(CarInfo[i][cOwner],"The State")) SetVehicleVirtualWorld(number, virt);

	}

Вот ещё с его участием нашел  (странное значение olor_1],CarInfo[vehid][cColor_1],100000);)

for(new vehid;vehid < OWNABLECARS;vehid++)
	{
		if(!GetString(CarInfo[vehid][cOwner],"The State"))
		{
		    if(GetDistance(CarInfo[vehid][cPos_X],CarInfo[vehid][cPos_Y],CarInfo[vehid][cPos_Z],2368.9749,2436.7090,5018.39) > 200)
		    {
				if(CarInfo[vehid][cShtraf]==0) CarInfo[vehid][cShtrafer] += GLS[1];
				else CarInfo[vehid][cShtraf] += GLS[1]*2;
			}
			if(CarInfo[vehid][cShtraf]>120000 || CarInfo[vehid][cShtrafer]>60000)
			{
				CarInfo[vehid][cPos_X] = CarInfo[vehid][cSell_X];
				CarInfo[vehid][cPos_Y] = CarInfo[vehid][cSell_Y];
				CarInfo[vehid][cPos_Z] = CarInfo[vehid][cSell_Z];
				CarInfo[vehid][cPos_A] = CarInfo[vehid][cSell_A];
				CarInfo[vehid][cColor_1] = 1;
				CarInfo[vehid][cColor_2] = 1;
                CarInfo[vehid][cVirt] = 0;
				new bool:qu = true,str[254];
				foreach(p)
				{
					if(!strcmp(CarInfo[vehid][cOwner],PN(p),true))
					{
						if(IsPlayerLogged[p])
						{
							SendClientMessage(p,COLOR_BLUE,"За неоплату счетов у вас отобрали личный автомобиль!");
							GiveMoney(p,CarInfo[vehid][cCost]);
							qu = false;
							break;
						}
					}
				}
				if(qu)
				{
					format(str, sizeof(str), "UPDATE `usrboston` SET `Money`=`Money`+'%d' WHERE `NickName` = '%s'; ",CarInfo[vehid][cCost], CarInfo[vehid][cOwner]);
					mysql_tquery(mysql, str);
				}
				//aml(51, -1, CarInfo[vehid][cOwner], "отобрали машину за неуплату налогов", CarInfo[vehid][cCost]);
				SetString(CarInfo[vehid][cOwner], "The State");
				SetString(CarInfo[vehid][cKeyer], "The State");
				CarInfo[vehid][cShtrafer] = 0;

				CarInfo[vehid][cNumberColor] = 0;
				SetString(CarInfo[vehid][cNumber],"SA");
				SetString(CarInfo[vehid][cOnNumber],"The State");
				SetString(CarInfo[vehid][cOnRegister],"The State");
				SetString(CarInfo[vehid][cRegister],"The State");
				ReSetCarPrice(vehid);
				CarInfo[vehid][cLock] = 0;
				CarInfo[vehid][cShtraf] = 0;
				CarInfo[vehid][cKeyIN] = 0;
				CarInfo[vehid][cAlarmON] = 0;
				CarInfo[vehid][cMilage] = 0;
				CarInfo[vehid][cVirt] = 0;
			//	CarInfo[vehid][cInt] = 0;
				DestroyVehicleEx(OwnableCar[vehid]);
				J_AddStaticVehicleEx(CarInfo[vehid][cModel],CarInfo[vehid][cPos_X],CarInfo[vehid][cPos_Y],CarInfo[vehid][cPos_Z],CarInfo[vehid][cPos_A],CarInfo[vehid][cColor_1],CarInfo[vehid][cColor_1],100000);
				//SetVehicleNumberPlate(vehid,"SA");
				VehicleInfo[OwnableCar[vehid]][vAntiRepair]=2;
				VehicleHealth[OwnableCar[vehid]] = 1000;
				DelTunCar(OwnableCar[vehid]);
				SetVehicleToRespawn(OwnableCar[vehid]);
				SetVehicleVirtualWorld(OwnableCar[vehid],CarInfo[vehid][cVirt]);
			//	LinkVehicleToInterior(OwnableCar[vehid],CarInfo[vehid][cVirt]);
				SaveOwnableCar(vehid);
				format(string,sizeof(string),"< Штраф Стоянка > Машина %d была продана в гос.",vehid);
				SendAdminsMessage(COLOR_RED,string,1);
			}
		}
		SaveOwnableCar(vehid);
	}
	return true;

 

Share this post


Link to post
Share on other sites

Вообщем я не знаю что это было но факт в том что оно само прошло :dance::dance::beer2:

Не знаю с чем это связано,но единственное что я сделал,это отключил crashdetect,запустил сервер,потом по новой подключил crashdetect и флуда нет ,я не знаю как это воспринимать O.o,

Share this post


Link to post
Share on other sites

Ничего там не прошло. Crashdetect Вам показал, что есть ситуация, когда происходит выход за пределы массива. Рано или поздно эта ситуация повториться. Не хватает проверки на валидность... В принципе, это не столь страшно и его вообще можно отключить.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • Alexey_Astrovskiy
      By Alexey_Astrovskiy
      Помогите перенести мигалки с ексайтинга(не пиар) в свой мод.