• 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 Use scroll to give tibia coin

tommy91

Member
Joined
Oct 27, 2010
Messages
265
Solutions
1
Reaction score
21
Location
Sweden
Hey! Ive been looking for a script that allows me to use the edited script "Premium Scroll" to be able to gain tibia store coins. I had it in my other older server but the script dont work on this one, its a Canary server, dont know the version really. Its on tibia 13.20. Also, my premium scroll does not work and i cannot use it. Is there a help/fix for this?
 
Solution
its a Canary server, dont know the version really. Its on tibia 13.20.
Hello tommy91!. You're not a new user and I'm a bit surprised that you write that you don't even know what version it is. Do not download servers from unknown sources, they have backdoors that in the future may cause that when your server is popular, someone will decide to destroy it, and you will not know how it happened. Try to use original distributions and redo it yourself, of course using github and forums if possible :)

[...] my premium scroll does not work and i cannot use it. Is there a help/fix for this?
If you search by filename and you don't have anything in your sources containing "premium_scroll.lua" or "premiumscroll.lua" then do it...
its a Canary server, dont know the version really. Its on tibia 13.20.
Hello tommy91!. You're not a new user and I'm a bit surprised that you write that you don't even know what version it is. Do not download servers from unknown sources, they have backdoors that in the future may cause that when your server is popular, someone will decide to destroy it, and you will not know how it happened. Try to use original distributions and redo it yourself, of course using github and forums if possible :)

[...] my premium scroll does not work and i cannot use it. Is there a help/fix for this?
If you search by filename and you don't have anything in your sources containing "premium_scroll.lua" or "premiumscroll.lua" then do it:
ex: carary/data-otservbr-global/scripts/actions/other

Create blank premiumscroll.lua, and inside:
LUA:
local config = {
    scrollId = 14758,
    premiumDays = 30,
}

local days = config.premiumDays
local premiumScroll = Action()
function premiumScroll.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    player:addPremiumDays(days)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have received " .. days .. " days of premium account. Please re-login!")
    item:remove(1)
    addEvent(function()
        if player:isPlayer() then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "In total you have " .. player:getPremiumDays() .. " premium account days.")
        end
    end, 2500)
    return true
end

premiumScroll:id(config.scrollId)
premiumScroll:register()

Save it and restart server / reload scripts via GOD. Should work now.

[...] Ive been looking for a script that allows me to use the edited script "Premium Scroll" to be able to gain tibia store coins.
The script will be practically identical to the one above, except that you need to change the item id, change the days to the number of Tibia coins, and make a query (instead addPremiumDays) to the database. I would skip the second message to the player in this case.
Code:
scrollId = ur new scroll id, 
local coins = 250
db.query("UPDATE `accounts` SET `coins` = `coins` + '" .. coins .. "' WHERE `id` = '" .. player:getAccountId() .. "';")
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have received "..coins.." Tibia Coins.")
 
Solution
Hi. Im trying to add this script for tibia coins but its not working...


LUA:
local config = {
    scrollId = 14759,
    coins = 250,
}

local coins = config.coins
local coinScroll = Action()

function coinScroll.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    db.query("UPDATE `accounts` SET `coins` = `coins` + '" .. coins .. "' WHERE `id` = '" .. player:getAccountId() .. "';")
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have received " .. coins .. " Tibia Coins.")
    
    item:remove(1)
    
    return true
end

coinScroll:id(config.scrollId)
coinScroll:register()

Is there something wrong?

Im using Canary server
 
Hi. Im trying to add this script for tibia coins but its not working...


LUA:
local config = {
    scrollId = 14759,
    coins = 250,
}

local coins = config.coins
local coinScroll = Action()

function coinScroll.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    db.query("UPDATE `accounts` SET `coins` = `coins` + '" .. coins .. "' WHERE `id` = '" .. player:getAccountId() .. "';")
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have received " .. coins .. " Tibia Coins.")
   
    item:remove(1)
   
    return true
end

coinScroll:id(config.scrollId)
coinScroll:register()

Is there something wrong?

Im using Canary server
 
I tried reworking this code with GPT, referring to this:
LUA:
static int luaPlayerAddTibiaCoins(lua_State* L);

GPT give me this, but still not working.
Code:
local config = {
    scrollId = 14759,
    coins = 250,
}

local coins = config.coins
local coinScroll = Action()

function coinScroll.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if type(player.addTibiaCoins) == "function" then
        player:addTibiaCoins(coins)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have received " .. coins .. " Tibia Coins.")
    else
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Error: Function 'addTibiaCoins' not found.")
    end

    item:remove(1)

    return true
end

coinScroll:id(config.scrollId)
coinScroll:register()

I think it will be too much for me to build this script. Anyone can help me?
 
@rbQ321 I already posted it here, didn't you see it?
 
@rbQ321 I already posted it here, didn't you see it?
I tried both scripts from your post and neither of them gives Tibia coin, only the text "You received 25 Transferable Coins" appears. The item disappears from the inventory.
Post automatically merged:

LUA:
local addCoins = Action()

function addTournamentCoins(player, coins)
    local accountId = player:getAccountId()
    db.query("UPDATE `accounts` SET `coins` = `coins` + " .. coins .. " WHERE `id` = " .. accountId .. ";")
end

function addCoins.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local coins = 25
    addTournamentCoins(player, coins)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You received " .. coins .. " Tournament Coins")
    item:remove(1)
    return true
end

addCoins:id(22118)
addCoins:register()

This works well...
 
Last edited:
Back
Top