PDA

Просмотр полной версии : [Вопрос] [debug] проблема с арендой транспорта



Vasya_Pupkin
01.10.2016, 13:12
[13:42:21] [debug] Run time error 4: "Array index out of bounds"
[13:42:21] [debug] Accessing element at index 65535 past array upper bound 63
[13:42:21] [debug] AMX backtrace:
[13:42:21] [debug] #0 0055495c in public OnVehicleSpawn (vehicleid=138) at E:\[1] gamemodes\test.pwn:39132
[13:42:21] [debug] #1 native SetVehicleToRespawn () from samp-server.exe
[13:42:21] [debug] #2 0051dd20 in public cmd_unrentcar (playerid=0, params[]=@0240ed74 "") at E:\[1] gamemodes\test.pwn:35747



Строка 39132

ArendKey[ArendInfo[vehicleid-ArendCar[0]][aRentID]] = INVALID_VEHICLE_ID;
как выглядит

if(IsAArendCar(vehicleid))
{
ArendKey[ArendInfo[vehicleid-ArendCar[0]][aRentID]] = INVALID_VEHICLE_ID;
ArendInfo[vehicleid-ArendCar[0]][aRentID] = INVALID_PLAYER_ID;
}

stock IsAArendCar

stock IsAArendCar(carid)
{
if(carid >= ArendCar[0] && carid <= ArendCar[ARENDCARS-1]) return true;
return false;
}

Строка 35747

SetVehicleToRespawn(vehid);
сама команда

CMD:unrentcar(playerid, params[])
{
if(ArendKey[playerid] == INVALID_VEHICLE_ID) return false;
new car = ArendKey[playerid];
new vehid = ArendCar[0] + car;
if(ArendInfo[car][aRentID] == playerid)
{
ArendInfo[car][aRentID] = INVALID_PLAYER_ID;
SetVehicleToRespawn(vehid);//строка 35747
}
ArendKey[playerid] = INVALID_VEHICLE_ID;
SendClientMessage(playerid, COLOR_RED, ""gbError"[Информация] {FFFFFF}Вы отказались от аренды транспорта");
return true;
}

DeimoS
01.10.2016, 14:21
http://pro-pawn.ru/showthread.php?12957