18.04.2013, 18:05
For some reason my weapon saving system is not working, it is supposed to put the data in the MySQL database depending on the slot, this is what it outputs when I have a Desert Eagle with 9999 ammo in my hand (the second line is my account), it just outputs some random numbers.. the heck?
http://i.imgur.com/upszpFx.png
All of the fields are integerers.
http://i.imgur.com/upszpFx.png
All of the fields are integerers.
pawn Код:
new wep[13], wep2[13];
for (new a = 0; a < 13; a++)
{
GetPlayerWeaponData(playerid, a, wep[a], wep2[a]);
}
format(UserStats[playerid][Wep0], 5, "%d", wep[0]); format(UserStats[playerid][WepAmmo0], 6, "%d", wep2[0]);
format(UserStats[playerid][Wep1], 5, "%d", wep[1]); format(UserStats[playerid][WepAmmo1], 6, "%d", wep2[1]);
format(UserStats[playerid][Wep2], 5, "%d", wep[2]); format(UserStats[playerid][WepAmmo2], 6, "%d", wep2[2]);
format(UserStats[playerid][Wep3], 5, "%d", wep[3]); format(UserStats[playerid][WepAmmo3], 6, "%d", wep2[3]);
format(UserStats[playerid][Wep4], 5, "%d", wep[4]); format(UserStats[playerid][WepAmmo4], 6, "%d", wep2[4]);
format(UserStats[playerid][Wep5], 5, "%d", wep[5]); format(UserStats[playerid][WepAmmo5], 6, "%d", wep2[5]);
format(UserStats[playerid][Wep6], 5, "%d", wep[6]); format(UserStats[playerid][WepAmmo6], 6, "%d", wep2[6]);
format(UserStats[playerid][Wep7], 5, "%d", wep[7]); format(UserStats[playerid][WepAmmo7], 6, "%d", wep2[7]);
format(UserStats[playerid][Wep8], 5, "%d", wep[8]); format(UserStats[playerid][WepAmmo8], 6, "%d", wep2[8]);
format(UserStats[playerid][Wep9], 5, "%d", wep[9]); format(UserStats[playerid][WepAmmo9], 6, "%d", wep2[9]);
format(UserStats[playerid][Wep10], 5, "%d", wep[10]); format(UserStats[playerid][WepAmmo10], 6, "%d", wep2[10]);
format(UserStats[playerid][Wep11], 5, "%d", wep[11]); format(UserStats[playerid][WepAmmo11], 6, "%d", wep2[11]);
new string[500];
format(string, sizeof(string), "UPDATE users SET Wep0='%d',WepAmmo0='%d',Wep1='%d',WepAmmo1='%d',Wep2='%d',WepAmmo2='%d',Wep3='%d',WepAmmo3='%d',Wep4='%d',WepAmmo4='%d' WHERE Name='%s'", UserStats[playerid][Wep0], UserStats[playerid][WepAmmo0], UserStats[playerid][Wep1], UserStats[playerid][WepAmmo1], UserStats[playerid][Wep2], UserStats[playerid][WepAmmo2], UserStats[playerid][Wep3], UserStats[playerid][WepAmmo3], UserStats[playerid][Wep4], UserStats[playerid][WepAmmo4], UserStats[playerid][Name]);
mysql_query(string);
format(string, sizeof(string), "UPDATE users SET Wep5='%d',WepAmmo5='%d',Wep6='%d',WepAmmo6='%d',Wep7='%d',WepAmmo7='%d',Wep8='%d',WepAmmo8='%d' WHERE Name='%s'", UserStats[playerid][Wep5], UserStats[playerid][WepAmmo5], UserStats[playerid][Wep6], UserStats[playerid][WepAmmo6], UserStats[playerid][Wep7], UserStats[playerid][WepAmmo7], UserStats[playerid][Wep8], UserStats[playerid][WepAmmo8], UserStats[playerid][Name]);
mysql_query(string);
format(string, sizeof(string), "UPDATE users SET Wep9='%d',WepAmmo9='%d',Wep10='%d',WepAmmo10='%d',Wep11='%d',WepAmmo11='%d', WHERE Name='%s'", UserStats[playerid][Wep9], UserStats[playerid][WepAmmo9], UserStats[playerid][Wep10], UserStats[playerid][WepAmmo10], UserStats[playerid][Wep1], UserStats[playerid][WepAmmo1], UserStats[playerid][Name]);
mysql_query(string);
//-----------TOP:--------------//
enum pEnum
{
Name[MAX_PLAYER_NAME],
//some other variables here, not necessary to show..
Wep0,
WepAmmo0,
Wep1,
WepAmmo1,
Wep2,
WepAmmo2,
Wep3,
WepAmmo3,
Wep4,
WepAmmo4,
Wep5,
WepAmmo5,
Wep6,
WepAmmo6,
Wep7,
WepAmmo7,
Wep8,
WepAmmo8,
Wep9,
WepAmmo9,
Wep10,
WepAmmo10,
Wep11,
WepAmmo11,
};
new UserStats[MAX_PLAYERS][pEnum];