check cap

theduck

Banned User
Joined
Dec 6, 2018
Messages
101
Best answers
0
Reaction score
13
Code:
 -----
                                  if  player:getStorageValue(9398329) == 1  and player:getCapacity() > 100 then
                                  containerItem:moveTo(player)
                                  
								  elseif player:getCapacity() > 100  then 
                                  containerItem:moveTo(bag)
								  
								  elseif player:getCapacity() < 100  then
                                  
                                   player:sendCancelMessage("It is too heavy or you have not enough space.")
								  
								  
                                end
							---
I'm trying to put a check cap on my self loot more without much success
 
OP
T

theduck

Banned User
Joined
Dec 6, 2018
Messages
101
Best answers
0
Reaction score
13
What is the error?
does not appear, it checks the storage and executes the function. but the character is without cap the correct would be it appears the msg more not edta appearing
 
OP
T

theduck

Banned User
Joined
Dec 6, 2018
Messages
101
Best answers
0
Reaction score
13
Code:
    if TESTEAutoLootList.players[playerId] ~= nil then
         local lootList = TESTEAutoLootList.players[playerId].lootList
         if lootList ~= nil then
            if corpse:getType():isCorpse() then
                for a = corpse:getSize() - 1, 0, -1 do
                    local containerItem = corpse:getItem(a)
                    if containerItem then
                        local containerItemId = containerItem:getId()
                        for i=1, #lootList do
                            local lootItemId = lootList[i]
                            if lootItemId == containerItemId then
							 
				  if   player:getFreeCapacity() > 100 and player:getStorageValue(9398329) == 0    then 
                                   containerItem:moveTo(bag)
								   
                                   elseif player:getFreeCapacity() > 100 and player:getStorageValue(9398329) == 1     then
                                    containerItem:moveTo(player)
								 
								   else  							
                                  player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, string.format(" It is too heavy or you have not enough space."))
								  
                                end
                            end
                        end
                    end
                end
            end
        end  
	 end     
 end
I still have not had success even putting it to jump to the next option if the cap is less than 100 it ignores the check cap
 
Top