• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

openShopWindow

Oskar1121

Excellent OT User
Joined
Jul 15, 2009
Messages
700
Reaction score
710
Location
Poland
Hello everyone.
I want to when player use an object then opens a window of trade with items what I want.
I have this script, with NPC file (my Grizzly Adams) and when I paste it into actions script this doesn't work, anybody know what is wrong?
PHP:
local huntsMan_rank = { 
                    {id=11208, buy=0, sell=50, name="antlers"}, 
                    {id=10549, buy=0, sell=100, name="bloody pincers"}, 
                    {id=11183, buy=0, sell=35, name="crab pincers"}, 
                    {id=10573, buy=0, sell=55, name="cyclops toe"}, 
                    {id=10564, buy=0, sell=30, name="frosty ear of a troll"}, 
                    {id=11193, buy=0, sell=600, name="hydra head"}, 
                    {id=11366, buy=0, sell=80, name="lancer beetle shell"}, 
                    {id=10578, buy=0, sell=420, name="mutated bat ear"}, 
                    {id=11222, buy=0, sell=400, name="sabretooth"}, 
                    {id=11367, buy=0, sell=20, name="sandcrawler shell"}, 
                    {id=10547, buy=0, sell=280, name="scarab pincers"}, 
                    {id=11365, buy=0, sell=60, name="terramite legs"}, 
                    {id=11363, buy=0, sell=170, name="terramite shell"}, 
                    {id=11184, buy=0, sell=30000, name="terrorbird beak"}, 
                     
                    {id=7398, buy=0, sell=500, name="cyclops trophy"}, 
                    {id=7401, buy=0, sell=500, name="minotaur trophy"} 
                    } 
local items = {} 
for _, item in ipairs(huntsMan_rank) do 
    items[item.id] = {storage = item.storage, item_id = item.id, buyPrice = item.buy, sellPrice = item.sell, subType = 0, realName = item.name} 
end 

local onBuy = function(cid, item, subType, amount, ignoreCap, inBackpacks) 
    if items[item].buyPrice ~= 0 then 
        doPlayerRemoveMoney(cid, amount * items[item].buyPrice) 
        for i = 1, amount do 
            doPlayerAddItem(cid, items[item].item_id, amount) 
        end 
        doNPCTalkALot(cid, 200, {"You bought "..amount.." "..items[item].realName.." for "..items[item].buyPrice * amount.." gold coins."}) 
    end 
end 
  
local onSell = function(cid, item, subType, amount, ignoreCap, inBackpacks) 
    if items[item].sellPrice ~= 0 then 
        doPlayerAddMoney(cid, items[item].sellPrice * amount) 
        doPlayerRemoveItem(cid, items[item].item_id, amount) 
        doNPCTalkALot(cid, 200, {"You sell "..amount.." "..items[item].realName.." for "..items[item].sellPrice * amount.." gold coins."}) 
    end 
end 

openShopWindow(cid, huntsMan_rank, onBuy, onSell)
 
this is good question
but when I'll have time I'll at least check how deep patch is needed, cause Cyko is right: its a lot of work but there is chance that it wont be hell
 
Back
Top