15.03.2018, 08:36
The code from the thread:
You have weaponid and ammo, so determine the slot from the weaponid and insert that into the array.
PHP код:
public OnLoadPlayerWeapons(playerid)
{
new
weaponid,
ammo;
for(new i, j = cache_get_row_count(userDB); i < j; i++) // loop through all the rows that were found
{
weaponid = cache_get_row_int(i, 0, userDB);
ammo = cache_get_row_int(i, 1, userDB);
if(!(0 <= weaponid <= 46)) // check if weapon is valid (should be)
{
printf("[info] Warning: OnLoadPlayerWeapons - Unknown weaponid '%d'. Skipping.", weaponid);
continue;
}
GivePlayerWeapon(playerid, weaponid, ammo);
}
return;
}