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

Solved Npc Remove Gold Nugget how to do??

Bazi

Member
Joined
Oct 24, 2011
Messages
270
Reaction score
8
Location
Germany
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

function onCreatureAppear(cid)                npcHandler:onCreatureAppear(cid)            end
function onCreatureDisappear(cid)             npcHandler:onCreatureDisappear(cid)            end
function onCreatureSay(cid, type, msg)            npcHandler:onCreatureSay(cid, type, msg)        end
function onThink()                    npcHandler:onThink()                    end

local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)

shopModule:addBuyableItem({'Donation Rod'}, 2184, 1500, 'Donation Rod')
shopModule:addBuyableItem({'Donation Wand'}, 2453, 1500, 'Donation Wand')
shopModule:addBuyableItem({'Donator Ring'}, 7697, 1500, 'Donator Ring')
shopModule:addBuyableItem({'Donator Club'}, 11302, 1500, 'Donator Club')
shopModule:addBuyableItem({'Donator Helmet'}, 9778, 1000, 'Donator Helmet')
shopModule:addBuyableItem({'Donator Armor'}, 9776, 1200, 'Donator Armor')
shopModule:addBuyableItem({'Donator Robe'}, 2508, 1200, 'Donator Robe')
shopModule:addBuyableItem({'Donator Legs'}, 9777, 1100, 'Donator Legs')
shopModule:addBuyableItem({'Donator Boots'}, 11114, 1300, 'Donator Boots')
shopModule:addBuyableItem({'Donator Manarune'}, 2294, 2000, 'Donator Manarune')
shopModule:addBuyableItem({'Donator Healingrune'}, 2270, 2000, 'Donator Healingrune')
shopModule:addBuyableItem({'Donator Axe'}, 11317, 1500, 'Donator Axe')
shopModule:addBuyableItem({'Donator Sword'}, 11301, 1500, 'Donator Sword')
shopModule:addBuyableItem({'Donator Shield'}, 6433, 1500, 'Donator Shield')
shopModule:addBuyableItem({'Donator Arrow'}, 2352, 1500, 'Donator Arrow')
shopModule:addBuyableItem({'Donator Spellbook'}, 8903, 1500, 'Donator Spellbook')
shopModule:addBuyableItem({'Donator Bow'}, 8858, 1500, 'Donator Bow')



function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
    end

   

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

This is the Npc But how i make that the Npc Remove Gold Nugget

Thank you, sry for my bad english!

bump bump please help!
 
Last edited by a moderator:
Do you mean that it will see gold nuggets as money or that it will only accept gold nuggets?
Post your server version.
 
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end

local shopWindow = {}
local things = {
     {id = 2184, buy = 15, name = "Donation Rod"},
     {id = 2453, buy = 15, name = "Donation Wand"},
     {id = 7697, buy = 15, name = "Donator Ring"},
     {id = 11302, buy = 15, name = "Donator Club"},
     {id = 9778, buy = 10, name = "Donator Helmet"},
     {id = 9776, buy = 12, name = "Donator Armor"},
     {id = 2508, buy = 12, name = "Donator Robe"},
     {id = 9777, buy = 11, name = "Donator Legs"},
     {id = 11114, buy = 13, name = "Donator Boots"},
     {id = 2294, buy = 20, name = "Donator Manarune"},
     {id = 11302, buy = 20, name = "Donator Healingrune"},
     {id = 11317, buy = 15, name = "Donator Axe"},
     {id = 11301, buy = 15, name = "Donator Sword"},
     {id = 6433, buy = 15, name = "Donator Shield"},
     {id = 2352, buy = 15, name = "Donator Arrow"},
     {id = 8903, buy = 15, name = "Donator Spellbook"},
     {id = 8858, buy = 15, name = "Donator Bow"}
}

local onBuy = function(cid, item, subType, amount, ignoreCap, inBackpacks)
     if doPlayerRemoveItem(cid, 2157, shopWindow[item].Price*amount) then
         if isItemStackable(item) then
             doPlayerAddItem(cid, item, amount)
         else
             for x = 1, amount do
                 doPlayerAddItem(cid, item, 1)
             end
         end
         doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have bought "..amount.."x "..shopWindow[item].Name.." for "..shopWindow[item].Price*amount.." gold nuggets.")
     else
         selfSay("You don't have enough gold nuggets.", cid)
     end
     return true
end


function creatureSayCallback(cid, type, msg)
     if not npcHandler:isFocused(cid) then
         return false
     end

     if msgcontains(msg, 'trade') then
         for var, item in pairs(things) do
             shopWindow[item.id] = {Price = item.buy, Name = item.name}
         end
         openShopWindow(cid, things, onBuy, onSell)
     end
     return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Limos if the player have no gold coin, platinum coin or crystal coin in his backpack he cant buy the items

you know how i can fix this?
 
Back
Top