08.08.2014, 02:07
Hey, well im trying to save the weapons on player disconnect in the smarter manner, but it wont work. Heres the script:
I put it onplayerdisconnect, and database is all set up. What is the problem?
pawn Код:
new
weaponid,
MySQLQuery[300],
ammo;
for(new i; i < 13; i++) // looping through all weapon slots (0 - 12)
{
GetPlayerWeaponData(playerid, i, weaponid, ammo); // get weaponid and ammo
if(!weaponid) continue; // don't insert if there's no weapon in this slot
format(MySQLQuery, sizeof(MySQLQuery), "INSERT INTO ginklai VALUES (%d, %d, %d) ON DUPLICATE KEY UPDATE ammo = %d;", GetPVarInt(playerid, "AccID"), weaponid, ammo, ammo);
mysql_query(MySQLQuery);
}