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

Error experience scroll

Thorn

Spriting since 2013
Joined
Sep 24, 2012
Messages
2,203
Solutions
1
Reaction score
923
Location
Chile
hii, i have this error i don't know why, here it is:
XML:
[06/12/2012 21:34:28] [Error - Action Interface] 
[06/12/2012 21:34:28] data/actions/scripts/amuletofexperience.lua:onUse
[06/12/2012 21:34:28] Description: 
[06/12/2012 21:34:28] (luaAddEvent) Callback parameter should be a function.

and this is my lua of the object:
LUA:
	  local config = {
		rate = 2.0, -- 4x More Experience
		time = 168, -- Hours of Exp Time
		storage = 20011
	}

	function onUse(cid, item, fromPosition, itemEx, toPosition)
		if(getPlayerStorageValue(cid, config.storage) == -1) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your extra experience rate is now: " .. config.rate .. ". It will last for ".. config.time .." hours.")
			doPlayerSetRate(cid, SKILL__LEVEL, config.rate)
			setPlayerStorageValue(cid, config.storage, os.time() + config.time * 3600 * 1000)
			addEvent(endExpRate, config.time * 3600 * 1000, cid)
			doRemoveItem(item.uid, 1)
		else
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You still have extra experience time left.")
		end
		return true
	end

	local function endExpRate(cid)
		doPlayerSetRate(cid, SKILL__LEVEL, 6.0) --config.lua rate
		setPlayerStorageValue(cid, config.storage, -1)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Your extra experience time has ended.")
	end

plzzzz help D: btw the scroll works fine :P
 
Last edited by a moderator:
LUA:
 local config = {
		rate = 2.0, -- 4x More Experience
		time = 168, -- Hours of Exp Time
		storage = 20011
	}
 
	local function endExpRate(cid)
		doPlayerSetRate(cid, SKILL__LEVEL, 6.0) --config.lua rate
		setPlayerStorageValue(cid, config.storage, -1)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Your extra experience time has ended.")
	end

	function onUse(cid, item, fromPosition, itemEx, toPosition)
		if(getPlayerStorageValue(cid, config.storage) == -1) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your extra experience rate is now: " .. config.rate .. ". It will last for ".. config.time .." hours.")
			doPlayerSetRate(cid, SKILL__LEVEL, config.rate)
			setPlayerStorageValue(cid, config.storage, os.time() + config.time * 3600 * 1000)
			addEvent(endExpRate, config.time * 3600 * 1000, cid)
			doRemoveItem(item.uid, 1)
		else
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You still have extra experience time left.")
		end
		return true
	end

The function should be above the addEvent.
 
Back
Top