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

Lua help agien -.-

Rachaw

Experienced Member
Joined
Oct 17, 2009
Messages
602
Reaction score
1
Location
Tha Sweden
LUA:
[04/11/2009 23:28:47] Lua Script Error: [Action Interface] 
[04/11/2009 23:28:47] data/actions/scripts/test.lua:onUse

[04/11/2009 23:28:47] attempt to index a nil value
[04/11/2009 23:28:47] stack traceback:
[04/11/2009 23:28:47] 	[C]: in function 'doSendMagicEffect'
[04/11/2009 23:28:47] 	data/actions/scripts/test.lua:5: in function <data/actions/scripts/test.lua:1>
[04/11/2009 23:28:47] CM Rachaw has logged out.
thats the bug

LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
             	   doCreatureSay(cid, "You've been awarded Donators experience by the scroll!", TALKTYPE_BLUE_1)
             		   doPlayerAddExp(cid, 40000000)
				doRemoveItem(item.uid, 1)
					doSendMagicEffect(pos, 12)
			if getPlayerLevel(cid) >= 600 then
				doCreatureSay(cid, "Sorry, you are over level 600, you can't use me more. Make a new character :).", TALKTYPE_BLUE_1)
		end
			return 1
		end


tested on 0.3.5 help
/rachaw :peace:
 
i fixed the bug and should work fine :D Rep++ if it worked :)

Code:
  function onUse(cid, item, fromPosition, itemEx, toPosition)
pos = getPlayerPosition(cid)
                   doCreatureSay(cid, "You've been awarded Donators experience by the scroll!", TALKTYPE_BLUE_1)
                           doPlayerAddExp(cid, 40000000)
                                doRemoveItem(item.uid, 1)
                                        doSendMagicEffect(pos, 12)
else
                        if getPlayerLevel(cid) >= 600 then
                                doCreatureSay(cid, "Sorry, you are over level 600, you can't use me more. Make a new character :).", TALKTYPE_BLUE_1)
                end
                        return 1
                end
end
 
Still won't work..

You got an else tag on line 7 but no if tag before that

This should work:

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
pos = getPlayerPosition(cid)

	if getPlayerLevel(cid) <= 599 then
		doCreatureSay(cid, "You've been awarded Donators experience by the scroll!", TALKTYPE_BLUE_1)
		doPlayerAddExp(cid, 40000000)
		doRemoveItem(item.uid, 1)
		doSendMagicEffect(pos, 12)
	else
		if getPlayerLevel(cid) >= 600 then
		doCreatureSay(cid, "Sorry, you are over level 600, you can't use me more. Make a new character :).", TALKTYPE_BLUE_1)
	end
	end
	return 1
end
 
Last edited:
Back
Top