Jump to content

Question

Posted

Problemă întâlnită (descriere):Crashdetect mi-a gasit niste erori.
Ero(area / rile) / warning-(ul / urile):http://pastebin.com/nbdYr0BL
Liniile de cod / sursa / script-ul:mai sus
Imagini / Video (optional):-
Aţi încercat să rezolvaţi singur?:nu am stiut cum.

 

 

7 answers to this question

Recommended Posts

  • Administrator
Posted

La functia "CarCheck" ai un "array" care trece de limita lui.

 

[pawn][03:54:07] [debug] #0 0003e188 in public CarCheck () from facut.amx
[03:54:08] [debug] Run time error 4: "Array index out of bounds"[/pawn]

Posted

Ok, inteleg... dar sunt cam incepator...

[pawn]public CarCheck()
{
new string[256];
for(new j = 0; j {
if(IsPlayerConnected(j))
{
new Float:health;
GetPlayerHealth(j, health);
if(STDPlayer[j]==1)
{
GetPlayerHealth(j, health);
SetPlayerHealth(j, health - 5.0);
SendClientMessage(j, COLOR_WHITE, "* Lost 4 health due to STD.");
}
else if(STDPlayer[j]==2)
{
GetPlayerHealth(j, health);
SetPlayerHealth(j, health - 12.0);
SendClientMessage(j, COLOR_WHITE, "* Lost 8 health due to STD.");
}
else if(STDPlayer[j]==3)
{
GetPlayerHealth(j, health);
SetPlayerHealth(j, health - 20.0);
SendClientMessage(j, COLOR_WHITE, "* Lost 12 health due to STD.");
}

if(GetPlayerMoney(j) < 0)
{
if(MoneyMessage[j]==0)
{
format(string, sizeof(string), "You are in debt, you have till next Time Check to get: $%d or you go to jail.", GetPlayerMoney(j));
SendClientMessage(j, COLOR_LIGHTRED, string);
MoneyMessage[j] = 1;
}
}
else
{
MoneyMessage[j] = 0;
}
}
}
for(new c = 1; c < 400; c++)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
new level = PlayerInfo[pJackSkill]
if (level >= 401)
{
SetVehicleParamsForPlayer(c, i, 0, 0);
}
}
}
if (gLastDriver[c] == 301)
{

}
if (gLastDriver[c] >= 300)
{
gLastDriver[c]++;
}
//foundowner = -1;
}
return 1;
}[/pawn];>

Posted

Doar aici o mai gasesc.

 

[pawn]public CarInit()
{
for(new c = 1; c < 254; c++)
{
gLastDriver[c] = 299;
}
gLastDriver[301]=255;
return 1;
}[/pawn]

Posted

[pawn]new gLastDriver[302];[/pawn]

 

[pawn]
if(HireCar[playerid] != 299)
{
gLastDriver[HireCar[playerid]] = 300;
gCarLock[HireCar[playerid]] = 0;
UnLockCar(HireCar[playerid]);
if(reason != 0)
{
SetVehicleToRespawn(HireCar[playerid]);
}
}

[/pawn]

 

[pawn]
if(GangCar[playerid] != 512)
{
gLastDriver[GangCar[playerid]] = 520;
gCarLock[GangCar[playerid]] = 0;
UnLockCar(GangCar[playerid]);
}

[/pawn]

 

[pawn]if (gLastCar[playerid] > 0)
{
gLastDriver[gLastCar[playerid]] = 300;
if(PlayerInfo[playerid][pPhousekey] != gLastCar[playerid]-1)
{
gCarLock[gLastCar[playerid]] = 0;
UnLockCar(gLastCar[playerid]);
}
}[/pawn]

 

[pawn] if(oldcar != 301)
{
if((housecar != oldcar && oldcar != 0) && (HireCar[playerid] != oldcar && newcar != housecar))
{
if(gLastDriver[oldcar] == playerid && oldcar != newcar)
{
gLastDriver[oldcar] = 300;
gCarLock[oldcar] = 0;
UnLockCar(oldcar);
}
}
}[/pawn]

 

[pawn]if(IsAnOwnableCar(newcar))
{

if(CarInfo[newcar][cOwned]==1)
{
format(string,sizeof(string),"Vehicle bought to %s",CarInfo[newcar][cOwner]);
SendClientMessage(playerid, COLOR_BLUE, string);
}
}
gLastCar[playerid] = newcar;
gLastDriver[newcar] = playerid;
}[/pawn]

 

[pawn]public CarInit()
{
for(new c = 1; c < 254; c++)
{
gLastDriver[c] = 299;
}
gLastDriver[301]=255;
return 1;
}[/pawn]

 

Edit !

 

Am sters din public charcheck astea:

[pawn]for(new c = 1; c < 400; c++)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
new level = PlayerInfo[pJackSkill]
if (level >= 401)
{
SetVehicleParamsForPlayer(c, i, 0, 0);
}
}
}
if (gLastDriver[c] == 301)
{

}
if (gLastDriver[c] >= 300)
{
gLastDriver[c]++;[/pawn]

 

Nu mai primesc nimic in server_log de la ele, dar... acum cand folosesc comanda "/vama" primesc astea:

 

[pawn][17:04:52] [debug] Run time error 4: "Array index out of bounds"
[17:04:52] [debug] Accessing element at index 14 past array upper bound 10
[17:04:52] [debug] AMX backtrace:
[17:04:52] [debug] #0 00002f30 in public ExtortionSBiz (0x0000000e, 0x00000032) from facut.amx
[17:04:52] [debug] #1 0023cc5c in public OnPlayerCommandText (0x00000000, 0x00b41d90) from facut.amx[/pawn]

 

 

Aici am comanda : 

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.