Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool CheckItem(PlayerBase player, string itemClass)
- {
- EntityAI attachment, subattachment; //attachments variables
- int AttCount, SubAttCount; //attachments count variables
- ItemBase subItem; //Item variable
- string className; //Item class name variable
- bool itemFound = false; // Result / default is false
- AttCount = player.GetInventory().AttachmentCount(); //Player Attachments (items on player, like clothes, backpack etc.) count for cycle
- for ( int i = 0; i < AttCount; i++ ) //Check Attachments cycle
- {
- attachment = player.GetInventory().GetAttachmentFromIndex(i); // Get player attachment
- SubAttCount = attachment.GetInventory().AttachmentCount(); //How many subattachments in player attachment - count for cycle
- for ( int a = 0; a < SubAttCount; a++ )
- {
- subattachment = attachment.GetInventory().GetAttachmentFromIndex(a); // Get subattachment in attachment
- subItem = ItemBase.Cast(subattachment); //Cast subattachment to item
- className = subItem.GetType(); //Get class name of subattachment
- if ( className == itemClass ) //Check class of item (subattachment)
- {
- itemFound = true; //Item found!
- break; //break 2nd cycle
- }
- }
- if (mapFound) break; //break 1st cycle
- }
- return itemFound; //return result
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement