Ir para conteúdo
  • Cadastre-se

Posts Recomendados

Queria um NPC que tira-se red e black skull pelo item 1010

 

Red skull 5 itens, black skull 10 itens

 

Teria que pagar com o item 1010 pra remover a red e a black

 

source 0.4

 

;)

 

 

Link para o post
Compartilhar em outros sites
  • Moderador

Aqui está:

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




if msgcontains(msg, "remover") then
npcHandler:say("Voce quer remover seu red skull? {yes} ou {no}.", cid)
talkState[talkUser] = 1

elseif msgcontains(msg, "no") and talkState[talkUser] == 1 then
npcHandler:say("Esta bem, quando decidir fale comigo novamente.", cid)
talkState[talkUser] = 0

elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then
if getCreatureSkullType(cid) < SKULL_RED then
npcHandler:say("Voce nao esta red skull.", cid)
else
if doPlayerRemoveItem(cid, 1010, 5) then
db.executeQuery("UPDATE killers SET unjustified = '0' WHERE id IN (SELECT kill_id FROM player_killers WHERE player_id = "..getPlayerGUID(cid)..")")
doCreatureSetSkullType(cid, 0)
npcHandler:say("Seu red skull foi removido.", cid)
else
npcHandler:say("Voce nao tem o necessario para remover seu red skull.", cid)
end
end
end


end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Editado por Animal Pak (veja o histórico de edições)

x1fCxnI.png

Link para o post
Compartilhar em outros sites

Preciso das checagens de se player tem black skull ou red skull, esse script já pode me dar uma base, mas ainda falta umas coisas, eu queria script que remove-se black e red, se vc me der os ifs, acho que já da pra eu fazer... e outra estrutura de condicional

Link para o post
Compartilhar em outros sites
  • Moderador

Preciso das checagens de se player tem black skull ou red skull, esse script já pode me dar uma base, mas ainda falta umas coisas, eu queria script que remove-se black e red, se vc me der os ifs, acho que já da pra eu fazer... e outra estrutura de condicional

 

 

if getCreatureSkullType(cid) < SKULL_RED then
Link para o post
Compartilhar em outros sites

Tentei fazer o meu, mas quando fala red skull da esse erro:

YyAXDeZ.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
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false    
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

if getCreatureCondition(cid, CONDITION_INFIGHT) then
    npcHandler:say("You are in fight! Wait!", cid)
    return true
end
 
if(msgcontains(msg, 'remove')) then
        selfSay('I can remove you skulls: {red skull} [5 tokens], {black skull} [10 tokens]', cid)
 
elseif(msgcontains(msg, 'red skull')) then  
    if not getPlayerItemCount(cid, 6527) >= 5 then
        selfSay("You dont have 5 tokens!", cid)
        return true
    end
    if not getCreatureSkullType(cid) < 4 then
        selfSay("You dont have RED SKULL!", cid)
        return true
    end
    doPlayerRemoveItem(cid, 6527, 5)
    selfSay("Here it is.", cid)
    db.executeQuery("UPDATE killers SET unjustified = '0' WHERE id IN (SELECT kill_id FROM player_killers WHERE player_id = "..getPlayerGUID(cid)..")")
    doCreatureSetSkullType(cid, 0)

elseif(msgcontains(msg, 'black skull')) then  
    if not getPlayerItemCount(cid, 6527) >= 10 then
        selfSay("You dont have 10 tokens!", cid)
        return true
    end
    if not getCreatureSkullType(cid) < 5 then
        selfSay("You dont have BLACK SKULL!", cid)
        return true
    end
    doPlayerRemoveItem(cid, 6527, 10)
    selfSay("Here it is.", cid)
    db.executeQuery("UPDATE killers SET unjustified = '0' WHERE id IN (SELECT kill_id FROM player_killers WHERE player_id = "..getPlayerGUID(cid)..")")
    doCreatureSetSkullType(cid, 0)
    

end
return true
end   
         

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Link para o post
Compartilhar em outros sites

Fiz um aqui, testa ai:

