Вопросы

Всем доброй ночи, есть пару вопросов по ошибках из мода:

[00:07:48] [debug] Run time error 4: "Array index out of bounds"
[00:07:48] [debug]  Accessing element at index 65535 past array upper bound 235
[00:07:48] [debug] AMX backtrace:
[00:07:48] [debug] #0 007860e4 in PlayerTimer () at F:\CRMP\111 RP\gamemodes\111.pwn:42433
[00:07:48] [debug] #1 00553350 in public SecTimer () at F:\CRMP\111 RP\gamemodes\111.pwn:6312
[00:07:48] [debug] #2 00551a44 in public Timer_Unix () at F:\CRMP\1111 RP\gamemodes\111.pwn:6193

Строка 42433

format(td_str, sizeof(td_str), "%d~n~%d~n~%.2f~n~%.2f~n~%d~n~%d~n~%s~n~%d~n~%d$",p_info [targetid][pLevel],GetPlayerPing (targetid),PlayerHP [targetid],PlayerAP [targetid],GetPlayerAmmo (targetid),SpeedVehicle (targetid),p_info [ targetid ] [ pIP ],p_info [ targetid ] [ pWarn ],p_info [ targetid ] [ pCash ] ) ;

6312

for(new id = (AC_WARNLINE - 1); id >= 0; id--) if(warningPanelTime{id}) { if(--warningPanelTime{id} <= 0)

6193

unix_sec = unix+1;

Прошу помощи. Мод - OnlyRP v2

Отредактировано пользователем Maxim Bergman

Поделиться сообщением


Ссылка на сообщение

8 ответов на этот вопрос

  • 0

@Maxim Bergman, еще строки 235 не хватает.

Поделиться сообщением


Ссылка на сообщение
  • 0
12 минут назад, odosenok сказал:

@Maxim Bergman, еще строки 235 не хватает.

234:stock CreatePickupAC(model, type, Float:X, Float:Y, Float:Z, Virtualworld, action_type = PICKUP_ACTION_TYPE_NONE, action_id = PICKUP_ACTION_ID_NONE)
235:{

 

Поделиться сообщением


Ссылка на сообщение
  • 0

UP

 

UP!!

Заметка от Shakoladka , создано

Объединил сообщение

Поделиться сообщением


Ссылка на сообщение
  • 0
В 26.01.2019 в 00:40, odosenok сказал:

@Maxim Bergman, еще строки 235 не хватает.

Эээ. Это не строка.

 

В том паблике, весь код, где используется targetid, возьми в это условие:

if (targetid != INVALID_PLAYER_ID)

 

Поделиться сообщением


Ссылка на сообщение
  • 0

Прошу добавить в первое сообщение

Возникла ещё одна ошибка

[18:01:52] [debug] Run time error 4: "Array index out of bounds"
[18:01:52] [debug]  Accessing element at negative index -400
[18:01:52] [debug] AMX backtrace:
[18:01:52] [debug] #0 00555d0c in public UpdateSpeedometr (playerid=0) at F:\CRMP\1111 RP\gamemodes\u1111.pwn:6487
6487: 	format(fmt_vehicle_name, sizeof(fmt_vehicle_name), "%s",VehicleNames[model-400]);

model объявлен как 

new model = GetVehicleModel(vehicleid);

 

 

В 29.01.2019 в 06:11, m1n1vv сказал:

Эээ. Это не строка.

 

В том паблике, весь код, где используется targetid, возьми в это условие:


if (targetid != INVALID_PLAYER_ID)

 

Залил на сервер, попробуй посмотреть что будет.

Отредактировано пользователем Maxim Bergman

Поделиться сообщением


Ссылка на сообщение
  • 0

up

Поделиться сообщением


Ссылка на сообщение
  • 0

Полный паблик  UpdateSpeedometr скинь .

Поделиться сообщением


Ссылка на сообщение
  • 0
14 часов назад, Lil Pokemon сказал:

Полный паблик  UpdateSpeedometr скинь .

forward UpdateSpeedometr(playerid);
public UpdateSpeedometr(playerid)
{
	if(p_info[playerid][pAFK] >= 3 && GetPlayerState(playerid) != 2) return 1;
	new vehicleid = GetPlayerVehicleID(playerid);
	if(IsAPlane(vehicleid)==1 || IsABoat(vehicleid)==1 || IsAMoped(vehicleid)==1 || IsAVel(vehicleid)==1) return 1;
	new speed = SpeedVehicle(playerid) / 2;
	VehMileage[vehicleid] += float(speed) / 3600.0;

	new Float:health, heal;
	GetVehicleHealth(GetPlayerVehicleID(playerid), health);
	heal = floatround(health);
	
	if(speed >= GetPVarInt(playerid,"slimit") && GetPVarInt(playerid,"slimit") >= 10 && GetPVarInt(playerid,"slimit") <= 150)
	{
  		SetVehicleSpeed ( vehicleid, GetPVarInt(playerid,"slimit") );
	}
	
	new Float:vehhealth;
	GetVehicleHealth(vehicleid, vehhealth);
	if(vehhealth <= 400 && Engine[vehicleid] == true)
	{
		if(Engine[vehicleid] == true) SendErr(playerid, "Машина поломана, вызовите механика");
		Engine[vehicleid] = false;
		GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
		SetVehicleParamsEx(vehicleid,false,lights,alarm,doors,bonnet,boot,objective);
	}
	
	new _millage = floatround ( VehMileage[vehicleid] ), fmt_speed [ 24 ], fmt_speed_bar [ 128 ], fmt_fuel [ 24 ], fmt_hp [ 24 ], fmt_vehicle_name [ 48 ], fmt_mileage [ 24 ] ;
	
	format(fmt_speed, sizeof(fmt_speed), "%d KM/H", speed );
	PlayerTextDrawSetString(playerid, ptd_sp[playerid][2], fmt_speed);

	switch(speed)
	{
	    case 0: format(fmt_speed_bar, sizeof(fmt_speed_bar),"~w~IIIIIIIIIIIIIIIIIIIIIII");
	    case 1..9: format(fmt_speed_bar, sizeof(fmt_speed_bar),"~r~III~w~IIIIIIIIIIIIIIIIIIII");
	    case 10..19: format(fmt_speed_bar, sizeof(fmt_speed_bar),"~r~IIII~w~IIIIIIIIIIIIIIIIIII");
	    case 20..29: format(fmt_speed_bar, sizeof(fmt_speed_bar),"~r~IIIII~w~IIIIIIIIIIIIIIIIII");
	    case 30..39: format(fmt_speed_bar, sizeof(fmt_speed_bar),"~r~IIIIIII~w~IIIIIIIIIIIIIIII");
	    case 40..49: format(fmt_speed_bar, sizeof(fmt_speed_bar),"~r~IIIIIIIII~w~IIIIIIIIIIIIII");
	    case 50..59: format(fmt_speed_bar, sizeof(fmt_speed_bar),"~r~IIIIIIIIIIII~w~IIIIIIIIIII");
	    case 60..69: format(fmt_speed_bar, sizeof(fmt_speed_bar),"~r~IIIIIIIIIIIII~w~IIIIIIIIII");
	    case 70..79: format(fmt_speed_bar, sizeof(fmt_speed_bar),"~r~IIIIIIIIIIIIII~w~IIIIIIIII");
	    case 80..99: format(fmt_speed_bar, sizeof(fmt_speed_bar),"~r~IIIIIIIIIIIIIII~w~IIIIIIII");
	    case 100..114: format(fmt_speed_bar, sizeof(fmt_speed_bar),"~r~IIIIIIIIIIIIIIIII~w~IIIIII");
	    case 115..150: format(fmt_speed_bar, sizeof(fmt_speed_bar),"~r~IIIIIIIIIIIIIIIIIIIII~w~II");
	    default: format(fmt_speed_bar, sizeof(fmt_speed_bar),"~r~IIIIIIIIIIIIIIIIIIIIIII");
	}
	PlayerTextDrawSetString(playerid, ptd_sp[playerid][1], fmt_speed_bar);
	new model = GetVehicleModel(vehicleid);

	format
	(
	    fmt_fuel, sizeof(fmt_fuel),"%d л.",
		Fuel[vehicleid]
	);
	PlayerTextDrawSetString(playerid, ptd_sp[playerid][6], fmt_fuel);

	format
	(
	    fmt_hp,sizeof(fmt_hp),"%d HP",
		heal/10
	);
	PlayerTextDrawSetString(playerid, ptd_sp[playerid][10], fmt_hp);

	format
    (
        fmt_vehicle_name, sizeof(fmt_vehicle_name), "%s",
        VehicleNames[model-400]

    );
    PlayerTextDrawSetString(playerid, ptd_sp[playerid][22], fmt_vehicle_name);

    format
	(
		fmt_mileage, sizeof(fmt_mileage), "%d",
		_millage
    );
    PlayerTextDrawSetString(playerid, ptd_sp[playerid][13], fmt_mileage);

    PlayerTextDrawTextSize(playerid, ptd_sp[playerid][8], 546.6+health/1000.0*25, 0.0);
	PlayerTextDrawShow(playerid, ptd_sp[playerid][8]);

	PlayerTextDrawTextSize(playerid, ptd_sp[playerid][4], 505.1+Fuel[vehicleid]/100.0*25, 0.0);
	PlayerTextDrawShow(playerid, ptd_sp[playerid][4]);

	switch(Fuel[vehicleid])
	{
       case 0: PlayerTextDrawBoxColor(playerid,ptd_sp[playerid][4], COLOR_RED);
       case 1..10: PlayerTextDrawBoxColor(playerid,ptd_sp[playerid][4], COLOR_DARKORANGE);
       case 11..45: PlayerTextDrawBoxColor(playerid,ptd_sp[playerid][4], COLOR_LIGHTBLUE);
	}

	if ( IsLocked[GetPlayerVehicleID(playerid)] == true )
	{
		PlayerTextDrawColor(playerid, ptd_sp[playerid][19], COLOR_LIGHTGREEN);
		PlayerTextDrawShow(playerid, ptd_sp[playerid][19]);
	}
	else
	{
		PlayerTextDrawColor(playerid, ptd_sp[playerid][19], COLOR_RED);
		PlayerTextDrawShow(playerid, ptd_sp[playerid][19]);
	}
	if ( Engine[GetPlayerVehicleID(playerid)] == true )
	{
		PlayerTextDrawColor(playerid, ptd_sp[playerid][18], COLOR_LIGHTGREEN);
		PlayerTextDrawShow(playerid,ptd_sp[playerid][18]);
	}
	else
	{
		PlayerTextDrawColor(playerid,ptd_sp[playerid][18], COLOR_RED);
		PlayerTextDrawShow(playerid,ptd_sp[playerid][18]);
	}
	if ( Lights[GetPlayerVehicleID(playerid)] == true )
	{
		PlayerTextDrawColor(playerid, ptd_sp[playerid][20], COLOR_LIGHTGREEN);
		PlayerTextDrawShow(playerid,ptd_sp[playerid][20]);
	}
	else
	{
		PlayerTextDrawColor(playerid,ptd_sp[playerid][20], COLOR_RED);
		PlayerTextDrawShow(playerid,ptd_sp[playerid][20]);
	}

	new Float:_coord [ 3 ];
	GetVehicleVelocity ( vehicleid,_coord[0],_coord[1],_coord[2]);	
	new Float:v_speed = floatsqroot(floatpower(floatabs(_coord[0]), 2.0) + floatpower(floatabs(_coord[1]), 2.0) + floatpower(floatabs(_coord[2]), 2.0)) * 100.3  ;
	new Float:veh_health_now ;
	GetVehicleHealth( vehicleid,veh_health_now  ) ;
	GetVehicleRotation ( vehicleid, _coord [ 0 ],_coord[1],_coord[2]);
	if(vehicleid != 0)
	{
		if( veh_health_now - VehInfos [ vehicleid - 1 ] [ v_health ] == 0 )
		{
			if ( VehInfos [ vehicleid - 1 ] [ v_engine_boost ] > 0 )// ( _z_angle - VehInfos [ vehicleid - 1 ] [ v_old_zangle ] < 0.1 && _z_angle - VehInfos [ vehicleid - 1 ] [ v_old_zangle ] > - 0.1 )
			{
				if ( v_speed > 30 && ! IsVehicleDrivingBackwards ( vehicleid ) && ( _coord[2] - VehInfos [ vehicleid - 1 ] [ v_old_zangle ] < 1 && _coord[2] - VehInfos [ vehicleid - 1 ] [ v_old_zangle ] > - 1 ) )
				{
					if( GetVehicleSpeed ( vehicleid ) < max_veh_speed [ GetVehicleModel ( vehicleid ) - 400 ] - 50 && 30 > _coord [ 0 ] > - 30 && 15 > _coord [ 1 ] > - 15 )
					{
						if ( v_speed - VehInfos [ vehicleid - 1 ] [ v_old_speed ] < 3 && v_speed - VehInfos [ vehicleid - 1 ] [ v_old_speed ] > 0.6 )
						{
							SetVehicleSpeed ( vehicleid, v_speed + VehInfos [ vehicleid - 1 ] [ v_engine_boost ] * 20 ) ; // *5
							VehInfos [ vehicleid - 1 ] [ v_old_zangle ] = _coord[2] ;
						}
					}
					else
					{
						if ( v_speed - VehInfos [ vehicleid - 1 ] [ v_old_speed ] < 3 && v_speed - VehInfos [ vehicleid - 1 ] [ v_old_speed ] >= -1.5 && GetVehicleSpeed ( vehicleid ) < max_veh_speed [ GetVehicleModel ( vehicleid ) - 400 ] - 50 + VehInfos [ vehicleid - 1 ] [ v_engine_boost ] * 180 )
						{
							if (  30 > _coord [ 0 ] > - 30 && 15 > _coord [ 1 ] > - 15 )
							{
								SetVehicleSpeed ( vehicleid, v_speed + VehInfos [ vehicleid - 1 ] [ v_engine_boost ] * 15 ) ; // *2
								VehInfos [ vehicleid - 1 ] [ v_old_zangle ] = _coord[2] ;
							}
						}
					}
					VehInfos [ vehicleid - 1 ] [ v_old_speed ] = v_speed ;
				}
			}
			if ( VehInfos [ vehicleid - 1 ] [ v_brake_boost ] > 0 )
			{
				if ( VehInfos [ vehicleid - 1 ] [ v_old_speed ] > 40 && ( _coord[2] - VehInfos [ vehicleid - 1 ] [ v_old_zangle ] < 0.3 && _coord[2] - VehInfos [ vehicleid - 1 ] [ v_old_zangle ] > - 0.3 ) && 1000 >= GetTickCount() - player_holding_key_down [ playerid ] >= 150 )
				{
					SetVehicleSpeed ( vehicleid, v_speed - VehInfos [ vehicleid - 1 ] [ v_brake_boost ] * 2 ) ;
					VehInfos [ vehicleid - 1 ] [ v_old_zangle ] = _coord[2] ;
				}
				VehInfos [ vehicleid - 1 ] [ v_old_speed ] = v_speed ;
			}
		}
		VehInfos [ vehicleid - 1 ] [ v_old_zangle ] = _coord[2] ;
		VehInfos [ vehicleid - 1 ] [ v_health ] = veh_health_now ;
		VehInfos [ vehicleid - 1 ] [ v_old_speed ] = v_speed ;
	}
	return 1;
}

 

Поделиться сообщением


Ссылка на сообщение
Гость
Эта тема закрыта для публикации ответов.
  • Последние посетители   0 пользователей онлайн

    Ни одного зарегистрированного пользователя не просматривает данную страницу

  • Похожий контент

    • Mister Odin
      От Mister Odin
       
      new
       g_teleport_list[39][E_TELEPORT_LIST] = {  {"Спавн пгт.Батырево", 1802.3612, 2508.4824, 15.8887},  {"Спавн г.Арзамас", -113.5887, 977.7222, 12.0346},     {"Спавн г.Южный", 2744.2770, -2446.7246, 21.8988},     {"Центральный банк", 1852.020385,2040.791381,15.892713},  {"Рублёвка", -837.7783, 888.6161, 12.7232},  {"Казино", 1332.4252, 2358.7014, 17.6641},  {"Битва за контейнеры", 614.5167, 1722.3566, 12.0709},  {"Автосалон низкого класса", 2493.9616, -722.9544, 12.3315},  {"Автосалон среднего класса", 1407.7449, 455.4801, 13.1630},  {"Автосалон высокого класса", -14.0637, 2614.5664, 10.9892},   {"Мотосалон Harley Davidson", 785.720153, 750.465087, 12.000024},  {"Автошкола", 1909.174438,2227.679687,15.708162},  {"Военкомат", 1916.778564,2302.411376,15.574637},  {"Правительство области", -139.140975,593.789611,12.145712},  {"Отдел полиции №1 (ГИБДД)", 1906.805786,-2234.382812,11.257631},  {"Отдел полиции №2 (УМВД)", 2581.309326,-2416.139892,21.960090},  {"Отдел ФСБ", 1823.904663,2095.636718,15.848405},  {"Городская больница г.Арзамас", -285.797210,581.851562,12.120290},   {"СМИ", -317.708038,821.221679,13.051450},  {"Воинская часть", 1703.197265,1678.025878,15.279437},  {"Арзамасская ОПГ", 438.705322,1046.505126,12.002637},  {"Батыревская ОПГ", 1941.203857,2161.006591,15.705187},  {"Лыткаринская ОПГ", -2346.002441,75.257041,21.002962},  {"Шахта", 2381.5727, 1726.4451, -2.1506},  {"Завод", -1062.6697, 2204.1894, 38.0964},  {"Инкосация", 1864.1374, 2011.7136, 15.8546},  {"Транспортная Компания", 2362.1115, 1972.5627, 15.5530},  {"База механиков", 1840.918090,-118.025146,15.695312},  {"Курьерская служба доставки", 2764.509765,-2396.882568,21.890625},  {"Аренда автобуса(Южный)", 2771.041992,-2454.780761,21.845964},  {"Аренда автобуса(Арзамас)", -127.487670,943.652648,12.142824},   {"Аренда автобуса(Батырево)", 1798.986328,2529.591552,15.664262},  {"Гоночная трасса", -1568.7784, 1611.8305, 36.3971},  {"Дом на горе", -789.5397, -456.7479, 741.1422},  {"СТО и тюнинг-ателье", 1856.1375, -122.3266, 15.6888},  {"Аренда транспорта пгт.Батырево", 1763.641723,2255.673339,15.865348},  {"Аренда транспорта г.Арзамас", -36.923530,1360.673583,12.002090},  {"Аренда транспорта г.Южный", 1966.599975,-2603.943603,10.820312},  {"Тайный интерьер в Лыткарино", -2424.5818, 2846.3291, 40.7908} };