if(PWarehouseCP[playerid] >= 0 && PlayerData[playerid][Job] == 2)
{
if(PWarehouseCP[playerid] == 2)
{
PWarehouseCP[playerid] = 10;
new randn = random(sizeof(WarehouseInteriorCP));
SetPlayerCheckpoint(playerid, WarehouseExteriorCP[randn][0], WarehouseExteriorCP[randn][1], WarehouseExteriorCP[randn][2], 1.0);
SetDestination(playerid, WarehouseExteriorCP[randn][0], WarehouseExteriorCP[randn][1], WarehouseExteriorCP[randn][2]);
return 1;
}
if(PWarehouseCP[playerid] == 10)
{
PWarehouseCurrent[playerid] ++;
PWarehouseCP[playerid] = 2;
new randn = random(sizeof(WarehouseExteriorCP));
SetPlayerCheckpoint(playerid, WarehouseInteriorCP[randn][0], WarehouseInteriorCP[randn][1], WarehouseInteriorCP[randn][2], 1.0);
SetDestination(playerid, WarehouseInteriorCP[randn][0], WarehouseInteriorCP[randn][1], WarehouseInteriorCP[randn][2]);
return 1;
}
if(PWarehouseCurrent[playerid] == 10)
{
SendClientMessage(playerid, COLOR_WHITE, "test");
PWarehouseCP[playerid] = 0;
PWarehouseCurrent[playerid] = 0;
IsWorking[playerid] = 0;
return 1;
}
return 1;
}
[00:45:26] [debug] Run time error 4: "Array index out of bounds"
[00:45:26] [debug] Accessing element at index 30 past array upper bound 10
[00:45:26] [debug] AMX backtrace:
[00:45:26] [debug] #0 0007da68 in ?? (0) from serverteste.amx
[00:45:26] [debug] #1 00008504 in public OnPlayerEnterCheckpoint (0) from serverteste.amx
PWarehouseCurrent[MAX_PLAYERS];
PWarehouseCP[MAX_PLAYERS];
new randn = random(sizeof(WarehouseExteriorCP));
new randn = random(sizeof(WarehouseInteriorCP));
Replace this
Code:
new randn = random(sizeof(WarehouseExteriorCP)); Code:
new randn = random(sizeof(WarehouseInteriorCP)); |