Ir para conteúdo

Featured Replies

Postado
deu esse erro HcYmVgI.png

Cada erro ridículo que estou fazendo.

Falta de atenção minha, fiz esse script as 05 da manhã.

Enfim, agora deve dar certo:

[script removido]

 

Desculpa pela falta de atenção.

Muito sono..

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

The corrupt fear us.

The honest support us.

The heroic join us.

  • Respostas 17
  • Visualizações 1.4k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Amigo, você postou um script quase exatamente igual ao meu, além de que nem fez questão de modificar os valores do custo de cada parâmetro do NPC. Como acha que vai mudar o resultado?   Está

  • Cada erro ridículo que estou fazendo. Falta de atenção minha, fiz esse script as 05 da manhã. Enfim, agora deve dar certo: [script removido]   Desculpa pela falta de atenção. Muito sono..

  • É, esse script que eu fiz de madrugada não foi muito lógico. Refiz tudo agora: addoner.lua local prices = {500000, 1000000} -- {first, second} local keywordHandler = KeywordHandler:new() local np

Postado
  • Autor

Cada erro ridículo que estou fazendo.

Falta de atenção minha, fiz esse script as 05 da manhã.

Enfim, agora deve dar certo:

local tab = {
prices = {500000, 1000000} -- {first, second}
}

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

function creatureSayCallback(cid, type, msg)
    if (not npcHandler:isFocused(cid)) then
        return false
    end
    
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid

npcHandler:setMessage(MESSAGE_GREET, 'Hi |PLAYERNAME|. I sell the {first addons} set for '..tab.prices[1]..' gold coins and the {second addons} set for '..tab.prices[2]..' gold coins.')

    local outfits = {
        [0] = {136, 137, 138, 139, 140, 141, 142, 147, 148, 149, 150, 155, 156, 157, 158, 252, 269, 270, 279, 288, 324, 336, 366},
        [1] = {128, 129, 130, 131, 132, 133, 134, 143, 144, 145, 146, 151, 152, 153, 154, 251, 268, 273, 278, 289, 325, 335, 367}
    }
    
    for x = 1, table.maxn(outfits[getPlayerSex(cid)]) do
        if(msgcontains(msg, 'first addons')) then
            talkState[talkUser] = 1
            selfSay('Are you sure?', cid)
        elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
            if(doPlayerRemoveMoney(cid, tab.prices[1]) == true) then
                talkState[talkUser] = 0
                doPlayerAddOutfit(cid, outfits[getPlayerSex(cid)][x], 1)
                doSendMagicEffect(getThingPos(cid), CONST_ME_GIFT_WRAPS)
                selfSay('Here you are.', cid)
            else
                talkState[talkUser] = 0
                selfSay('Sorry, you do not have enough money.', cid)
            end
        elseif(msgcontains(msg, 'second addons')) then
            talkState[talkUser] = 2
            selfSay('Are you sure?', cid)
        elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then
            if(doPlayerRemoveMoney(cid, tab.prices[2]) == true) then
                talkState[talkUser] = 0
                doPlayerAddOutfit(cid, outfits[getPlayerSex(cid)][x], 2)
                doSendMagicEffect(getThingPos(cid), CONST_ME_GIFT_WRAPS)
                selfSay('Here you are.', cid)
            else
                talkState[talkUser] = 0
                selfSay('Sorry, you do not have enough money.', cid)
            end
        elseif(msgcontains(msg, 'no')) then
            talkState[talkUser] = 0
            selfSay('Okay, goodbye!', cid)
        end
    end
    return true
end

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

Desculpa pela falta de atenção.

Muito sono..

 

agora funfo so tem um problema so deu a citizen as outras n 

 

Im9eIPO.png

 

------------------------------------------------------------------------------------------------------------------------------------

ydsC7ws.png

I like

Postado

É, esse script que eu fiz de madrugada não foi muito lógico.
Refiz tudo agora:

addoner.lua

local prices = {500000, 1000000} -- {first, second}

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

function creatureSayCallback(cid, type, msg)
    if (not npcHandler:isFocused(cid)) then
        return false
    end
    
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid

    local outfits = {
        [0] = {136, 137, 138, 139, 140, 141, 142, 147, 148, 149, 150, 155, 156, 157, 158, 252, 269, 270, 279, 288, 324, 336, 366},
        [1] = {128, 129, 130, 131, 132, 133, 134, 143, 144, 145, 146, 151, 152, 153, 154, 251, 268, 273, 278, 289, 325, 335, 367}
    }
    
    if(msgcontains(msg, 'first addons')) then
        talkState[talkUser] = 1
        selfSay('Are you sure?', cid)
    elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
        if(doPlayerRemoveMoney(cid, prices[1]) == true) then
            for x = 1, (#outfits[getPlayerSex(cid)]) do
                talkState[talkUser] = 0
                doPlayerAddOutfit(cid, outfits[getPlayerSex(cid)][x], 1)
                doSendMagicEffect(getThingPos(cid), CONST_ME_GIFT_WRAPS)
            end
            selfSay('Here you are.', cid)
        else
            talkState[talkUser] = 0
            selfSay('Sorry, you need '..prices[1]..' gold coins to buy this addons.', cid)
        end
    elseif(msgcontains(msg, 'second addons')) then
        talkState[talkUser] = 2
        selfSay('Are you sure?', cid)
    elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then
        if(doPlayerRemoveMoney(cid, prices[2]) == true) then
            for x = 1, (#outfits[getPlayerSex(cid)]) do
                talkState[talkUser] = 0
                doPlayerAddOutfit(cid, outfits[getPlayerSex(cid)][x], 2)
                doSendMagicEffect(getThingPos(cid), CONST_ME_GIFT_WRAPS)
            end
            selfSay('Here you are.', cid)
        else
            talkState[talkUser] = 0
            selfSay('Sorry, you need '..prices[2]..' gold coins to buy this addons.', cid)
        end
    elseif(msgcontains(msg, 'no')) then
            talkState[talkUser] = 0
            selfSay('Okay, goodbye!', cid)
    end
    return true
end

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




Addoner.xml

<npc name="Addoner" script="data/npc/scripts/addoner.lua" access="5" lookdir="1">
<health now="1000" max="1000"/>
<look type="133" head="39" body="113" legs="38" feet="0" addons="3"/>
	<parameters>
		<parameter key="message_greet" value="Hi |PLAYERNAME|. I sell the {first addons} and the {second addons}." />
	</parameters>
</npc>

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

The corrupt fear us.

The honest support us.

The heroic join us.

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