Bom Pessoal, Estou Precisando De Um Npc Que Venda As Mount 9.60
E Se Possivel Que Ele ao inves de pegar dinheiro ele pegue outro item !
Id Do Item Que o Npc Vai remover: 6527
Otserv: 9.60 SQLITE !
Espero Que Possam Ajudar !!!
Bom Pessoal, Estou Precisando De Um Npc Que Venda As Mount 9.60
E Se Possivel Que Ele ao inves de pegar dinheiro ele pegue outro item !
Id Do Item Que o Npc Vai remover: 6527
Otserv: 9.60 SQLITE !
Espero Que Possam Ajudar !!!
...
Tem um do Vodkart, só tem o basico mas vc pode editar para o seu caso.
lib/functions.lua
function getItemsFromList(items) -- by vodka local str = '' if table.maxn(items) > 0 then for i = 1, table.maxn(items) do str = str .. items[i][2] .. ' ' .. getItemNameById(items[i][1]) if i ~= table.maxn(items) then str = str .. ', ' end end end return str end function doRemoveItemsFromList(cid,items) -- by vodka local count = 0 if table.maxn(items) > 0 then for i = 1, table.maxn(items) do if getPlayerItemCount(cid,items[i][1]) >= items[i][2] then count = count + 1 end end end if count == table.maxn(items) then for i = 1, table.maxn(items) do doPlayerRemoveItem(cid,items[i][1],items[i][2]) end else return false end return true end
Data/NPC
Mount Seller.xml
<?xml version="1.0"?> <npc name="Mount Seller" script="data/npc/scripts/buymount.lua" walkinterval="50000" floorchange="0"> <health now="100" max="100"/> <look type="129" head="95" body="116" legs="121" feet="115" addons="3"/> <parameters> <parameter key="message_greet" value="Hello |PLAYERNAME|.I have many {mounts} to sell for you!" /> </parameters> </npc>
Data/Npc/script
buymount.lua
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 function AddMount(cid, message, keywords, parameters, node) --by vodka if(not npcHandler:isFocused(cid)) then return false end if (isPlayerPremiumCallback == nil or isPlayerPremiumCallback(cid) == true or parameters.premium == false) then if(parameters.level ~= nil and getPlayerLevel(cid) < parameters.level) then npcHandler:say('You must reach level ' .. parameters.level .. ' to buy this mount.', cid) elseif canPlayerRideMount(cid, parameters.mountid) then npcHandler:say('you already have this mount!', cid) elseif not doRemoveItemsFromList(cid,parameters.items) then npcHandler:say('Sorry You need '..getItemsFromList(parameters.items)..' to buy this mount!', cid) else doPlayerAddMount(cid, parameters.mountid) npcHandler:say('Here is your mount!', cid) npcHandler:resetNpc() end else npcHandler:say('I can only allow premium players to buy this mount.', cid) end npcHandler:resetNpc() return true end local mounts = { {"widow queen", items = {{2124,1},{2393,2}}, mountid = 1, level = 10, premium = false}, {"racing bird", items = {{2494,1},{2393,2}}, mountid = 2, level = 15, premium = true}, {"mounts", text = "I sell these mounts: {widow queen},{racing bird},{war Bear},{black sheep},{midnight panther},{draptor},{titanica},{tin lizzard}.{blazebringer},{rapid boar},{stampor} or {undead cavebear}!"} } for i = 1, #mounts do local get = mounts[i] if type(get.items) == "table" then local node = keywordHandler:addKeyword({get[1]}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "You want to buy the mount " .. get[1] .. " for "..getItemsFromList(get.items).." ?"}) node:addChildKeyword({"yes"}, AddMount, {items = get.items,mountid = get.mountid, level = get.level, premium = get.premium}) node:addChildKeyword({"no"}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Ok, then.", reset = true}) else keywordHandler:addKeyword({get[1]}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = get.text}) end end mounts = nil npcHandler:addModule(FocusModule:new())
configuração:
local mounts = { {"widow queen", items = {{2124,1},{2393,2}}, mountid = 1, level = 10, premium = false}, {"racing bird", items = {{2494,1},{2393,2}}, mountid = 2, level = 15, premium = true}, {"mounts", text = "I sell these mounts: {widow queen},{racing bird},{war Bear},{black sheep},{midnight panther},{draptor},{titanica},{tin lizzard}.{blazebringer},{rapid boar},{stampor} or {undead cavebear}!"} }
"nome da montaria"
items = {} -- é os items que precisa ter trocar pela mount
mountid -- é o id da montaria
level -- level necessario para comprar
premium -- se precisa ser premium para comprar
text -- n precisa mexer,é para saber que montaria ele pode comprar,pode adicionar + nome na lista se quiser
adicionando mount então por exemplo war bear:
local mounts = { {"widow queen", items = {{2124,1},{2393,2}}, mountid = 1, level = 10, premium = false}, {"racing bird", items = {{2494,1},{2393,2}}, mountid = 2, level = 15, premium = true}, {"war bear", items = {{2123,2},{2124,1},{2173,1}}, mountid = 3, level = 20, premium = false}, {"mounts", text = "I sell these mounts: {widow queen},{racing bird},{war Bear},{black sheep},{midnight panther},{draptor},{titanica},{tin lizzard}.{blazebringer},{rapid boar},{stampor} or {undead cavebear}!"} }
Npc que vende montarias por dinheiro...troca de itens não tenho, espero que ajude assim mesmo.
Arquivo do npc
<?xml version="1.0"?> <npc name="Mount Master" script="data/npc/scripts/buymount.lua" walkinterval="50000" floorchange="0"> <health now="100" max="100"/> <look type="129" head="95" body="116" legs="121" feet="115" addons="3"/> <parameters> <parameter key="message_greet" value="Hello |PLAYERNAME|.I have many {mounts} to sell for you!" /> </parameters> </npc>
Arquivo lua
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 function AddMount(cid, message, keywords, parameters, node) --by vodka if(not npcHandler:isFocused(cid)) then return false end if parameters.premium == true and not isPremium(cid) then return true,npcHandler:say('Sorry,Only premium members buy this mount!', cid) elseif not doPlayerRemoveMoney(cid, parameters.price) then return true,npcHandler:say('Sorry You need '..parameters.price..' gps to buy this mount!', cid) end doPlayerAddMount(cid, parameters.mount) npcHandler:say('Here is your mount!', cid) npcHandler:resetNpc() return true end keywordHandler:addKeyword({'mounts'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell these mounts: {widow queen},{racing bird},{war Bear},{black sheep},{midnight panther},{common draptor},{titanica},{tin lizzard},{blazebringer},{rapid boar},{stampor}, {undead cavebear}, {donkey}, {tiger slug}, {uniwheel}, {crystal wolf}, {war horse}, {kingly deer}, {tamed panda}, {dromedary}, {sandstone scorpion}, {fire horse}, {shadow draptor}, {rented horse}, {rented horse}, {lady bug},{manta},{ironblight},{magma crawler},{dragonling},{gnarlhound}!'}) local node1 = keywordHandler:addKeyword({'widow queen'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You want to buy the mount widow queen?'}) node1:addChildKeyword({'yes'}, AddMount, {price = 1000000,mount = 1,premium = false}) node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) local node2 = keywordHandler:addKeyword({'racing bird'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You want to buy the mount racing bird'}) node2:addChildKeyword({'yes'}, AddMount, {price = 1000000,mount = 2,premium = true}) node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) local node3 = keywordHandler:addKeyword({'war bear'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You want to buy the mount war Bear'}) node3:addChildKeyword({'yes'}, AddMount, {price = 1000000,mount = 3,premium = false}) node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) local node4 = keywordHandler:addKeyword({'black sheep'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You want to buy the mount black sheep?'}) node4:addChildKeyword({'yes'}, AddMount, {price = 1000000,mount = 4,premium = false}) node4:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) local node5 = keywordHandler:addKeyword({'midnight panther'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You want to buy the mount midnight panther?'}) node5:addChildKeyword({'yes'}, AddMount, {price = 1000000,mount = 5,premium = true}) node5:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) local node6 = keywordHandler:addKeyword({'common draptor'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You want to buy the mount common draptor?'}) node6:addChildKeyword({'yes'}, AddMount, {price = 1000000,mount = 6,premium = true}) node6:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) local node7 = keywordHandler:addKeyword({'titanica'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You want to buy the mount titanica?'}) node7:addChildKeyword({'yes'}, AddMount, {price = 1000000,mount = 7,premium = true}) node7:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) local node8 = keywordHandler:addKeyword({'tin lizzard'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You want to buy the mount tin lizzard?'}) node8:addChildKeyword({'yes'}, AddMount, {price = 1000000,mount = 8,premium = true}) node8:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) local node9 = keywordHandler:addKeyword({'blazebringer'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You want to buy the mount blazebringer?'}) node9:addChildKeyword({'yes'}, AddMount, {price = 1000000,mount = 9,premium = true}) node9:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) local node10 = keywordHandler:addKeyword({'rapid boar'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You want to buy the mount rapid boar?'}) node10:addChildKeyword({'yes'}, AddMount, {price = 1000000,mount = 10,premium = false}) node10:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) local node11 = keywordHandler:addKeyword({'stampor'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You want to buy the mount stampor?'}) node11:addChildKeyword({'yes'}, AddMount, {price = 1000000,mount = 11,premium = true}) node11:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) local node12 = keywordHandler:addKeyword({'undead cavebear'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You want to buy the mount undead cavebear?'}) node12:addChildKeyword({'yes'}, AddMount, {price = 1000000,mount = 12,premium = true}) node12:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) local node13 = keywordHandler:addKeyword({'donkey'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You want to buy the mount mule?'}) node13:addChildKeyword({'yes'}, AddMount, {price = 1000000,mount = 13,premium = true}) node13:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) local node14 = keywordHandler:addKeyword({'tiger slug'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You want to buy the mount tiger slug?'}) node14:addChildKeyword({'yes'}, AddMount, {price = 1000000,mount = 14,premium = true}) node14:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) local node15 = keywordHandler:addKeyword({'uniwheel'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You want to buy the mount uniwheel?'}) node15:addChildKeyword({'yes'}, AddMount, {price = 1000000,mount = 15,premium = true}) node15:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) local node16 = keywordHandler:addKeyword({'crystal wolf'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You want to buy the mount crystal wolf?'}) node16:addChildKeyword({'yes'}, AddMount, {price = 1000000,mount = 16,premium = true}) node16:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) local node17 = keywordHandler:addKeyword({'war horse'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You want to buy the mount war horse?'}) node17:addChildKeyword({'yes'}, AddMount, {price = 1000000,mount = 17,premium = true}) node17:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) local node18 = keywordHandler:addKeyword({'kingly deer'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You want to buy the mount kingly deer?'}) node18:addChildKeyword({'yes'}, AddMount, {price = 1000000,mount = 18,premium = true}) node18:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) local node19 = keywordHandler:addKeyword({'tamed panda'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You want to buy the mount tamed panda?'}) node19:addChildKeyword({'yes'}, AddMount, {price = 1000000,mount = 19,premium = true}) node19:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) local node20 = keywordHandler:addKeyword({'dromedary'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You want to buy the mount dromedary?'}) node20:addChildKeyword({'yes'}, AddMount, {price = 1000000,mount = 20,premium = true}) node20:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) local node21 = keywordHandler:addKeyword({'sandstone scorpion'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You want to buy the mount sandstone scorpion?'}) node21:addChildKeyword({'yes'}, AddMount, {price = 1000000,mount = 21,premium = true}) node21:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) local node22 = keywordHandler:addKeyword({'rented horse'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You want to buy the mount rented horse?'}) node22:addChildKeyword({'yes'}, AddMount, {price = 1000000,mount = 22,premium = true}) node22:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) local node23 = keywordHandler:addKeyword({'fire war horse'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You want to buy the mount fire war horse?'}) node23:addChildKeyword({'yes'}, AddMount, {price = 1000000,mount = 23,premium = true}) node23:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) local node24 = keywordHandler:addKeyword({'shadow draptor'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You want to buy the mount shadow draptor?'}) node24:addChildKeyword({'yes'}, AddMount, {price = 1000000,mount = 24,premium = true}) node24:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) local node25 = keywordHandler:addKeyword({'rented horse'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You want to buy the mount rented horse?'}) node25:addChildKeyword({'yes'}, AddMount, {price = 1000000,mount = 25,premium = true}) node25:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) local node26 = keywordHandler:addKeyword({'rented Horse'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You want to buy the mount rented Horse?'}) node26:addChildKeyword({'yes'}, AddMount, {price = 1000000,mount = 26,premium = true}) node26:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) local node27 = keywordHandler:addKeyword({'lady bug'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You want to buy the mount lady bug?'}) node27:addChildKeyword({'yes'}, AddMount, {price = 1000000,mount = 27,premium = true}) node27:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) local node28 = keywordHandler:addKeyword({'manta'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You want to buy the mount manta?'}) node28:addChildKeyword({'yes'}, AddMount, {price = 1000000,mount = 28,premium = true}) node28:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) local node29 = keywordHandler:addKeyword({'ironblight'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You want to buy the mount ironblight?'}) node29:addChildKeyword({'yes'}, AddMount, {price = 1000000,mount = 29,premium = true}) node29:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) local node30 = keywordHandler:addKeyword({'magma crawler'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You want to buy the mount magma crawler?'}) node30:addChildKeyword({'yes'}, AddMount, {price = 1000000,mount = 30,premium = true}) node30:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) local node31 = keywordHandler:addKeyword({'dragonling'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You want to buy the mount dragonling?'}) node31:addChildKeyword({'yes'}, AddMount, {price = 1000000,mount = 31,premium = true}) node31:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) local node32 = keywordHandler:addKeyword({'gnarlhound'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You want to buy the mount gnarlhound?'}) node32:addChildKeyword({'yes'}, AddMount, {price = 1000000,mount = 32,premium = true}) node32:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) npcHandler:addModule(FocusModule:new())
Crédito ao Xtibia 95% pelo arquivo original e 5% meu por atualizar.