Nightimarez
New Member
- Joined
- Jul 24, 2008
- Messages
- 287
- Reaction score
- 2
I need a script to buy items using soul orbs instead of money.
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 tabla = {
["boots of haste"] = {10, 2195},
["demon helmet"] = {11, 2493},
["frozen starlight"] = {30, 2361},
["spellbook of dark mysteries"] = {20, 8918},
["royal crossbow"] = {20, 8851},
["stuffed dragon"] = {30, 5791},
["star tear"] = {100, 7735},
["jester staff"] = {100, 7958},
["vancini axe"] = {100, 8925},
["firewalker boots"] = {50, 9932},
["flame blade"] = {100, 8931}
}
function creatureSayCallback(cid, type, msg)
local s = getPlayerItemCount
local msgn = "You dont have the neccesary soul orbs for this!"
if (msgcontains(msg, 'trade')) and s(cid,5944) == 0 then
npcHandler:say('You dont have soul orbs', cid)
elseif msgcontains(msg, 'trade') and s(cid,5944) >= 1 then
npcHandler:say('You can change your soul orbs for, {boots of haste}, {demon helmet}, {frozen starlight}, {spellbok of dark mysteries}, {royal crossbow} y {stuffed dragon} ... And with more than 30 soul orbs for, {star tear}, {jester staff}, {vancini axe}, {flame blade} y {firewalker boots}', cid)
end
for txt, v in pairs(tabla) do
if msgcontains(msg, txt) then
if doPlayerRemoveItem(cid,10581,v[1]) then
doPlayerAddItem(cid,v[2],1)
npcHandler:say("You got a ".. getItemNameById(v[2]) .."!", cid)
else
npcHandler:say("".. msgn .."", cid)
end
end
end
return true
end
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())