Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- 1 - inventory 1, 2 - inventory 2, 3 - weapon, 4 - medic, 5 - ammo
- function IsInventorySlotFree( iType, pInputItem )
- if iType == 1 then
- return IsInventoryHasFreeItemSlot( pInputItem, 1 ); -- Есть ли свободное место в инвентаре 1?
- elseif iType == 2 then
- return IsInventoryHasFreeItemSlot( pInputItem, 2 ); -- Есть ли свободное место в инвентаре 1?
- end
- local iMax;
- local iStart, iEnd;
- if iType == 3 then
- iMax = 4; -- TODO: Получаем кол-во свободных слотов оружейных с учетом навыков..
- iStart = 9;
- iEnd = 12;
- elseif iType == 4 then
- iMax = 4; -- TODO: Получаем кол-во свободных слотов медицинских с учетом навыков.
- iStart = 13;
- iEnd = 16;
- elseif iType == 5 then
- iMax = 5; -- TODO: Получаем кол-во свободных слотов патронташа с учетом навыков..
- iStart = 17;
- iEnd = 21;
- end
- local bResult = true;
- local iCount = 0;
- local iFree = iStart;
- for iInventoryType, aInventory in ipairs( g_aInventoryItems ) do
- for _, DrawData in ipairs( aInventory ) do
- local pItem = DrawData[ 1 ];
- local iRow = pItem.y;
- if iRow >= iStart and iRow <= iEnd then
- if iInventoryType == 1 then
- iFree = iFree + 1;
- end
- iCount = iCount + 1;
- if iCount == iMax then
- bResult = false;
- end
- end
- end
- end
- return bResult, iFree;
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement