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

convert to tfs 1.2

matthew123456

New Member
Joined
Aug 24, 2013
Messages
121
Reaction score
3
Code:
local config = {
-- [ID_DA_ARVORE] = {FRUIT, amount{min, max}, fruit id,}
    [5157] = {fruit = 5097, quantity = {0,1}, treeWithoutFruit = 5156, timeToGrow = 5},
    [4006] = {fruit = 2675, quantity = {0,3}, treeWithoutFruit = 4008, timeToGrow = 20},
    [5094] = {fruit = 2676, quantity = {3,6}, treeWithoutFruit = 5092, timeToGrow = 30},
    [5096] = {fruit = 2678, quantity = {2,7}, treeWithoutFruit = 2726, timeToGrow = 70},
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
    for i, k in pairs(config) do
        if (isInArray(i, item.itemid) == true) then
            random = math.random(k.quantity[1],k.quantity[2])
            doTransformItem(item.uid, k.treeWithoutFruit, 1)
            doPlayerAddItem(cid,k.fruit,random)
            addEvent(function()
                doTransformItem(getThingFromPos(toPosition).uid, i)
            end, k.timeToGrow * 1000)
            if random > 0 then
                doPlayerSendTextMessage(cid,27,"Você pego "..random.." "..getItemNameById(k.fruit).."!")
            else
                doPlayerSendTextMessage(cid,27,"Àrvore não deu nenhum fruto!")
            end
        end
    end
return true
end

can someone convert this to tfs 1.2 thanks
 
Code:
local config = {
-- [ID_DA_ARVORE] = {FRUIT, amount{min, max}, fruit id,}
    [5157] = {fruit = 5097, quantity = {0,1}, treeWithoutFruit = 5156, timeToGrow = 5},
    [4006] = {fruit = 2675, quantity = {0,3}, treeWithoutFruit = 4008, timeToGrow = 20},
    [5094] = {fruit = 2676, quantity = {3,6}, treeWithoutFruit = 5092, timeToGrow = 30},
    [5096] = {fruit = 2678, quantity = {2,7}, treeWithoutFruit = 2726, timeToGrow = 70},
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    for i, k in pairs(config) do
        if item:getId() == i then
            random = math.random(k.quantity[1],k.quantity[2])
            item:transform(k.treeWithoutFruit)
            player:addItem(k.fruit, random)
            addEvent(function()
                item:transform(i)
            end, k.timeToGrow * 1000)
            if random > 0 then
                player:sendTextMessage(MESSAGE_INFO_DESCR,"Você pego "..random.." "..ItemType(k.fruit):getName().."!")
            else
                player:sendTextMessage(MESSAGE_INFO_DESCR,"Àrvore não deu nenhum fruto!")
            end
        end
    end
return true
end
 
Code:
local config = {
-- [ID_DA_ARVORE] = {FRUIT, amount{min, max}, fruit id,}
    [5157] = {fruit = 5097, quantity = {0,1}, treeWithoutFruit = 5156, timeToGrow = 5},
    [4006] = {fruit = 2675, quantity = {0,3}, treeWithoutFruit = 4008, timeToGrow = 20},
    [5094] = {fruit = 2676, quantity = {3,6}, treeWithoutFruit = 5092, timeToGrow = 30},
    [5096] = {fruit = 2678, quantity = {2,7}, treeWithoutFruit = 2726, timeToGrow = 70},
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    for i, k in pairs(config) do
        if item:getId() == i then
            random = math.random(k.quantity[1],k.quantity[2])
            item:transform(k.treeWithoutFruit)
            player:addItem(k.fruit, random)
            addEvent(function()
                item:transform(i)
            end, k.timeToGrow * 1000)
            if random > 0 then
                player:sendTextMessage(MESSAGE_INFO_DESCR,"Você pego "..random.." "..ItemType(k.fruit):getName().."!")
            else
                player:sendTextMessage(MESSAGE_INFO_DESCR,"Àrvore não deu nenhum fruto!")
            end
        end
    end
return true
end
thanks
 
Back
Top