local t = {
    itemneed = 9971,
    count = {5, 10} -- Red/Black skull.
}

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
    msg = msg:lower();
    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
    local n = getItemNameById(t.itemneed)

    if msgcontains(msg, 'remove') then
        selfSay('Eu removo {black skull} por '.. t.count[2] ..' '.. n ..' e {red skull} por '.. t.count[1] ..' '.. n ..'.', cid)
    elseif msgcontains(msg, 'black skull') then
        if getCreatureSkullType(cid) == SKULL_BLACK then
            selfSay('Você deseja remover sua black skull por '.. t.count[2] ..' '.. n ..'?', cid)
            talkState[talkUser] = 1
        else
            selfSay('Você não tem uma black skull.', cid)
        end
    elseif msgcontains(msg, 'red skull') then
        if getCreatureSkullType(cid) == SKULL_RED then
            selfSay('Você deseja remover sua red skull por '.. t.count[1] ..' '.. n ..'?', cid)
            talkState[talkUser] = 2
        else
            selfSay('Você não tem uma red skull.', cid)
        end
    end
        
    if msgcontains(msg, 'yes') then
        if talkState[talkUser] == 1 then
            if doPlayerRemoveItem(cid, t.itemneed, t.count[2]) then
                db.executeQuery("UPDATE killers SET unjustified = '0' WHERE id IN (SELECT kill_id FROM player_killers WHERE player_id = "..getPlayerGUID(cid)..")")
                doCreatureSetSkullType(cid, 0)
                selfSay('Sua black skull foi removida.', cid)
                talkState[talkUser] = 0
            else
                selfSay('Você não tem '.. t.count[2] ..' '.. n ..'.', cid)
                talkState[talkUser] = 0
            end
        elseif talkState[talkUser] == 2 then
            if doPlayerRemoveItem(cid, t.itemneed, t.count[1]) then
                db.executeQuery("UPDATE killers SET unjustified = '0' WHERE id IN (SELECT kill_id FROM player_killers WHERE player_id = "..getPlayerGUID(cid)..")")
                doCreatureSetSkullType(cid, 0)
                selfSay('Sua red skull foi removida.', cid)
                talkState[talkUser] = 0
            else
                selfSay('Você não tem '.. t.count[1] ..' '.. n ..'.', cid)
                talkState[talkUser] = 0
            end
        end
    end
end    

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Link para o post
Compartilhar em outros sites

Teu script ta funcionando perfeitamente brother, mas só uma dúvida
To achando que esse problema é no meu !frags, quando eu dou !frags da como se eu tive-se red ainda, fica a msg

Your black skull will...

 

Dessa parte do script eu acho

        if(skullEnd > 0) then
            result = result .. "\nYour " .. (getCreatureSkullType(cid) == SKULL_RED and "red" or "black") .. " skull will expire at " .. os.date("%d %B %Y %X", skullEnd)
        end

 

Será que isso não vai dar problema depois no meu ot não? Pq a variavel skullend ta > q 0

 

!frags.lua

local config = {
    useFragHandler = getBooleanFromString(getConfigValue('useFragHandler')),
    advancedFragList = getBooleanFromString(getConfigValue('advancedFragList'))
}

