RevScript Lever Buy Item

Alex

Miembro del equipo
Webdesigner
LV
58
 
Awards
38
Hola a todos,

Aqui les cuelgo un script, que al usar un lever ( ID 1945 ) , dé un item por gold.

Por ejemplo activas el lever, y por 100000 golds tienes una magic plate armor.

El script lo poneis en data/scripts/action
Debereis de crear un lever, con el item que se vea encima de un counter, en el lever le pondreis la UniqueID que pondreis en el script:

Código:
local c = {
    ['item'] = 7589,  --- ID of the item
    ['cost'] = 1000000,  ---  Price
    ['amount'] = 100,  ---  Item Quantity
    uniqueID = 7777  ---  Unique Id , do not forget add it on remeres map editor and on the end of this script
}

local leverBuy = Action()
function leverBuy.onUse(player, item, fromPosition, itemEx, toPosition)
  local cid = player:getId()
    if player:removeMoneyNpc(c.cost) then
            doPlayerAddItem(cid, c.item, c.amount)
            doPlayerSendTextMessage(cid, 25,"You bought ".. c.amount .."x ".. getItemName(c.item).." for ".. c.cost .." gold")
    else
            player:sendTextMessage(MESSAGE_TRADE, "You do not have enough money!")
    end
  item:transform(c[item.itemid])
    return true
end

leverBuy:uid(7777) -- Unique id added on Remeres map editor
leverBuy:register()
 
Arriba