30.07.2013, 20:44
Код:
[13:39:19] [debug] Run time error 4: "Array index out of bounds" [13:39:19] [debug] Accessing element at index 50 past array upper bound 43 [13:39:19] [debug] AMX backtrace: [13:39:19] [debug] #0 002831ec in public RemovePlayerWeaponEx (playerid=2, weaponid=50) at CSRPbeta.pwn:51451 [13:39:19] [debug] #1 00294730 in public OnPlayerUpdate (playerid=2) at CSRPbeta.pwn:53121 [13:39:19] [debug] Run time error 4: "Array index out of bounds" [13:39:19] [debug] Accessing element at index 50 past array upper bound 43 [13:39:19] [debug] AMX backtrace: [13:39:19] [debug] #0 002831ec in public RemovePlayerWeaponEx (playerid=2, weaponid=50) at CSRPbeta.pwn:51451 [13:39:19] [debug] #1 00294730 in public OnPlayerUpdate (playerid=2) at CSRPbeta.pwn:53121 [13:39:19] [debug] Run time error 4: "Array index out of bounds" [13:39:19] [debug] Accessing element at index 50 past array upper bound 43 [13:39:19] [debug] AMX backtrace: [13:39:19] [debug] #0 002831ec in public RemovePlayerWeaponEx (playerid=2, weaponid=50) at CSRPbeta.pwn:51451 [13:39:19] [debug] #1 00294730 in public OnPlayerUpdate (playerid=2) at CSRPbeta.pwn:53121 [13:39:19] [debug] Run time error 4: "Array index out of bounds" [13:39:19] [debug] Accessing element at index 50 past array upper bound 43 [13:39:19] [debug] AMX backtrace: [13:39:19] [debug] #0 002831ec in public RemovePlayerWeaponEx (playerid=2, weaponid=50) at CSRPbeta.pwn:51451 [13:39:19] [debug] #1 00294730 in public OnPlayerUpdate (playerid=2) at CSRPbeta.pwn:53121
I've asked one person to take a look, and he's asked me to adjust this:
pawn Код:
new plyWeapons[14] = 0;
new plyAmmo[14] = 0;
However, both times I still got spam in the server logs. Now I know I am missing something here, and I'm going to feel really really stupid when it's found.
HERE IS THE OnPlayerUpdate: http://pastebin.com/kkLabssZ
pawn Код:
forward RemovePlayerWeaponEx(playerid, weaponid);
public RemovePlayerWeaponEx(playerid, weaponid)
{
new plyWeapons[14] = 0;
new plyAmmo[14] = 0;
for(new slot = 0; slot != 12; slot++)
{
new wep, ammo;
GetPlayerWeaponData(playerid, slot, wep, ammo);
if(wep != weaponid && ammo != 0)
{
GetPlayerWeaponData(playerid, slot, plyWeapons[slot], plyAmmo[slot]);
}
}
ResetPlayerWeaponsEx(playerid);
for(new slot = 0; slot != 12; slot++)
{
if(plyAmmo[slot] != 0)
{
GivePlayerWeaponEx(playerid, plyWeapons[slot], plyAmmo[slot]);
}
}
SetPlayerArmedWeapon(playerid,0);
Weapons[playerid][weaponid] = 0;
return 1;
}
forward IsAnOwnableCar(vehid);
public IsAnOwnableCar(vehid)
{
if(VehicleOwned[vehid] != SCRIPT_CARS)
{
return 1;
}
return 0;
}