[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
new plyWeapons[14] = 0;
new plyAmmo[14] = 0;
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;
}
Weapons[playerid][weaponid]
problem with this variable:
pawn Код:
|
new Weapons[MAX_PLAYERS][44];
IsValidWeapon(weaponid)
{
switch(weaponid)
{
case 0: { return 0; }
case 50: { return 0; }
}
return 1;
}
The weapons variable is the issue instead of re-sizing the array I would make a some kind of valid weapon check function before doing any code in this function for instance.
pawn Код:
|
forward IsBadGun(weaponid);
public IsBadGun(weaponid)
{
if(weaponid==8||weaponid==9||(weaponid>15&&weaponid<22)||weaponid==27||(weaponid>34&&weaponid<43)||weaponid>43)
{
return 1;
}
return 0;
}
Well it's fucked up then look
(weaponid>34&&weaponid<43)||weaponid>43) Use a damn switch not this colluded if-statement non-sense you got going on. |