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

OTClient OTClient 1.0 Print Target

raynerjunior

New Member
Joined
Jul 31, 2014
Messages
19
Reaction score
3
Save community!
I have an error in my OTClient 1.0. I use the same one compiled for Windows, and today using the script below, it is not recognizing the requested item, and when I use OTClientV8 it can recognize it.

Script:
Lua:
local rewards = {
    { item = 8298, count = 1, chance = 50 },
    { item = 8299, count = 1, chance = 50 },
    { item = 8301, count = 1, chance = 50 },
    { item = 8302, count = 1, chance = 50 },
    { item = 8303, count = 1, chance = 50 },
    { item = 8310, count = 1, chance = 50 },
    { item = 9971, count = 1, chance = 50 },
    { item = 5944, count = 1, chance = 100 }
}

local storage = 5000
local delay_timer = 5

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    
    local cur_time, cur_storage = os.time(), player:getStorageValue(storage)
 
    if cur_storage > cur_time then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can mining again in " .. os.date("!%Hh %Mm %Ss", cur_storage - cur_time) .. ".")
        return true
    end
    
    local function addbackstone()
    local stones = {5750, 5751, 5752, 5753, 5754}
    local stone = Game.createItem(stones[math.random(#stones)], 1, toPosition)
        stone:setActionId(5991)
    end
    
    if player:getLevel() < 10 then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You dont have the required level of 10 to mining.")
        return true
    end
    
    if not target then
        return false
    end
    
    if not target:isItem() then
        return false
    end

    if target.actionid ~= 5991 then
    local pos = player:getPosition()
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You cannot use it here.')
        return false
    end
    
        local break_chance = 15
    if math.random(1, 100) <= break_chance then
        item:remove(1)
        player:getPosition():sendMagicEffect(CONST_ME_BLOCKHIT)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Your pick just broke.')
    end
    
    if target.actionid == 5991 then
    local ran = math.random(100)
        if ran <= 10 then
            toPosition:sendMagicEffect(3)
            target:remove()
            addEvent(addbackstone, 120000)
            return true
        end
    end
 
    local text = "You have found "
    for i = 1, #rewards do
        local rand = math.random(1000)
        if rand <= rewards[i].chance then
            player:addItem(rewards[i].item, rewards[i].count)
            if text ~= "You have found " then
                text = text .. ", "
            end
            text = text .. rewards[i].count .. " " .. ItemType(rewards[i].item):getName()
        end         
    end
    if text == "You have found " then
        text = text .. "nothing"
    end
    player:sendTextMessage(36, text .. ".")
    cur_time = cur_time + delay_timer
    player:addExperience(amount)
    player:setStorageValue(storage, cur_time)
    return true
end

Using Otclient 1.0 - Always stays in this message, because it doesn't recognize the desired location.

1644958213568.png
1644958253358.png

Using OTClient V8, it recognizes the location and performs script action.

1644958264971.png

Can someone explain to me what happens here? Why this difference?
 
Back
Top