if(isPlayerInArea(i, checkCoords[j]))
public checkpointUpdate() { for(new i=0; i< MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { for(new j=0; j < MAX_POINTS; j++) { if(isPlayerInArea(i, checkCoords[j])) { if(playerCheckpoint[i]!=j) { DisablePlayerCheckpoint(i); SetPlayerCheckpoint(i, checkpoints[j][0],checkpoints[j][1],checkpoints[j][2],checkpoints[j][3]); playerCheckpoint[i] = j; } } else { if(playerCheckpoint[i]==j) { DisablePlayerCheckpoint(i); playerCheckpoint[i] = 999; } } } } } }
new Float:checkpoints[][MAX_POINTS] = { {-1605.5288,712.4097,13.8714,3.0}, //SFPDEnt {246.5015,109.1960,1003.2188,3.0}, //SFPDExit {-1606.3319,673.9650,-5.2422,3.0}, //DropOff {-1493.4175,920.0615,7.1875,3.0}, //BankEnt {2305.5889,-16.2092,26.7496,3.0}, //BankExit {2315.8198,-7.2530,26.7422,3.0}, //BankMain {-1222.6882,738.9059,6.6299,3.0}, //CIAEnt {288.6720,170.1256,1007.1794,3.0}, //CIAExit {238.6524,140.8584,1003.0234,3.0}, //CIAExit2 {297.5231,183.4510,1007.1719,3.0}, //CIASat {-1754.1787,962.3545,24.8828,3.0}, //FBIEnt {246.7218,63.4211,1003.6406,3.0}, //FBIExit {-2442.7930,754.4579,35.1719,3.0}, //SupaSaveEnt {6.2157,-30.8714,1003.5494,3.0}, //SupaSaveExit {1.6692,-28.4267,1003.5494,3.0}, //SupaSaveMain {-2099.6882,899.1699,76.7109,3.0}, //DrugHouseCaltonHeights {-2779.9194,0.3026,10.0625,3.0}, //DrugHouseOceanFlats {-2576.4824,818.9226,49.9844,3.0}, //DrugHouseParadiso {-2433.7866,1281.6011,23.7422,3.0}, //DrugHouseJuniperHollow {-1547.4066,123.6555,3.5547,5.0}, //ShipYard {-1657.7573,1210.2754,7.2500,3.0}, //OttoCP {-1923.3926,303.6380,41.0469,3.0}, //BombShop {-1308.1965,796.5082,6.6299,3.0}, //CIASatBlow {-1496.3555,796.4011,7.1875,3.0}, //CIABridge {373.0567,-65.5078,1001.5078,3.0}, //BurgerShotMain {370.7744,-6.5378,1001.8589,3.0}, //CluckinBellMain {294.0775,-40.7211,1001.5156,3.0}, //Ammunation {499.5635,-18.8676,1000.6719,3.0}, //GayDarMain {-2235.2788,130.4634,1035.4141,3.0}, //ZeroMain {495.6589,-75.4557,998.7578,3.0}, //MistysMain {754.6652,-41.0422,1000.5859,3.0}, //GYM {-2032.9712,-117.4418,1035.1719,3.0}, //School {-1951.9911,300.2070,35.4688,3.0}, //WangCars {-1972.4688,117.8655,27.6940,3.0}, //Train {421.5031,-76.8336,1001.8047,3.0}, //Barbers {-2765.7402,375.5952,6.3347,3.0}, //CityHall {-2658.3201,639.5060,14.4531,3.0}, //Hospital {-2656.2332,1416.1669,906.2734,3.0}, //Jizzys {376.7648,-119.4542,1001.4995,3.0}, //PizzaMain {162.8374,-83.6908,1001.8047,3.0}, //ZipMain {205.6493,-10.6077,1001.2109,3.0}, //VictimMain {206.2597,-100.7781,1005.2578,3.0}, //BincoMain {389.2351,173.7753,1008.3828,3.0}, //CityHallExit {362.0905,173.7759,1008.3828,3.0}, //CityHallMain {203.7577,-43.7601,1001.8047,3.0}, //Urban {-2184.0452,-247.6615,40.7195,3.0}, //drug factory rob cp {-2446.3860,522.7347,30.2109,3.0}, //mint enter cp {-1952.2209,644.4845,46.5625,3.0}, //zombotech robbery cp {-1988.7898,1117.7233,54.4724,3.0}, //Church robbery cp {2315.9861,-15.7272,26.7422,3.0} // bank robbery cp };
#define MAX_POINTS 60
[09:43:31] [debug] AMX backtrace: [09:43:31] [debug] #0 000bc6b4 in public checkpointUpdate () from SFCNR.amx [09:43:33] [debug] Run time error 4: "Array index out of bounds" [09:43:33] [debug] Accessing element at index 45 past array upper bound 44
new Float:checkpoints[][] = {
for(new j=0; j < sizeof checkpoints; j++)
This is bullshit.
Delete it. And declare it like this: PHP код:
PHP код:
![]() |
public checkpointUpdate()
{
for(new i; i<MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i)) continue;
for(new j; j < sizeof checkpoints; j++)
{
if(!IsPlayerInRangeOfPoint(i,4.0,checkpoints[j][0],checkpoints[j][1],checkpoints[j][2],checkpoints[j][3])) continue;
if(playerCheckpoint[i]!=j)
{
SetPlayerCheckpoint(i, checkpoints[j][0],checkpoints[j][1],checkpoints[j][2],checkpoints[j][3]);
playerCheckpoint[i] = j;
}
else DisablePlayerCheckpoint(i),playerCheckpoint[i] = 999;
}
}
}
if(!IsPlayerInRangeOfPoint(i,4.0,checkpoints[j][0],checkpoints[j][1],checkpoints[j][2],checkpoints[j][3])) continue;
if(!IsPlayerInRangeOfPoint(i,4.0,checkpoints[j][0],checkpoints[j][1],checkpoints[j][2])) continue;
//Edit: Ok you dont need this function, just write it like this:
PHP код:
|
Well, yes you have a brain or?
![]() PHP код:
|