• 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 Problem BlueberryBush Wtf

bolero

MikeHere
Joined
Apr 13, 2009
Messages
1,146
Reaction score
12
Location
Venezuela
When I press second click to eat blueberry the bush is leave of the map o_O! and say this error :/


Code:
[01/04/2010 03:11:15] [Error - Action Interface] 
[01/04/2010 03:11:15] data/actions/scripts/other/blueberrybush.lua:onUse
[01/04/2010 03:11:15] Description: 
[01/04/2010 03:11:15] (luaDoCreateItem) Item not found

The script here...

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	doTransformItem(item.uid, ITEM_BUSH)
	doCreateItem(ITEM_BLUEBERRY, 3, fromPosition)
	addEvent(transformBack, 300000, fromPosition)
	return true
end

function transformBack(position)
	position.stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE

	local topThing = getThingFromPos(position)
	if(topThing.itemid == ITEM_BLUEBERRY) then
		addEvent(transformBack, 300000, position)
	else
		topThing = getTileItemById(position, ITEM_BUSH)
		if(topThing.itemid ~= 0) then
			doTransformItem(topThing.uid, ITEM_BLUEBERRYBUSH)
		end
	end
end
 
Last edited:
Try this
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	doTransformItem(item.uid, 2767)
	doCreateItem(2677, 3, fromPosition)
	addEvent(transformBack, 300000, fromPosition)
	return true
end

function transformBack(position)
	position.stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE

	local topThing = getThingFromPos(position)
	if(topThing.itemid == 2677) then
		addEvent(transformBack, 300000, position)
	else
		topThing = getTileItemById(position, 2767)
		if(topThing.itemid ~= 0) then
			doTransformItem(topThing.uid, 2785)
		end
	end
end
 
Yes... It's Work
Another script is failed ;/

Code:
[01/04/2010 03:28:14] [Error - GlobalEvent Interface] 
[01/04/2010 03:28:14] data/globalevents/scripts/lottery.lua:onThink
[01/04/2010 03:28:14] Description: 
[01/04/2010 03:28:14] data/globalevents/scripts/lottery.lua:17: attempt to call global 'getPlayerWorldId' (a nil value)
[01/04/2010 03:28:14] stack traceback:
[01/04/2010 03:28:14] 	data/globalevents/scripts/lottery.lua:17: in function <data/globalevents/scripts/lottery.lua:8>
[01/04/2010 03:28:14] [Error - GlobalEvents::think] Couldn't execute event: lottery

You can fix this? I give u rep..

Code:
-- by vDk, klekSu
local config = {
    lottery_hour = "45 Min", -- Time to next lottery (real time you set on globalevents.xml, its only for broadcast message.)
    rewards_id = {2494, 2472, 2514, 2195, 2470, 2656, 7895, 2160}, -- Rewards ID
    crystal_counts = 20, -- used only if on rewards_id you have crystal coins (ID: 2160).
    website = "yes" -- Do you have `lottery` table in your database?
    }
function onThink(interval, lastExecution)
    local players = getPlayersOnline()
    local list = {}
    for i, tid in ipairs(players) do
    list[i] = tid
end
        local winner = list[math.random(1, #list)]
        local random_item = config.rewards_id[math.random(1, #config.rewards_id)]
        local item_name =  getItemNameById(random_item)
        local world = tonumber(getPlayerWorldId(winner))
                if(random_item == 2160) then
                        doPlayerAddItem(winner, random_item, config.crystal_counts)
                        doBroadcastMessage('[SISTEMA DE LOTERIA] Ganador: '.. getCreatureName(winner) ..', Premio: '.. config.crystal_counts ..' '.. item_name ..'s! Felicidades! (Siguiente Loteria En '.. config.lottery_hour ..')')
                else
                        doBroadcastMessage('[SISTEMA DE LOTERIA] Ganador: '.. getCreatureName(winner) ..', Premio: '.. item_name ..'! Felicidades! (Siguiente Loteria En '.. config.lottery_hour ..')')
                        doPlayerAddItem(winner, random_item, 1)
                end
                if(config.website == "yes") then
                        db.executeQuery("INSERT INTO `lottery` (`name`, `item`, `world_id`) VALUES ('".. getCreatureName(winner) .."', '".. item_name .."', '".. world .."');")
                end
    return TRUE
end
 
You don't have the function getPlayerWorldId, if you don't use multiworld you can use this one:

Code:
-- by vDk, klekSu
local config = {
    lottery_hour = "45 Min", -- Time to next lottery (real time you set on globalevents.xml, its only for broadcast message.)
    rewards_id = {2494, 2472, 2514, 2195, 2470, 2656, 7895, 2160}, -- Rewards ID
    crystal_counts = 20, -- used only if on rewards_id you have crystal coins (ID: 2160).
    website = "yes" -- Do you have `lottery` table in your database?
    }
function onThink(interval, lastExecution)
    local players = getPlayersOnline()
    local list = {}
    for i, tid in ipairs(players) do
    list[i] = tid
end
        local winner = list[math.random(1, #list)]
        local random_item = config.rewards_id[math.random(1, #config.rewards_id)]
        local item_name =  getItemNameById(random_item)
        local world = 0
                if(random_item == 2160) then
                        doPlayerAddItem(winner, random_item, config.crystal_counts)
                        doBroadcastMessage('[SISTEMA DE LOTERIA] Ganador: '.. getCreatureName(winner) ..', Premio: '.. config.crystal_counts ..' '.. item_name ..'s! Felicidades! (Siguiente Loteria En '.. config.lottery_hour ..')')
                else
                        doBroadcastMessage('[SISTEMA DE LOTERIA] Ganador: '.. getCreatureName(winner) ..', Premio: '.. item_name ..'! Felicidades! (Siguiente Loteria En '.. config.lottery_hour ..')')
                        doPlayerAddItem(winner, random_item, 1)
                end
                if(config.website == "yes") then
                        db.executeQuery("INSERT INTO `lottery` (`name`, `item`, `world_id`) VALUES ('".. getCreatureName(winner) .."', '".. item_name .."', '".. world .."');")
                end
    return TRUE
end
 
Back
Top