09.06.2015, 19:31
As the title says, I'm trying to make a dynamic dealership system in my server, but for some reason it doesn't work and Crash Detect gives me the "out of bounds" error.
This function is called whenever the player enters one of the dealership markers.
To be sure, here's the part of my OnPlayerEnterDynamicCP:
The dialog doesn't even show up either.
EDIT: Here's the error from the server:
This function is called whenever the player enters one of the dealership markers.
PHP код:
ShowDealerShipVehicles(playerid, dealershipid)
{
new dealershiptitle[128], vehiclestring[128], holder[512];
for(new i; i < sizeof(DealerShipVehicle); i++)
{
format(vehiclestring, sizeof(vehiclestring), "{FFFFFF}%s {FFFFFF}(%d)\n", vehiclestring, VehicleName(DealerShipVehicle[i][Model]), DealerShipVehicle[i][Price]);
strcat(holder, vehiclestring, sizeof(holder));
//if(DealerShipVehicle[i][DealerShipID] == dealershipid) {
//}
}
format(dealershiptitle, sizeof(dealershiptitle), "Vehicle Menu for %s!", DealerShipData[dealershipid][dsName]);
ShowPlayerDialog(playerid, DIALOG_DEALERSHIP_VEHICLES, DIALOG_STYLE_LIST, dealershiptitle, holder, "Buy", "Cancel");
return 1;
}
PHP код:
for(new i = 0; i < sizeof(DealerShipData); i++)
{
if(IsPlayerInRangeOfPoint(playerid, 1.5, DealerShipData[i][dsX], DealerShipData[i][dsY], DealerShipData[i][dsZ]))
{
watchingDealerShip[playerid] = i;
ShowDealerShipVehicles(playerid, watchingDealerShip[playerid]+1);
break;
}
}
EDIT: Here's the error from the server:
Код:
[21:26:41] [debug] Run time error 4: "Array index out of bounds" [21:26:41] [debug] Accessing element at negative index -400 [21:26:41] [debug] AMX backtrace: [21:26:41] [debug] #0 000471b8 in VehicleName (modelid=0) at crp.pwn:3048 [21:26:41] [debug] #1 000482b8 in ShowDealerShipVehicles (playerid=0, dealershipid=1) at crp.pwn:3375 [21:26:41] [debug] #2 00024224 in public OnPlayerEnterDynamicCP (playerid=0, checkpointid=21) at crp.pwn:1139