Вопросы

Babur GTA-MP
Новичок

Hello, I have a small problem, when I use the / engine command it gives me these errors in server_log, how can I solve them?

[debug] Run time error 4: "Array index out of bounds"
 [debug] Attempted to read / write array element at negative index -1
[debug] AMX backtrace:
[debug] # 0 000c6490 in public OnPlayerStateChange (0, 2, 1) in roleplay.amx

OnPlayerStateChange:  https://pastebin.com/Dfv4RSpg

Command / engine:  https://pastebin.com/kxw106hQ

Thanks!

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


Ссылка на сообщение
Поделиться на другие сайты

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

  • 0
Babur GTA-MP
Новичок
15 часов назад, glvde. сказал:

Hello, @Babur GTA-MP!

In which machine ID do you use this command?

In any id, that is, bicycles and vehicles, I checked the bikes so that they don't work and they don't work, but they give this error, as well as for vehicles.

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


Ссылка на сообщение
Поделиться на другие сайты
  • 0
Babur GTA-MP
Новичок
6 часов назад, glvde. сказал:

@Babur GTA-MP, t hat is, when checking the bike gives this error, and on vehicles too?

Yes, it gives me this error on both vehicles and bikes, I noticed that I don't even have to use the command / engine to show me the error, it only appears to me when I enter a car / bike

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


Ссылка на сообщение
Поделиться на другие сайты
  • 0
𝙡𝙖𝙨𝙩 𝙚𝙢𝙥𝙚𝙧𝙤𝙧.
Создатель WayDev

Try to replace your public with mine, then see the logs and post them here:


p. s: correct the tab.
 

Спойлер

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if (IsPlayerNPC(playerid)) return 1;
	new engine,lights,alarm,doors,bonnet,boot,objective;
	new vehicleid = GetPlayerVehicleID(playerid);
	if (newstate == PLAYER_STATE_WASTED && PlayerData[playerid][pJailTime] < 1)
	{
	    for (new i = 34; i < 39; i ++) {
			PlayerTextDrawHide(playerid, PlayerData[playerid][pTextdraws][i]);
	    }
	    PlayerTextDrawHide(playerid, PlayerData[playerid][pTextdraws][82]);

	    PlayerData[playerid][pHealth] = 100.0;

	    ResetWeapons(playerid);
	    ResetPlayer(playerid);

	    if (!PlayerData[playerid][pInjured])
		{
	        PlayerData[playerid][pInjured] = 0;

	        PlayerData[playerid][pInterior] = GetPlayerInterior(playerid);
	    	PlayerData[playerid][pWorld] = GetPlayerVirtualWorld(playerid);
			PlayerData[playerid][pInjured] = 0;
		}
		if (PlayerData[playerid][pCallLine] != INVALID_PLAYER_ID)
		{
		    SendClientMessage(PlayerData[playerid][pCallLine], COLOR_YELLOW, "[PHONE]:{FFFFFF} The line went dead...");
		    CancelCall(playerid);
		}
		if (PlayerData[playerid][pCarryCrate] != -1)
		{
			Crate_Drop(playerid);
		}
      
      	printf("[ERROR] newstate == PLAYER_STATE_WASTED && PlayerData[playerid][pJailTime] < 1: newstate: %d, oldstate: %d, playerid: %d", newstate, oldstate, playerid);
	}
	if (oldstate == PLAYER_STATE_DRIVER)
	{
	    if (GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_CARRY || GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_CUFFED)
	        return RemoveFromVehicle(playerid);

	    for (new i = 34; i < 39; i ++)
			PlayerTextDrawHide(playerid, PlayerData[playerid][pTextdraws][i]);

		PlayerTextDrawHide(playerid, PlayerData[playerid][pTextdraws][82]);
      
      	printf("[ERROR] oldstate == PLAYER_STATE_DRIVER: newstate: %d, oldstate: %d, playerid: %d", newstate, oldstate, playerid);
	}
	if (newstate == PLAYER_STATE_DRIVER)
	{
	    new id = Car_GetID(vehicleid);

		if (id != -1 && CarData[id][carFaction] > 0 && GetFactionType(playerid) != CarData[id][carFaction]) {
		    RemovePlayerFromVehicle(playerid);

	    	return SendErrorMessage(playerid, "You don't have the keys to this vehicle.");
		}
		if (IsSpeedoVehicle(vehicleid))
		{
			if (PlayerData[playerid][pDisableSpeedo] == 0){
				for (new i = 35; i < 37; i ++) {
				PlayerTextDrawShow(playerid, PlayerData[playerid][pTextdraws][i]);
				}
 			}
 		}
		if (PlayerData[playerid][pJob] == JOB_COURIER && IsLoadableVehicle(vehicleid) && CoreVehicles[vehicleid][vehLoads] > 0)
		{
		    if (PlayerData[playerid][pLoading])
		    {
				DisablePlayerCheckpoint(playerid);
				PlayerData[playerid][pLoading] = 0;
			}
			static
			    string[64];

		    switch (CoreVehicles[vehicleid][vehLoadType])
			{
				case 1: format(string, sizeof(string), "~b~Loaded:~w~ Retail Supplies~n~~b~Loaded Crates:~w~ %d/6", CoreVehicles[vehicleid][vehLoads]);
		        case 2: format(string, sizeof(string), "~b~Loaded:~w~ Ammunition~n~~b~Loaded Crates:~w~ %d/6", CoreVehicles[vehicleid][vehLoads]);
                case 3: format(string, sizeof(string), "~b~Loaded:~w~ Clothing~n~~b~Loaded Crates:~w~ %d/6", CoreVehicles[vehicleid][vehLoads]);
                case 4: format(string, sizeof(string), "~b~Loaded:~w~ Food Supplies~n~~b~Loaded Crates:~w~ %d/6", CoreVehicles[vehicleid][vehLoads]);
                case 5: format(string, sizeof(string), "~b~Loaded:~w~ Gasoline~n~~b~Loaded Crates:~w~ %d/6", CoreVehicles[vehicleid][vehLoads]);
                case 6: format(string, sizeof(string), "~b~Loaded:~w~ Furniture~n~~b~Loaded Crates:~w~ %d/6", CoreVehicles[vehicleid][vehLoads]);
			}
		    PlayerTextDrawShow(playerid, PlayerData[playerid][pTextdraws][82]);
		    PlayerTextDrawSetString(playerid, PlayerData[playerid][pTextdraws][82], string);
		}
		if (CarData[id][carOwner] == GetPlayerSQLID(playerid)) {
		    new carsqlid = CarData[id][carVehicle], string[128];
			format(string, sizeof(string), "Vehiculul %s(ID:%d) este unul personal si esti proprietarul lui.", ReturnVehicleName(vehicleid), carsqlid);
			SendClientMessage(playerid, COLOR_LIGHTYELLOW, string);
		}
		else if (CarData[id][carOwner] != 0) {
			new string [128],
				carsqlid = CarData[id][carVehicle];
			format(string, sizeof(string), "Vehiculul %s(ID:%d) este unul personal si nu iti apartine.", ReturnVehicleName(vehicleid), carsqlid);
			SendClientMessage(playerid, COLOR_LIGHTYELLOW, string);
		}
	    if (IsVehicleImpounded(vehicleid)) {
	        RemovePlayerFromVehicle(playerid);
	        SendErrorMessage(playerid, "Acest vehicul este sub sechestru si nu poate fi condus.");
	    }
		if (IsDoorVehicle(vehicleid) && !Inventory_HasItem(playerid, "Car License") && !PlayerData[playerid][pDrivingTest]) SendErrorMessage(playerid, "Conduci un vehicul fara a detine o licenta auto.");
		if(vehEngine[vehicleid] == 0) {
			if (CoreVehicles[vehicleid][vehFuel] < 1) return GameTextForPlayer(playerid,"~r~~n~~n~~n~~n~~n~~n~~n~~n~Nu mai ai combustibil.",1500,3);
			GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
			SendClientMessage(playerid, COLOR_LIGHTYELLOW, "Foloseste /engine pentru a pornii masina.");
		    SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
		} else if(vehEngine[vehicleid] == 1) {
			GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
			SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
		}
		else if(IsABike2(vehicleid)) {
            TogglePlayerControllable(playerid, 1);
            vehEngine[vehicleid] = 1;
            GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
		    SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
		}
		SetPlayerArmedWeapon(playerid, 0);
      	printf("[ERROR] newstate == PLAYER_STATE_DRIVER: newstate: %d, oldstate: %d, playerid: %d", newstate, oldstate, playerid);
	}
	if ((oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER) && PlayerData[playerid][pPlayRadio])
	{
	    PlayerData[playerid][pPlayRadio] = 0;
	    StopAudioStreamForPlayer(playerid);
      	printf("[ERROR] (oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER) && PlayerData[playerid][pPlayRadio]: newstate: %d, oldstate: %d, playerid: %d", newstate, oldstate, playerid);
	}
	if (newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
	{
	    if (PlayerData[playerid][pBoombox] != INVALID_PLAYER_ID)
	    {
	        PlayerData[playerid][pBoombox] = INVALID_PLAYER_ID;
			StopAudioStreamForPlayer(playerid);
	    }
	    if (IsEngineVehicle(vehicleid) && CoreVehicles[vehicleid][vehRadio])
	    {
	        static
	            url[128];

			strunpack(url, CoreVehicles[vehicleid][vehURL]);

			StopAudioStreamForPlayer(playerid);
			PlayAudioStreamForPlayer(playerid, url);

			PlayerData[playerid][pPlayRadio] = 1;
		}
	    foreach (new i : Player) if (PlayerData[i][pSpectator] == playerid) {
     		PlayerSpectateVehicle(i, GetPlayerVehicleID(playerid));
		}
		if (PlayerData[playerid][pInjured] == 1)
		{
		    RemoveFromVehicle(playerid);
		}
      	
      	switch (GetPlayerWeapon(playerid)) {
	        case 22: SetPlayerArmedWeapon(playerid, GetPlayerWeapon(playerid));
			default: SetPlayerArmedWeapon(playerid, 0);
		}
      	printf("[ERROR] newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER: newstate: %d, oldstate: %d, playerid: %d", newstate, oldstate, playerid);
	}
	if (oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)
	{
		SetPlayerArmedWeapon(playerid, GetPlayerWeapon(playerid));
		SetPlayerArmedWeapon(playerid, 0);
	    foreach (new i : Player) if (PlayerData[i][pSpectator] == playerid) {
     		PlayerSpectatePlayer(i, playerid);
		}
      	printf("[ERROR] oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER: newstate: %d, oldstate: %d, playerid: %d", newstate, oldstate, playerid);
	}

	if (newstate == PLAYER_STATE_PASSENGER && IsPlayerInsideTaxi(playerid))
	{
	    new driverid = GetVehicleDriver(GetPlayerVehicleID(playerid));

	    PlayerData[playerid][pTaxiFee] = 5;
	    PlayerData[playerid][pTaxiTime] = 0;
	    PlayerData[playerid][pTaxiPlayer] = driverid;

	    SendServerMessage(driverid, "%s has entered your taxi as a passenger.", ReturnName(playerid, 0));
		SendServerMessage(playerid, "You have entered %s's taxi.", ReturnName(driverid, 0));
      	printf("[ERROR] newstate == PLAYER_STATE_PASSENGER && IsPlayerInsideTaxi(playerid): newstate: %d, oldstate: %d", newstate, oldstate);
	}
 	if (oldstate == PLAYER_STATE_PASSENGER && PlayerData[playerid][pTaxiTime] != 0 && PlayerData[playerid][pTaxiPlayer] != INVALID_PLAYER_ID)  LeaveTaxi(playerid, PlayerData[playerid][pTaxiPlayer]), printf("[ERROR] oldstate == PLAYER_STATE_PASSENGER && PlayerData[playerid][pTaxiTime] != 0 && PlayerData[playerid][pTaxiPlayer] != INVALID_PLAYER_ID: newstate: %d, oldstate: %d, playerid: %d", newstate, oldstate, playerid);
	
	if(newstate == PLAYER_STATE_PASSENGER) {
	    if (GetVehicleModel(vehicleid) == 431 || GetVehicleModel(vehicleid) == 437)  {
            SetPlayerPos(playerid, 2022.0273, 2235.2402, 2103.9536);
            SetPlayerTime(playerid, 00,00);
			SetPlayerFacingAngle(playerid, 0);
            SetCameraBehindPlayer(playerid);
            SetPlayerInterior(playerid, 1);
            Timer1[playerid] = SetTimerEx("HornA", 60000, 1, "i", playerid);
            Timer2[playerid] = SetTimerEx("HornB", 60500, 1, "i", playerid);
            Timer3[playerid] = SetTimerEx("STime", 60000, 1, "i", playerid);
	        IsInBus[playerid] = vehicleid;
          
          	printf("[ERROR] newstate == PLAYER_STATE_PASSENGER && GetVehicleModel(431 || 437): newstate: %d, oldstate: %d, playerid: %d", newstate, oldstate, playerid);
	    }
	}
	if(newstate == PLAYER_STATE_PASSENGER && GetVehicleModel(GetPlayerVehicleID(playerid)) == 582)
	{
     	SetPlayerPos(playerid, 1061.719727, -914.996704, 138.026016);
     	SetPlayerFacingAngle(playerid, 0);
        SetCameraBehindPlayer(playerid);
        SetPlayerInterior(playerid, 1);
		Intropic[playerid] = GetPlayerVehicleID(playerid);
      	printf("[ERROR] PLAYER_STATE_PASSENGER && GetVehicleModel(582): newstate: %d, oldstate: %d, playerid: %d", newstate, oldstate, playerid);
	}
	if(newstate == PLAYER_STATE_PASSENGER && GetVehicleModel(GetPlayerVehicleID(playerid)) == 519)
	{
     	SetPlayerPos(playerid, 1892.5037, -8156.8062, 2.4471);
     	SetPlayerFacingAngle(playerid, 0);
        SetCameraBehindPlayer(playerid);
        SetPlayerInterior(playerid, 1);
		IsInShml[playerid] = GetPlayerVehicleID(playerid);
      	printf("[ERROR] PLAYER_STATE_PASSENGER && GetVehicleModel(519): newstate: %d, oldstate: %d, playerid: %d", newstate, oldstate, playerid);
	}
	if(newstate == PLAYER_STATE_PASSENGER && GetVehicleModel(GetPlayerVehicleID(playerid)) == 416)
	{
     	SetPlayerPos(playerid, -813.1215, -1007.3622, 2525.9072);
     	SetPlayerFacingAngle(playerid, 0);
        SetCameraBehindPlayer(playerid);
        SetPlayerInterior(playerid, 1);
		InAmbulance[playerid] = GetPlayerVehicleID(playerid);
      	printf("[ERROR] PLAYER_STATE_PASSENGER && GetVehicleModel(416): newstate: %d, oldstate: %d, playerid: %d", newstate, oldstate, playerid);
	}
	if(newstate == PLAYER_STATE_PASSENGER && GetVehicleModel(GetPlayerVehicleID(playerid)) == 427)
	{
     	SetPlayerPos(playerid, 1384.0615, -2245.8015, 3006.4172);
     	SetPlayerFacingAngle(playerid, 0);
        SetCameraBehindPlayer(playerid);
        SetPlayerInterior(playerid, 1);
		InEnforcer[playerid] = GetPlayerVehicleID(playerid);
      	printf("[ERROR] PLAYER_STATE_PASSENGER && GetVehicleModel(427): newstate: %d, oldstate: %d, playerid: %d", newstate, oldstate, playerid);
	}
	if(newstate == PLAYER_STATE_PASSENGER && GetVehicleModel(GetPlayerVehicleID(playerid)) == 508)
	{
     	SetPlayerPos(playerid, -1503.1620, 2511.7263, 3207.6506);
     	SetPlayerFacingAngle(playerid, 0);
        SetCameraBehindPlayer(playerid);
        SetPlayerInterior(playerid, 1);
		InJourney[playerid] = GetPlayerVehicleID(playerid);
      	printf("[ERROR] PLAYER_STATE_PASSENGER && GetVehicleModel(508): newstate: %d, oldstate: %d, playerid: %d", newstate, oldstate, playerid);
	}
	if(newstate == PLAYER_STATE_PASSENGER && GetVehicleModel(GetPlayerVehicleID(playerid)) == 563)
	{
     	SetPlayerPos(playerid, -765.6241, 1596.5237, 3002.6099);
     	SetPlayerFacingAngle(playerid, 0);
        SetCameraBehindPlayer(playerid);
        SetPlayerInterior(playerid, 1);
		InRaindance[playerid] = GetPlayerVehicleID(playerid);
      	printf("[ERROR] PLAYER_STATE_PASSENGER && GetVehicleModel(563): newstate: %d, oldstate: %d, playerid: %d", newstate, oldstate, playerid);
	}
	return 1;
}

 

 

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

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


