You should save all information of an item inside a database, that are relevant to recreate it in the game.

Basic example:

Your Table “weapons” has the following columns:

  • user_id
  • model (weaponhash)
  • ammo

On player join u can then query all weapons of that player using the user_id:
select * from weapons where user_id = "get user id in script"

And than giving that player all weapons (pseudo code):

foreach(var weapon of players_weapons) {
     GiveWeaponToPed(player_ped_id, weapon.model, weapon.ammo, false, false);
}

That example should give you enough information to make progess on your inventory script