Szerző Téma: Item-system hiba.  (Megtekintve 556 alkalommal)

Item-system hiba.
« Dátum: 2019. Március 09. - 16:21:12 »
0

--[[1416 sor]]--
function getAllItemWeight()
local bagWeight = 0
local keyWeight = 0
local vehWeight = 0
local objectWeight = 0
if isElement(elementSource) then
   if getElementType(elementSource) == \"player\" then
      if inventoryItems[elementSource][\"bag\"] then
         for i = 1, row * column do
            if (inventoryItems[elementSource][\"bag\"]) then
      --1426 os sor--         bagWeight = bagWeight + (getItemWeight(inventoryItems[elementSource][\"bag\"][\"id\"]) * inventoryItems[elementSource][\"bag\"][\"count\"])
            end
         end
      end
      if inventoryItems[elementSource][\"key\"] then
         for i = 1, row * column do
            if (inventoryItems[elementSource][\"key\"]) then
               keyWeight = keyWeight + (getItemWeight(inventoryItems[elementSource][\"key\"][\"id\"]) * inventoryItems[elementSource][\"key\"][\"count\"])
            end
         end
      end
   end
   if getElementType(elementSource) == \"vehicle\" then
      if inventoryItems[elementSource] then
         if inventoryItems[elementSource][\"vehicle\"] then
            for i = 1, row * column do
               if (inventoryItems[elementSource][\"vehicle\"]) then
                  vehWeight = vehWeight + (getItemWeight(inventoryItems[elementSource][\"vehicle\"][\"id\"]) * inventoryItems[elementSource][\"vehicle\"][\"count\"])
               end   
            end
         end
      end
   end
   if getElementType(elementSource) == \"object\" then
      if inventoryItems[elementSource][\"object\"] then
         for i = 1, row * column do
            if (inventoryItems[elementSource][\"object\"]) then
               objectWeight = objectWeight + (getItemWeight(inventoryItems[elementSource][\"object\"][\"id\"]) * inventoryItems[elementSource][\"object\"][\"count\"])
            end   
         end
      end
   end
end
return bagWeight + keyWeight + vehWeight + objectWeight
end
--[[1460]]--

 
Sziasztok! Olyan gondom lenne hogy localhoston elindítottam egy modot,és minden szép meg jó de a 1426-os sorra a következő hibát írja: \"attempt to perform arithmetick on nil value\". 
Nem találkoztam még ezzel a  debug üzenettel,szeretném a segítségeteket kérni ebben.
Válaszotokat előre is köszönöm.
« Utoljára szerkesztve: 2019. Március 09. - 16:23:57 írta YOLOHUN »

Item-system hiba.
« Válasz #1 Dátum: 2019. Május 01. - 12:54:35 »
0
for i=1, actionSlot do
    bindKey(i, \"down\", function()
        if(getElementData(getLocalPlayer(), \"disableInventory\") or false)then return end
        if isTimer(timer) then return end
        timer = setTimer(function() end, 1000, 1) --- spam vĂ©delem
        if(item_cache_action and item_cache_action[1]>-1 and hasItemPlayer(item_cache_action[1]))then
            useItem(getItems(getLocalPlayer())[item_cache_action
[1]][1], item_cache_action[1], getItems(getLocalPlayer())[item_cache_action[1]][2], getItems(getLocalPlayer())[item_cache_action[1]][3], getItems(getLocalPlayer())[item_cache_action[1]][4])
        end

    end)



 



probáld ki valami hasonlóval.

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal