29.06.2012, 16:52
That didn't work.
I get this:
With this:
Thanks.
I get this:
Код:
[18:02:03] [debug] Run time error 4: "Array index out of bounds" [18:02:03] [debug] Accessing element at index 83 past array upper bound 49 [18:02:03] [debug] AMX backtrace: [18:02:03] [debug] #0 000c80a4 in ?? () from new.amx [18:02:03] [debug] #1 00000073 in public SaveWeps () from new.amx
pawn Код:
public SaveWeps(playerid)
{
UpdateWeapons(playerid);
}
//UpdateWeapons code:
public UpdateWeapons(playerid)
{
new saveweap[13];
GrabWeapons(playerid);
format(saveweap[0],256,"UPDATE Accounts SET Weapon1 = %d, Weapon1A = %i WHERE Username = '%s';",WeapData[playerid][weapon1],WeapData[playerid][weapon1ammo],pName(playerid));
format(saveweap[1],256,"UPDATE Accounts SET Weapon2 = %d, Weapon2A = %i WHERE Username = '%s';",WeapData[playerid][weapon2],WeapData[playerid][weapon2ammo],pName(playerid));
format(saveweap[2],256,"UPDATE Accounts SET Weapon3 = %d, Weapon3A = %i WHERE Username = '%s';",WeapData[playerid][weapon3],WeapData[playerid][weapon3ammo],pName(playerid));
format(saveweap[3],256,"UPDATE Accounts SET Weapon4 = %d, Weapon4A = %i WHERE Username = '%s';",WeapData[playerid][weapon4],WeapData[playerid][weapon4ammo],pName(playerid));
format(saveweap[4],256,"UPDATE Accounts SET Weapon5 = %d, Weapon5A = %i WHERE Username = '%s';",WeapData[playerid][weapon5],WeapData[playerid][weapon5ammo],pName(playerid));
format(saveweap[5],256,"UPDATE Accounts SET Weapon6 = %d, Weapon6A = %i WHERE Username = '%s';",WeapData[playerid][weapon6],WeapData[playerid][weapon6ammo],pName(playerid));
format(saveweap[6],256,"UPDATE Accounts SET Weapon7 = %d, Weapon7A = %i WHERE Username = '%s';",WeapData[playerid][weapon7],WeapData[playerid][weapon7ammo],pName(playerid));
format(saveweap[7],256,"UPDATE Accounts SET Weapon8 = %d, Weapon8A = %i WHERE Username = '%s';",WeapData[playerid][weapon8],WeapData[playerid][weapon8ammo],pName(playerid));
format(saveweap[8],256,"UPDATE Accounts SET Weapon9 = %d, Weapon9A = %i WHERE Username = '%s';",WeapData[playerid][weapon9],WeapData[playerid][weapon9ammo],pName(playerid));
format(saveweap[9],256,"UPDATE Accounts SET Weapon10 = %d, Weapon10A = %i WHERE Username = '%s';",WeapData[playerid][weapon10],WeapData[playerid][weapon10ammo],pName(playerid));
format(saveweap[10],256,"UPDATE Accounts SET Weapon11 = %d, Weapon11A = %i WHERE Username = '%s';",WeapData[playerid][weapon11],WeapData[playerid][weapon11ammo],pName(playerid));
format(saveweap[11],256,"UPDATE Accounts SET Weapon12 = %d, Weapon12A = %i WHERE Username = '%s';",WeapData[playerid][weapon12],WeapData[playerid][weapon12ammo],pName(playerid));
mysql_query(saveweap[0]);
mysql_query(saveweap[1]);
mysql_query(saveweap[2]);
mysql_query(saveweap[3]);
mysql_query(saveweap[4]);
mysql_query(saveweap[5]);
mysql_query(saveweap[6]);
mysql_query(saveweap[7]);
mysql_query(saveweap[8]);
mysql_query(saveweap[9]);
mysql_query(saveweap[10]);
mysql_query(saveweap[11]);
}
// Grab Weapons code
stock GrabWeapons(playerid)
{
GetPlayerWeaponData(playerid,0,WeapData[playerid][weapon1],WeapData[playerid][weapon1ammo]);
GetPlayerWeaponData(playerid,1,WeapData[playerid][weapon2],WeapData[playerid][weapon2ammo]);
GetPlayerWeaponData(playerid,2,WeapData[playerid][weapon3],WeapData[playerid][weapon3ammo]);
GetPlayerWeaponData(playerid,3,WeapData[playerid][weapon4],WeapData[playerid][weapon4ammo]);
GetPlayerWeaponData(playerid,4,WeapData[playerid][weapon5],WeapData[playerid][weapon5ammo]);
GetPlayerWeaponData(playerid,5,WeapData[playerid][weapon6],WeapData[playerid][weapon6ammo]);
GetPlayerWeaponData(playerid,6,WeapData[playerid][weapon7],WeapData[playerid][weapon7ammo]);
GetPlayerWeaponData(playerid,7,WeapData[playerid][weapon8],WeapData[playerid][weapon8ammo]);
GetPlayerWeaponData(playerid,8,WeapData[playerid][weapon9],WeapData[playerid][weapon9ammo]);
GetPlayerWeaponData(playerid,9,WeapData[playerid][weapon10],WeapData[playerid][weapon10ammo]);
GetPlayerWeaponData(playerid,10,WeapData[playerid][weapon11],WeapData[playerid][weapon11ammo]);
GetPlayerWeaponData(playerid,11,WeapData[playerid][weapon12],WeapData[playerid][weapon12ammo]);
}