Ir para conteúdo
  • 0

Ajuda Npc Script


Adriez

Pergunta

galera eu instalei o sistema de recompensa no meu ot só q o npc não tem a parte dos procurados exemplo eu adciono alguem lá pra ser caçado ai num da pra saber quem ta sendo caçado

Spoiler

--[[
            SISTEMA DE CAÇADOR DE RECOMPENSAS FEITO POR LEORIC [OMEGA]
]]--
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 playerReward = getPlayerStorageValue(cid, bountyReward)
    local points = getPlayerStorageValue(cid, bountyPoints) > 0 and getPlayerStorageValue(cid, bountyPoints) or 0
    
    if msgcontains(msg,'assassin guild') then
        selfSay('Sim, eu sou o lider da Guild dos Assassinos. Voce quer dar {hunted} em alguem, ver o seu rank {pontos} ou quer {informacoes} sobre o sistema?',cid)
        talkState[talkUser] = 1
    elseif talkState[talkUser] == 1 then
        if msgcontains(msg,'hunted') then
            selfSay('Yesss, a bounty?! Good for businessss. The death of whom do you wish? Give me a {name}.',cid)
            talkState[talkUser] = 2
        elseif msgcontains(msg,'informacoes') then
            selfSay('It isss very sssimple. You give me a name and money and I\'ll put it at the bounty board. You can check who hasss an active bounty there too. Who kills that person, gets the money. Ssssimple. And, of course, you don\'t get paid to kill a person whose bounty you posted.',cid)
        elseif msgcontains(msg, 'pontos') then
            if bountyConfig.points == false and bountyConfig.omegaPointSystem == false then
                selfSay('Point system is currently disabled.',cid)
            else
                selfSay('You have '..points..' bounty points.',cid)
            end
        elseif msgcontains(msg,'reward') then
            if playerReward > 0 then
                doPlayerAddMoney(cid, playerReward)
                selfSay('Here you go, my bounty hunter friend, '..playerReward..' gps.', cid)
                setPlayerStorageValue(cid, bountyReward, 0)
                talkState[talkUser] = 1
            else
                selfSay('Nope, you have no reward to collect.',cid)
                talkState[talkUser] = 1
            end
        elseif msgcontains(msg, 'most wanted') then
            local players = getTopBounties(10)
            local names = {}
            local str = ''
            if not players then
                selfSay('There are no active bounties at this moment.',cid)
                return true
            end
            for index, pid in ipairs(players) do
                table.insert(names,'{'..index..'} '..getPlayerNameByGUID(pid)..' ['..getPlayerBounty(getPlayerNameByGUID(pid))..']\n')
            end
            str = table.concat(names)
            doPlayerPopupFYI(cid, str)
        end            
    elseif talkState[talkUser] == 2 then
        if not playerExist(msg) then
            selfSay('No, no, no. That is not a valid target. Give me a {name}!',cid)
        elseif string.lower(msg) == string.lower(getCreatureName(cid)) then
            selfSay('You can\'t post a bounty on yourself, stupid!', cid)
        else
            playername = {}
            playername[cid] = msg
            selfSay('Very well. The service has a minimum cost of '..bountyConfig.min..' and we take a '..bountyConfig.fee..'% fee of your bounty. How much do you want to deposit on your bounty?',cid)
            talkState[talkUser] = 3
        end
    elseif talkState[talkUser] == 3 then
        if tonumber(msg) ~= nil and tonumber(msg) and tonumber(msg) >= bountyConfig.min then
            bounty = tonumber(msg)
            if doPlayerRemoveMoney(cid, bounty) then
                doPlayerAddBounty(playername[cid], math.ceil(((1-(bountyConfig.fee/100))*bounty)))
                setGlobalStorageValue(getPlayerGUIDByName(playername[cid])+20000, getPlayerGUIDByName(getCreatureName(cid)))
                selfSay('You have sssuccessfully posted a bounty for '..playername[cid]..'.',cid)
                selfSay('Would you like anything else? Maybe {post} a bounty on someone, check the {most wand} or your {points}? Get your {reward}? Or maybe some {information} about our bounty system?',cid)
                playername[cid] = nil
                talkState[talkUser] = 1
            else
                selfSay('You can\'t fool me, you basssstard! You don\'t pay, I add no bounty!',cid)
                talkState[talkUser] = 1
            end
        else
            selfSay('I\'m still expecting a real bounty, my friend... it has to be bigger than '..bountyConfig.min..'.',cid)
        end
    end            
    return true
end

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

 

Link para o comentário
Compartilhar em outros sites

0 respostass a esta questão

Posts Recomendados

Até agora não há respostas para essa pergunta

×
×
  • Criar Novo...