• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] Check if two weapons are in same slot
#1
Hello, I'm making a weapon/save load system to MySQL and it seems working but I have a problem.

I need something to check if two weapons are in the same slot because now the save system inserts 2 rows in the table.

Example:

I buy Spas12, weapon gets inserted in the table, but if I buy sawn off, the weapon gets inserted in the table so I have 2 weapons of the same slot saved.

I need to avoid this.

This is the save code:

Code:
public GivePlayerWeaponEx(playerid, weaponid, ammo)
{
    new wepQuery[300];

    if(IsValidWeaponID(weaponid))
    {
        mysql_format(g_SQL, wepQuery, sizeof(wepQuery), "INSERT INTO `weapons` (`userid`, `weaponid`, `ammo`) VALUES (%d, %d, %d) ON DUPLICATE KEY UPDATE ammo = %d",
        ReturnAccDbID(playerid), weaponid, ammo, GetPlayerAmmo(playerid) + ammo);
           
        mysql_pquery(g_SQL, wepQuery);
    }
    return GivePlayerWeapon(playerid, weaponid, ammo);
}
  Reply
#2
bumpp
  Reply
#3
bumpp
  Reply
#4
https://www.open.mp/docs/scripting/funct...WeaponSlot

What will you do after you know two weapons are of the same slot. Delete the previous row?
  Reply


Forum Jump: