Ir para conteúdo

Featured Replies

Postado

Olá pessoal a dúvida é simples, quero fazer quests que dão addons como recompensa. Mas na hora e abrir o servidor...

 

P78LqfY.png

 

action/scripts/mage.lua

function onUse(cid, item, frompos, item2, topos)
prize = item.uid

if prize > 0 and prize < 5000 then
queststatus = getPlayerStorageValue(cid,26087)

if queststatus == -1 then
doCreatureSay(cid, "You have found first Mage addon.", TALKTYPE_ORANGE_1)
doPlayerAddOutfit(cid, 138, 1)
doPlayerAddOutfit(cid, 130, 1)
setPlayerStorageValue(cid,26087,1)

else
doPlayerSendTextMessage(cid,22,"Is empty.")
end

 

Angelina_Me_by_msklotz.png

 

Atenciosamente,

Felipe Lotz.

 

Postado

Certo, tem 2x blocos aberto e só 1 end pra finalizar eles ?  

Spoiler

function onUse(cid, item, frompos, item2, topos)
prize = item.uid

if prize > 0 and prize < 5000 then
queststatus = getPlayerStorageValue(cid,26087)
end

if queststatus == -1 then
doCreatureSay(cid, "You have found first Mage addon.", TALKTYPE_ORANGE_1)
doPlayerAddOutfit(cid, 138, 1)
doPlayerAddOutfit(cid, 130, 1)
setPlayerStorageValue(cid,26087,1)

else
doPlayerSendTextMessage(cid,22,"Is empty.")
end

 

 

Editado por KotZletY (veja o histórico de edições)

                                                              ezgif-1-98aab239f3.gif.1a897c9c3225228909e7b356a5cfb8e4.gif

Postado
  • Autor

@KotZlet

 

Obrigado bro, estou aprendendo e na verdade não sabia que cada if era uma coluna aberta... Mas valeu a ajuda... Então ai peguei o Varkhal e mudei algumas coisas, mas não funcionou também...

 

yWBm0Ma.png

 

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
 
npcHandler:setMessage(MESSAGE_GREET, "Huhuhuuhuh |PLAYERNAME|. You want to look beautiful YEAAH?! Just say {addons} or {help} if you don't know what to do.")
 
function playerBuyAddonNPC(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
    if (parameters.confirm ~= true) and (parameters.decline ~= true) then
        if(getPlayerPremiumDays(cid) == 0) and (parameters.premium == true) then
            npcHandler:say('Sorry, but this addon is only for premium players!', cid)
            npcHandler:resetNpc()
            return true
        end
        if (getPlayerStorageValue(cid, parameters.storageID) ~= -1) then
            npcHandler:say('You already have this addon!', cid)
            npcHandler:resetNpc()
            return true
        end
        local itemsTable = parameters.items
        local items_list = ''
        if table.maxn(itemsTable) > 0 then
            for i = 1, table.maxn(itemsTable) do
                local item = itemsTable[i]
                items_list = items_list .. item[2] .. ' ' .. getItemNameById(item[1])
                if i ~= table.maxn(itemsTable) then
                    items_list = items_list .. ', '
                end
            end
        end
        local text = ''
        if (parameters.cost > 0) and table.maxn(parameters.items) then
            text = items_list .. ' and ' .. parameters.cost .. ' gp'
        elseif (parameters.cost > 0) then
            text = parameters.cost .. ' gp'
        elseif table.maxn(parameters.items) then
            text = items_list
        end
        npcHandler:say('Did you bring me ' .. text .. ' for ' .. keywords[1] .. '?', cid)
        return true
    elseif (parameters.confirm == true) then
        local addonNode = node:getParent()
        local addoninfo = addonNode:getParameters()
        local items_number = 0
        if table.maxn(addoninfo.items) > 0 then
            for i = 1, table.maxn(addoninfo.items) do
                local item = addoninfo.items[i]
                if (getPlayerItemCount(cid,item[1]) >= item[2]) then
                    items_number = items_number + 1
                end
            end
        end
        if(getPlayerMoney(cid) >= addoninfo.cost) and (items_number == table.maxn(addoninfo.items)) then
            doPlayerRemoveMoney(cid, addoninfo.cost)
            if table.maxn(addoninfo.items) > 0 then
                for i = 1, table.maxn(addoninfo.items) do
                    local item = addoninfo.items[i]
                    doPlayerRemoveItem(cid,item[1],item[2])
                end
            end
            doPlayerAddOutfit(cid, addoninfo.outfit_male, addoninfo.addon)
            doPlayerAddOutfit(cid, addoninfo.outfit_female, addoninfo.addon)
            setPlayerStorageValue(cid,addoninfo.storageID,1)
            npcHandler:say('Here you are.', cid)
        else
            npcHandler:say('You do not have needed items or cash!', cid)
        end
        npcHandler:resetNpc()
        return true
    elseif (parameters.decline == true) then
        npcHandler:say('Not interested? Maybe other addon?', cid)
        npcHandler:resetNpc()
        return true
    end
    return false
end
 
local noNode = KeywordNode:new({'no'}, playerBuyAddonNPC, {decline = true})
local yesNode = KeywordNode:new({'yes'}, playerBuyAddonNPC, {confirm = true})
 
-- hunter (done)
local outfit_node = keywordHandler:addKeyword({'hunter addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{10574,100}, {5879,100}}, outfit_female = 137, outfit_male = 129, addon = 3, storageID = 10003})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
 
-- knight (done)
local outfit_node = keywordHandler:addKeyword({'knight addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5930,50}, {5893,100}}, outfit_female = 139, outfit_male = 131, addon = 3, storageID = 10005})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
 
-- mage (done) 
local outfit_node = keywordHandler:addKeyword({'second mage addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5903,1}}, outfit_female = 138, outfit_male = 130, addon = 2, storageID = 10006}) 
outfit_node:addChildKeywordNode(yesNode) 
outfit_node:addChildKeywordNode(noNode) 
 
 
-- summoner (done)
local outfit_node = keywordHandler:addKeyword({'summoner addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5879,100}}, {{5911,100}}, {{5920,50}}, {{5882,50}}, outfit_female = 141, outfit_male = 133, addon = 3, storageID = 10009}) 
outfit_node:addChildKeywordNode(yesNode) 
outfit_node:addChildKeywordNode(noNode)
 
-- barbarian (done)
local outfit_node = keywordHandler:addKeyword({'barbarian addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5930,50}, {5893,100}}, {5948,100}}, outfit_female = 147, outfit_male = 143, addon = 3, storageID = 10011})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
 
-- druid (done)
local outfit_node = keywordHandler:addKeyword({'druid addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{10574,100}, {5898,100}}, {11367,100}}, outfit_female = 148, outfit_male = 144, addon = 3, storageID = 10013})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
 
-- nobleman (done)
local outfit_node = keywordHandler:addKeyword({'nobleman addon'}, playerBuyAddonNPC, {premium = true, cost = 10000000, items = {}, outfit_female = 140, outfit_male = 132, addon = 3, storageID = 10015})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
 
-- oriental (done)
local outfit_node = keywordHandler:addKeyword({'oriental addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5877,100}}, {{5948,100}}, {{5879,100}}, outfit_female = 150, outfit_male = 146, addon = 3, storageID = 10017})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
 
-- wizard (done)
local outfit_node = keywordHandler:addKeyword({'wizard addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{11367,100}, {5898,100}, outfit_female = 149, outfit_male = 145, addon = 3, storageID = 10021})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
 
-- beggar (done)
local outfit_node = keywordHandler:addKeyword({'beggar addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{10609,500}, outfit_female = 157, outfit_male = 153, addon = 3, storageID = 10025})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
 
-- shaman (done)
local outfit_node = keywordHandler:addKeyword({'shaman addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{10582,200}, outfit_female = 158, outfit_male = 154, addon = 3, storageID = 10029})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
 
-- brotherhood (done)(custom)
local outfit_node = keywordHandler:addKeyword({'brotherhood addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{6500,3500}}, outfit_female = 279, outfit_male = 278, addon = 3, storageID = 10039})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
 
keywordHandler:addKeyword({'addons'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can give you {citizen}, {hunter}, {knight}, {mage}, {nobleman}, {summoner}, {warrior}, {barbarian}, {druid}, {wizard}, {oriental}, {pirate}, {assassin}, {beggar}, {shaman}, {norseman}, {nighmare}, {jester}, {yalaharian}, {brotherhood}, {warmaster} and {wayfarer} addons.'})
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To buy addon say NAME addon.'})
keywordHandler:addKeyword({'citizen addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You explored the Rotworm cave today?'})
keywordHandler:addKeyword({'warrior addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Residents say the Demons stole the sword and all the rest ...'})
keywordHandler:addKeyword({'assassin addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Help the server buying a Addon Doll.'})
keywordHandler:addKeyword({'pirate addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Help the server buying a Addon Doll.'})
keywordHandler:addKeyword({'jester addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Help the server buying a Addon Doll.'})
keywordHandler:addKeyword({'demonhunter addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You need complete the Inquisition Quest.'})
keywordHandler:addKeyword({'nightmare addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You need complete the Sign of the Cross Quest.'})
keywordHandler:addKeyword({'yalaharian addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You need complete the Yalahar Quest.'})
keywordHandler:addKeyword({'warmaster addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You explored the Undead Dragon cave today?'})
keywordHandler:addKeyword({'wayfarer addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Only the best players have this addon, complete the Wrath of the Emperor Quest.'})
keywordHandler:addKeyword({'norseman addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'That huge animals and green ... led the Eskimo.'})

npcHandler:addModule(FocusModule:new())

Agradeço se puder ajudar :)

 

#EDIT

 

Haha encontrei o erro... as '{}' dos itens estavam totalmente erradas e ai bugava o script.

Editado por Felipe Lotz (veja o histórico de edições)

Angelina_Me_by_msklotz.png

 

Atenciosamente,

Felipe Lotz.

 

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo