• 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!

Solved error with item

Thorn

Spriting since 2013
Joined
Sep 24, 2012
Messages
2,203
Solutions
1
Reaction score
923
Location
Chile
hii, i have an item that gives you 25 lvl, but is not working correctly, once it gets used, it shoudl disappear, but stills there, making it forever, here is the error that sends

XML:
[16/07/2013 19:22:17] [Error - Action Interface] 
[16/07/2013 19:22:17] data/actions/scripts/small exp.lua:onUse
[16/07/2013 19:22:17] Description: 
[16/07/2013 19:22:17] data/actions/scripts/small exp.lua:13: attempt to concatenate global 'levelCap' (a nil value)
[16/07/2013 19:22:17] stack traceback:
[16/07/2013 19:22:17] 	data/actions/scripts/small exp.lua:13: in function <data/actions/scripts/small exp.lua:4>

and here is the lua of the item

LUA:
local cfg = {
    amount = 25 -- here how many levels you want
	  }
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if (getPlayerLevel(cid) + cfg.amount) > 717216 then
		local levelCap = (717216 - getPlayerLevel(cid))
		doPlayerAddLevel(cid, levelCap)
		doCreatureSay(cid, "CONGRATULATIONS! You Have Advanced " .. levelCap .. " Levels!. ", TALKTYPE_ORANGE_1)
		doSendMagicEffect(getCreaturePosition(cid), 28)
		doRemoveItem(item.uid,1)
	else
		doPlayerAddLevel(cid, cfg.amount)
		doCreatureSay(cid, "CONGRATULATIONS! You Have Advanced " .. levelCap .. " Levels!. ", TALKTYPE_ORANGE_1)
		doSendMagicEffect(getCreaturePosition(cid), 28)
		doRemoveItem(item.uid,1)
	end
	return TRUE
end

plz guys if anyone could help me it would solve many of my problems :C
 
Last edited:
After else
LUA:
	doCreatureSay(cid, "CONGRATULATIONS! You Have Advanced " .. levelCap .. " Levels!. ", TALKTYPE_ORANGE_1)
Change to
LUA:
	doCreatureSay(cid, "CONGRATULATIONS! You Have Advanced " .. cfg.amount .. " Levels!. ", TALKTYPE_ORANGE_1)
 
Back
Top