Stock errors from crashdetect +REP
#1

According to what the crashdetect prints there's a CallLocalFunction for the stock DMVMainDialog, The modelid in the format makes problems but i have no idea what to do anymore, i looked in some threads and the ' -400' might solve it but no solution yet -_-


When typing /buyout command:

Crashdetect prints:

Код:
[15/06/2014 22:21:33] [zcmd] [Costia Costia] [ 0 ]: /buyout
[15/06/2014 22:21:33] [debug] Run time error 4: "Array index out of bounds"
[15/06/2014 22:21:33] [debug]  Accessing element at negative index -400
[15/06/2014 22:21:33] [debug] AMX backtrace:
[15/06/2014 22:21:33] [debug] #0 0051dda4 in ?? () from CGRP.amx
[15/06/2014 22:21:33] [debug] #1 003ba458 in public cmd_buyout () from CGRP.amx
[15/06/2014 22:21:33] [debug] #2 native CallLocalFunction () [00472ad0] from samp-server.exe
[15/06/2014 22:21:33] [debug] #3 00013fd0 in public OnPlayerCommandText () from CGRP.amx
[15/06/2014 22:21:43] [debug] Run time error 4: "Array index out of bounds"
[15/06/2014 22:21:43] [debug]  Accessing element at negative index -400
[15/06/2014 22:21:43] [debug] AMX backtrace:
[15/06/2014 22:21:43] [debug] #0 0051dda4 in ?? () from CGRP.amx
[15/06/2014 22:21:43] [debug] #1 0051f944 in public OnDialogResponse () from CGRP.amx
The stock:

Код:
stock DMVMainDialog(playerid)
{
	new string[128];
	for(new i; i < MAX_PLAYERVEHICLES; i++)
	{
		slotselection[playerid] = -1;
		format(string, sizeof(string), "%s\n%s  Plate: %s", string, VehicleName[PlayerVehicleInfo[playerid][i][pvModelId] - 400], PlayerVehicleInfo[playerid][i][pvNumberPlate]);
		ShowPlayerDialog(playerid, DMV_BUYOUT, DIALOG_STYLE_LIST, "Buyout Impounded vehicles", string, "Choose", "Quit");
	}
	return 1;
}
Reply
#2

If the value of [I]PlayerVehicleInfo[playerid][pvModelId] is 0 and not between 400 and 611, the run time error 4 will be caused at the same negative index.

You can check if the value is 0 and skip it (inside the loop):
pawn Код:
if (!PlayerVehicleInfo[playerid][i][pvModelId]) continue;
Reply
#3

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
If the value of [I]PlayerVehicleInfo[playerid][pvModelId] is 0 and not between 400 and 611, the run time error 4 will be caused at the same negative index.

You can check if the value is 0 and skip it (inside the loop):
pawn Код:
if (!PlayerVehicleInfo[playerid][i][pvModelId]) continue;
Thanks! +REP
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)