Вопросы

Maxim Bergman
Новичок

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

[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
m1n1vv
Свой человек
  В 1/25/2019 в 22:40, odosenok сказал:

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

Читать далее...  

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

 

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

if (targetid != INVALID_PLAYER_ID)

 

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


Ссылка на сообщение
  • 0
Maxim Bergman
Новичок

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

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

[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);

 

 

  В 1/29/2019 в 03:11, m1n1vv сказал:

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

 

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

if (targetid != INVALID_PLAYER_ID)

 

Читать далее...  

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

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

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


Ссылка на сообщение
  • 0
Maxim Bergman
Новичок
  В 1/30/2019 в 22:45, 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 пользователей онлайн

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

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

    • grizly57a
      От grizly57a
      вот логи 
       
       
      ---------- Loaded log file: "server_log.txt". ---------- SA-MP Dedicated Server ---------------------- v0.3.7-R2, (C)2005-2015 SA-MP Team [16:41:25] [16:41:25] Server Plugins [16:41:25] -------------- [16:41:25] Loading plugin: crashdetect.so [16:41:25] CrashDetect plugin 4.19.4 [16:41:25] Loaded. [16:41:25] Loading plugin: pawncmd.so [16:41:25] Pawn.CMD plugin v3.2.0 by urShadow has been loaded [16:41:25] Loaded. [16:41:25] Loading plugin: pawnraknet.so [16:41:25] [Pawn.RakNet] plugin v1.6.0 loading... [16:41:25] [Pawn.RakNet] | Pawn.RakNet 1.6.0 | 2016 - 2023 |-------------------------------- | Author and maintainer: katursis | Compiled: Feb 12 2023 at 19:35:06 |-------------------------------------------------------------- | Repository: https://github.com/katursis/Pawn.RakNet |-------------------------------------------------------------- | Wiki: https://github.com/katursis/Pawn.RakNet/wiki [16:41:25] Loaded. [16:41:25] Loading plugin: sscanf.so [16:41:25] [16:41:25] =============================== [16:41:25] sscanf plugin loaded. [16:41:25] Version: 2.8.3 [16:41:25] (c) 2018 Alex "Y_Less" Cole [16:41:25] =============================== [16:41:25] Loaded. [16:41:25] Loading plugin: streamer.so [16:41:25] *** Streamer Plugin v2.9.4 by Incognito loaded *** [16:41:25] Loaded. [16:41:25] Loading plugin: mysql_static.so [16:41:25] >> plugin.mysql: R39-6 successfully loaded. [16:41:25] Loaded. [16:41:25] Loading plugin: TOTP.so [16:41:25] TOTP plugin v1.0.1 by Games loaded. [16:41:25] Loaded. [16:41:25] Loading plugin: profiler.so [16:41:25] Profiler plugin 2.15.1 [16:41:25] Loaded. [16:41:25] Loading plugin: timerfix.so [16:41:25] >> TimerFix v1.5 successfully loaded. [16:41:25] Loaded. [16:41:25] Loading plugin: UTuning.so [16:41:25] Loaded. [16:41:25] Loading plugin: housecar.so [16:41:25] Loaded. [16:41:25] Loading plugin: TOTP.so [16:41:25] TOTP plugin v1.0.1 by Games loaded. [16:41:25] Loaded. [16:41:25] Loading plugin: FCNPC.so [16:41:25] [16:41:25] ------------------------------------------------- [16:41:25] FCNPC - Fully Controllable NPC v2.0.9 [16:41:25] GNU/Linux SA-MP 0.3.7 R2 [16:41:25] Apr 17 2024 at 09:11:36 [16:41:25] [16:41:25] Author: OrMisicL (2013 - 2015) [16:41:25] Continued by: ziggi (2016 - present) [16:41:25] [16:41:25] See full credits in the README.md file [16:41:25] ------------------------------------------------- [16:41:25] [16:41:25] Loading... [16:41:25] [16:41:25] ------------------------------------------------- [16:41:25] ColAndreasv1.4.0 [16:41:25] [16:41:25] Created By: [16:41:25] [uL]Chris42O [16:41:25] [uL]Slice [16:41:25] [uL]Pottus [16:41:25] ------------------------------------------------- [16:41:25] [16:41:25] Loading... [16:41:25] ColAndreas v1.4.0 Loaded. [16:41:25] Loaded. [16:41:25] Loaded 13 plugins. [16:41:25] [16:41:25] Filterscripts [16:41:25] --------------- [16:41:25] Loading filterscript 'voice.amx'... [16:41:25] No collision data found. [16:41:25] [FCNPC] Warning: Unable to create NPCs. The maxnpc limit in server.cfg is 0. [16:41:25] -------------------------------------- [16:41:25] VOICE COPY RADMIR BY ������ dev. [16:41:25] -------------------------------------- [16:41:25] Loaded 1 filterscripts. [16:41:25] *** Streamer Plugin: Include file version (0x295) does not match plugin version (0x294) (script might need to be recompiled with the correct include file). [16:41:25] ------------------------------------------ [16:41:25] SSSS [16:41:25] ------------------------------------------ [16:41:25] mapname = "San Andreas" (string) [16:41:25] [Vehicle]: ��� ������������ �������� ������� [16:41:25] [TP]: ��� �����/������ ������� [16:41:25] [ATM]: ��� ��������� ������� [16:41:25] ����������� � ���� ������ �� ������� [������� � ����� ������ ����������] [16:41:25] ----------------------------------------- [16:41:25] [16:41:25] [16:41:25] [16:41:25] ----------------------------------------- [16:41:25] Number of vehicle models: 55 [16:42:00] [connection] 93.159.241.195:2395 requests connection cookie. [16:42:01] [connection] incoming connection: 93.159.241.195:2395 id: 0 [16:42:02] [join] Dkak_wlaas has joined the server (0:93.159.241.195) [16:42:02] [part] Dkak_wlaas has left the server (0:2)