Ссылка на сообщение
Поделиться на другие сайты
  • 0
Babur GTA-MP
Новичок
13 часов назад, glvde. сказал:

Try to replace your public with mine, then see the logs and post them here:


p. s: correct the tab.
 

  code (close spoiler)

 

 

[22:08:12] [ERROR] oldstate == PLAYER_STATE_DRIVER: newstate:1, oldstate:2, playerid:0
[22:08:12] [ERROR] oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER: newstate:1, oldstate:2, playerid:0
 

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


Ссылка на сообщение
Поделиться на другие сайты
  • 0
𝙡𝙖𝙨𝙩 𝙚𝙢𝙥𝙚𝙧𝙤𝙧.
Создатель WayDev

The error remained the same?

UPD: Add the -d3 parameter to the pawn.cfg file. Next, compile the mod, run it, do the same steps and upload the log here.

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

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


Ссылка на сообщение
Поделиться на другие сайты
  • 0
Babur GTA-MP
Новичок

From compilation:

Header size: 24160 bytes
Code size: 3748152 bytes
Data size: 8682196 bytes
Stack / heap size: 262144 bytes; estimated max. usage = 64038 cells (256152 bytes)
Total requirements: 12716652 bytes

 

in server_log after error: [debug] # 0 00283ae4 in public OnPlayerStateChange (playerid = 0, newstate = 2, oldstate = 1) 

