![]() |
|
[Pawn] Check if two weapons are in same slot - Printable Version +- open.mp forum (https://forum.open.mp) +-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3) +--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10) +--- Thread: [Pawn] Check if two weapons are in same slot (/showthread.php?tid=2384) |
Check if two weapons are in same slot - JasonDeRue - 2023-05-05 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);
}RE: Check if two weapons are in same slot - JasonDeRue - 2023-07-14 bumpp RE: Check if two weapons are in same slot - JasonDeRue - 2023-07-19 bumpp RE: Check if two weapons are in same slot - Coool - 2023-07-19 https://www.open.mp/docs/scripting/functions/GetWeaponSlot What will you do after you know two weapons are of the same slot. Delete the previous row? |