• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

How to fix it (attempt to index a nil value)

Adrenaline

Waiting for God
Joined
Jun 13, 2011
Messages
80
Reaction score
6
Location
Poland
Hi all, i found nice script but dont work :D dont know how to fix it

The Forgotten Server 0.3.6 8.54 Debian6

[Error - Action Interface]
data/actions/scripts/other/quest.lua
Description:
attempt to index a nil value
[Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/quest.lua)

Script:
PHP:
local config = {
level = 25,
storageid = 65535,
itemid1 = 2177,
itemid2 = 2146,
itemid3 = 2229,
itemid4 = 7591,
}
item1 = getThingFromPos(i1)
item2 = getThingFromPos(i2)
item3 = getThingFromPos(i3)
item4 = getThingFromPos(i4)
i1 = {x=899, y=872, z=8, stackpos=2}
i2 = {x=903, y=877, z=8, stackpos=2}
i3 = {x=908, y=872, z=8, stackpos=2}
i4 = {x=903, y=868, z=8, stackpos=2}


function onUse(cid, item, fromPosition, itemEx, toPosition)
  if getPlayerLevel(cid) > config.level then
    if config.item1.uid == itemid1 then
      if config.item2.uid == itemid2 then
	if config.item3.uid == itemid3 then
	  if config.item4.uid == itemid4 then
	    if doRemoveItem(config.item1.uid) and doRemoveItem(config.item2.uid) and doRemoveItem(config.item3.uid) and doRemoveItem(config.item4.uid) == TRUE then
	      if setPlayerStorageValue(cid, config.storageid, 1) == TRUE then
		sendPlayerTextMessage(cid, TALKTYPE_ORANGE, "You can now continue your jurney.")
	      else
		sendPlayerTextMessage(cid, TALKTYPE_ORANGE, "Error, please contact an administrator (error code #2).")
	      end
	    else
	      sendPlayerTextMessage(cid, TALKTYPE_ORANGE, "Error, please contact an administrator (error code #1).")
	    end
	  else
	    sendPlayerTextMessage(cid, TALKTYPE_ORANGE, "Put the " .. getItemName(config.itemid1) .. " on the left place.")
	  end
	else
	  sendPlayerTextMessage(cid, TALKTYPE_ORANGE, "Put the " .. getItemName(config.itemid2) .. " on the bottom place.")
	end
      else
	sendPlayerTextMessage(cid, TALKTYPE_ORANGE, "Put the " .. getItemName(config.itemid3) .. " on the right place.")
      end
    else
      sendPlayerTextMessage(cid, TALKTYPE_ORANGE, "Put the " .. getItemName(config.itemid4) .. " on the top place.")
    end
  else
    sendPlayerTextMessage(cid, TALKTYPE_ORANGE, "You can't make this quest yet, you need level " .. config.level .. ", you are only level " .. getPlayerLevel(cid) .. ".")
  end
  return TRUE
end

Rep+ for help.. :)
 
Last edited:
Back
Top