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

Buy expierence from shop offer? rep++

quinkan

New Member
Joined
Mar 15, 2009
Messages
125
Reaction score
0
how can i make so people can buy experience from shop offer? i will rep you if you help me Artii if you see this. please help me:) i want to have like urs "seldora.com":D
 
Untested

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 expgive    = 'Here you go.'
local nomoney        = 'You dont have enough money!'
local cost            = 10000
local exp                = 1000000

npcHandler:setMessage(MESSAGE_GREET, "Greetings, |PLAYERNAME|.")

function expBuy(cid, message, keywords, parameters, node)

    if(not npcHandler:isFocused(cid)) then
        return false
    end

             if doPlayerRemoveMoney(cid, cost) then
            npcHandler:say(expgive)
            doPlayerAddExp(cid, exp)
        end
        else
            npcHandler:say(nomoney)
        end
    end

keywordHandler:addKeyword({'exp'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Do you want to buy |exp| experience for the total cost of |cost| gold pieces?"})
local node1 = keywordHandler:addKeyword({'experience'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy |exp| experience for the total cost of |cost| gold pieces?'})
    node1:addChildKeyword({'yes'}, expBuy, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok then.', reset = true})

npcHandler:addModule(FocusModule:new())
 
Back
Top