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

[Script] Tibia Coin need help.

sadguys

New Member
Joined
Jul 20, 2017
Messages
3
Reaction score
0
Hey guys! I need a script that transform an item (Tibia Coin) into an ingame Store Coin; i've tried this:


-ITEMS.XML:
<item id="24774" article="a" name="Tibia coin">
<attribute key="weight" value="0" />
<attribute key="description" value="Tibia Coins are needed to shop exclusive products in the Store, including fabulous mounts, classy outfits, a Name Change or even Premium Time." />
</item>

- TIBIACOIN.LUA:

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local points = 10
db.query("UPDATE `accounts` SET `coins` = `coins` + '" .. points .. "' WHERE `id` = '" .. player:getAccountId() .. "';")
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Você recebeu "..points.." coins")
item:remove(1)
return true
end

- actions.xml

<action itemid="24774" script="other/tibiacoin.lua"/>
 
Code:
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, 10)
    doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You have recived 10 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

Make shure u have coins row in your database/accounts
 
Back
Top