1. Hello everyone,

    I am trying to get skin name from an item but i don't get it, i just try the following code, but it won't give me the correct name of the applyed skin (@Wulf)

    Code:
    Item item = ItemManager.CreateByName("pistol.semiauto", 1, 10087);
    if (item != null)
    {
        if (item.info.skins?.Length > 0) 
           Puts(item.info.skins[0].name);
    }
    This code give me "assets/content/workshop/......"

    Code:
    Item item = ItemManager.CreateByName("pistol.semiauto", 1, 10087);
    if (item != null)
    {
        if (item.info.skins?.Length > 0) 
           Puts(item.info.skins[0].name);
    }
    skin 10087 should be "Contamination Pistol" aka See Oxide API
    but it return me Polymer SAP skin name

    Can someone have a tips about it?
     
  2. Well. Since there are multiple values within item.info.skins you would have to search and find which one matches. For the semi there is four or so, [0,1,2,3] so if you just loop through that and match the ID's then it should work.
    Code:
                        item.skin = 10087;
                        for(var i = 0; i < item.info.skins.Length; i++){
                            if(item.info.skins[i].id == Convert.ToInt32(item.skin)){
                                 Puts("Skin Name: "+item.info.skins[i].name);
                                 break;
                            }
                            continue;
                        }
     
  3. already try and both skins/skins2 give shitty info

    18:05 [Info] [Giveaway] assets/content/workshop/skin/pistol.semi/red shine/skin.semiautopistol.redshine.itemskin.asset
    18:05 [Info] [Giveaway] assets/content/workshop/skin/pistol.semi/semiauto pistol reaper note/skin.semiautopistol.reapernotepistol.itemskin.asset
    18:05 [Info] [Giveaway] assets/content/workshop/skin/pistol.semi/contamination pistol/skin.semiautopistol.contaminationpistol.itemskin.asset
    18:05 [Info] [Giveaway] assets/content/workshop/skin/pistol.semi/halloween bat/skin.semiautopistol.halloweenbat.itemskin.asset

    18:06 [Info] [Giveaway] Polymer SAP
    18:06 [Info] [Giveaway] Polymer SAP
    18:06 [Info] [Giveaway] Paint Rush SAP
    18:06 [Info] [Giveaway] Golden Leaf SAP
    18:06 [Info] [Giveaway] Salt Shaker SAP
    18:06 [Info] [Giveaway] Tehno Pistol
    18:06 [Info] [Giveaway] LCD Marine Sidearm
    18:06 [Info] [Giveaway] Nightmare
    18:06 [Info] [Giveaway] Desert Hunter
    18:06 [Info] [Giveaway] Poseidon Semi Auto Pistol
    18:06 [Info] [Giveaway] Ol' Greasy
    [/CODE]
     
  4. Getting the english name is fairly easy:
    Code:
    item.info.skins[0].invItem.displayName.english;
     
  5. Got it, but it seem the oxide docs isn't uptodate

    Nvm, i also have to check for id.
    thanks for help
     
  6. @sami37 Could you release the code how you did it?
     
  7. Code:
    Item item = ItemManager.CreateByName(name, Convert.ToInt32(info.Value), skin);
    if (item != null)
    {
         var itemName = item.info.displayName.translated;
         if (item.info.skins?.Length > 0)
         {
               for (var si = 0; si < item.info.skins.Length; si++)
               {
                    if (item.info.skins[si].id == (int) skin)
                    {
                          itemName += " (" + item.info.skins[si].invItem.displayName.english + " skin)";
                     }
                 }
          }
          SendReply(player,
          string.Format(
                    lang.GetMessage("ItemList", this, player.UserIDString),
                    itemName, info.Value));
    }