at E: \ New folder \ backup 14 01 2021 \ roleplay.pwn: 17133

he tells me it's the line: 17133

the line:

Spoiler

if (CarData [id] [carOwner] == GetPlayerSQLID (playerid)) {  //This is line 17133
            new carsqlid = CarData [id] [carVehicle], string [128]; 
            format (string, sizeof (string), "Vehiculul% s (ID:% d) este unul personal si esti proprietarul lui.", ReturnVehicleName (vehicleid), carsqlid); 
            SendClientMessage (playerid, COLOR_LIGHTYELLOW, string); 
        } else if (CarData [id] [carOwner]! = 0) {
                new string [128], 
                carsqlid = CarData [id] [carVehicle]; 
                format (string, sizeof (string), "Vehiculul% s (ID:% d) este unul personal si nu iti apartine.", ReturnVehicleName (vehicleid), carsqlid); 
                SendClientMessage (playerid, COLOR_LIGHTYELLOW, string); 
        }

 

Отредактировано пользователем Babur GTA-MP

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


Ссылка на сообщение
Поделиться на другие сайты
  • 0
𝙡𝙖𝙨𝙩 𝙚𝙢𝙥𝙚𝙧𝙤𝙧.
Создатель WayDev

@Babur GTA-MP, this is a more correct option:

GetPlayerSQLID(playerid) return PlayerData[playerid][pID];

is the pID variable being unloaded from the database?

UPD: sorry, for my bad english. i'm russian.

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

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


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

  • Последние посетители   0 пользователей онлайн

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

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

    • Korochansky
      От Korochansky
      Я рад объявить о выпуске первой публичной версии современной IDE с открытым исходным кодом под лицензией GPLv3 для разработки open.mp и SA-MP, которая отличается интеграцией с SAMPCTL, управлением зависимостями и встроенной поддержкой Git.
       
      Особенности:
      • Разработано специально для open.mp и SA-MP разработки.
      • Встроенная интеграция с SAMPCTL для создания, запуска и управления проектами.
      • Менеджер зависимостей для удобной установки и обновления серверных пакетов и компонентов.
      • Встроенная поддержка Git с индикаторами состояния репозитория и историей коммитов.
      • Маркеры истории изменений для отслеживания измененных и сохраненных строк.
      • Автоматическое сопоставление и выделение скобок
      • Предварительный просмотр цвета для значений RGBA и HEX прямо в редакторе.
      • Интеграция инструмента выбора цвета для быстрой вставки цветов в код Pawn.
      • Режим 'Разделенный редактор кода' для одновременной работы с несколькими файлами.
      • Дерево проекта, оптимизированное для крупных проектов.
      • Интегрированные панели вывода результатов сборки и консоли сервера.
      • Автоматический мониторинг и обновление файлов проектов.
      • Портативная версия (установка не требуется).
       
      В репозитории: https://github.com/daniilkorochansky/spawn
    • Margiela
      От Margiela
      устал от vs code + он часто конфликтует с маками, конкретно с версией M3(как у меня).
      имеются ли аналоги pawno на mac?