• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action [TFS 1.2] Tibia Coin.

Methemia

Member
Joined
Feb 1, 2015
Messages
59
Reaction score
7
Code:
<action itemid="24774" script="tibiacoin.lua" />

data/actions/scripts/tibiacoin.lua
Code:
local config = {
   idcoin = 24774
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
   local player = Player(cid)
   local item = Item(item.uid)
   if player:getItemCount(config.idcoin) > 0 then
       local coinplayer = player:getCoinsBalance()+item:getCount()
       player:getPosition():sendMagicEffect(15)
       item:remove()
       player:setCoinsBalance(coinplayer)
   else
       player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have to carry tibia coins in your backpack.")
   end
   return true
end
 
i use this and work like a charm
Lua:
local function doPlayerAddPremiumPoints(cid, count)
        db.query('UPDATE accounts SET coins = coins+'.. count ..' WHERE id = ' .. getAccountNumberByPlayerName(getCreatureName(cid)))
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
    doPlayerAddPremiumPoints(cid, 500)
    doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You have recived 500 coins to your account.")
    doSendMagicEffect(getCreaturePosition(cid), 28)
    doSendMagicEffect(getCreaturePosition(cid), 76)
    doSendMagicEffect(getCreaturePosition(cid), 75)
    doSendMagicEffect(getCreaturePosition(cid), 50)
    doRemoveItem(item.uid,1)
    return true
end
 
Back
Top