Вопросы

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

Hello, @Babur GTA-MP!

In which machine ID do you use this command?

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


Ссылка на сообщение
Поделиться на другие сайты
  • 0
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, that is, when checking the bike gives this error, and on vehicles too?

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


Ссылка на сообщение
Поделиться на другие сайты
  • 0
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

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
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

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

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

What is GetPlayerSQLID? Show this function.

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


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

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

pID is id player in database.

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


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

@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 пользователей онлайн

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

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

    • 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} };