function onSay(cid, words, param, channel)
    if(not config.useFragHandler) then
        return false
    end

    local time = os.time()
    local times = {today = (time - 86400), week = (time - (7 * 86400))}

    local contents, result = {day = {}, week = {}, month = {}}, db.getResult("SELECT `pd`.`date`, `pd`.`level`, `p`.`name` FROM `player_killers` pk LEFT JOIN `killers` k ON `pk`.`kill_id` = `k`.`id` LEFT JOIN `player_deaths` pd ON `k`.`death_id` = `pd`.`id` LEFT JOIN `players` p ON `pd`.`player_id` = `p`.`id` WHERE `pk`.`player_id` = " .. getPlayerGUID(cid) .. " AND `k`.`unjustified` = 1 AND `pd`.`date` >= " .. (time - (30 * 86400)) .. " ORDER BY `pd`.`date` DESC")
    if(result:getID() ~= -1) then
        repeat
            local content = {
                name = result:getDataString("name"),
                level = result:getDataInt("level"),
                date = result:getDataInt("date")
            }
            if(content.date > times.today) then
                table.insert(contents.day, content)
            elseif(content.date > times.week) then
                table.insert(contents.week, content)
            else
                table.insert(contents.month, content)
            end
        until not result:next()
        result:free()
    end

    local size = {
        day = table.maxn(contents.day),
        week = table.maxn(contents.week),
        month = table.maxn(contents.month)
    }
    if(config.advancedFragList) then
        local result = "Frags gained today: " .. size.day .. "."
        if(size.day > 0) then
            for _, content in ipairs(contents.day) do
                result = result .. "\n* " .. os.date("%d %B %Y %X at ", content.date) .. content.name .. " on level " .. content.level
            end

            result = result .. "\n"
        end

        result = result .. "\nFrags gained this week: " .. (size.day + size.week) .. "."
        if(size.week > 0) then
            for _, content in ipairs(contents.week) do
                result = result .. "\n* " .. os.date("%d %B %Y %X at ", content.date) .. content.name .. " on level " .. content.level
            end

            result = result .. "\n"
        end

        result = result .. "\nFrags gained this month: " .. (size.day + size.week + size.month) .. "."
        if(size.month > 0) then
            for _, content in ipairs(contents.month) do
                result = result .. "\n* " .. os.date("%d %B %Y %X at ", content.date) .. content.name .. " on level " .. content.level
            end

            result = result .. "\n"
        end

        local skullEnd = getPlayerSkullEnd(cid)
        if(skullEnd > 0) then
            result = result .. "\nYour " .. (getCreatureSkullType(cid) == SKULL_RED and "red" or "black") .. " skull will expire at " .. os.date("%d %B %Y %X", skullEnd)
        end

        doPlayerPopupFYI(cid, result)
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You currently have " .. size.day .. " frags today, " .. (size.day + size.week) .. " this week and " .. (size.day + size.week + size.month) .. " this month.")
        if(size.day > 0) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Last frag at " .. os.date("%d %B %Y %X", contents.day[1].date) .. " on level " .. contents.day[1].level .. " (" .. contents.day[1].name .. ").")
        end

        local skullEnd = getPlayerSkullEnd(cid)
        if(skullEnd > 0) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your " .. (getCreatureSkullType(cid) == SKULL_RED and "red" or "black") .. " skull will expire at " .. os.date("%d %B %Y %X", skullEnd))
        end
    end

    return true
end
 
Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

  • Conteúdo Similar

    • Por Jaurez
      .
    • Por Cat
      Em alguns casos, o tibia 8.60 comum não abre de jeito nenhum no map editor, mesmo desmarcando check file signatures e configurando o path corretamente.
       
      Este é o client 8.60 adaptado para o Remere's Map Editor. Resolvi postar já que ele foi removido do site oficial do RME. (ficou apenas a versão para linux lá)
      Se estiver tendo problemas para abrir a versão 8.60, tente utilizar este.
                                                                                                                     
      Baixar o Tibia Client 8.60 que funciona no Remere’s Map Editor
      Essa versão do Tibia 8.60 client resolve o erro unsupported client version ou Could not locate tibia.dat and/or tibia.spr, please navigate to your tibia 8.60 installation folder.
       
      Downloads
      https://tibiaking.com/applications/core/interface/file/attachment.php?id=47333

      Scan: https://www.virustotal.com/gui/file/333e172ac49ba2028db9eb5889994509e7d2de28ebccfa428c04e86defbe15cc
       
    • Por danilo belato
      Fala Galera To Com um problema aki 
       
      quero exporta umas sprites de um server para colocar em outro 
       
      eu clico na sprites ai aparece tds a forma delas do lado de la >>
       
      ai eu clico nela e ponho a opiçao de export mais quando salvo a sprite ela n abri 
       
      aparece isso quando tento vê-la 
       
      visualização não disponível ( no formatos png e bitmap)
       
      Agora no formato idc fala que o paint n pode ler 
       
      me ajudem ae...
    • Por Vitor Bicaleto
      Galera to com o script do addon doll aqui, quando eu digito apenas "!addon" ele aparece assim: Digite novamente, algo está errado!"
      quando digito por exemplo: "!addon citizen" ele não funciona e não da nenhum erro
       
      mesma coisa acontece com o mount doll.. 
    • Por Ayron5
      Substitui uma stone no serve, deu tudo certo fora  esse  erro ajudem  Valendo  Rep+  Grato  

      Erro: data/actions/scripts/boost.lua:557: table index is nil
       [Warning - Event::loadScript] Cannot load script (data/actions/scripts/boost.lua)

      Script:
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo