Question

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

[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

Edited by Maxim Bergman

Share this post


Link to post

8 answers to this question

  • 0

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

Share this post


Link to post
  • 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:{

 

Share this post


Link to post
  • 0

UP

 

UP!!

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

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

Share this post


Link to post
  • 0
В 26.01.2019 в 00:40, odosenok сказал:

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

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

 

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

if (targetid != INVALID_PLAYER_ID)

 

Share this post


Link to post
  • 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)

 

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

Edited by Maxim Bergman

Share this post


Link to post
  • 0

up

Share this post


Link to post
  • 0

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

Share this post


Link to post
  • 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;
}

 

Share this post


Link to post
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • JAFAR
      By JAFAR
      Удалил полностью все объекты с города Батырево
      вы спросите зачем я это сделал?
      Я вам отвечу я хотел удалить все города с карты CRMP но затея не оправдала себя
      так как я хотел сделать единый город с 0 на crmp 0.3e ну потом я подумал и решил бросить затею
      так как это долго и нудно и смысл не вижу дальше продолжать!
       
      Если хотите что бы я продолжил делать дело с вас Like.
      Скриншоты проделанной работы:
       
      Желаю вам удачи!
      Удалённый батырево.txt
    • Jadyn Allen
      By Jadyn Allen
      Всем привет! Купил Мод Moscow RolePlay, поставил на хост, захожу и тут бац! Пишет что подключился и сразу выкидывает с сервера с переподключением с ошибкой LШ connection to the server. Reconnecting crmp. Кто сможет помочь буду благодарен