Ir para conteúdo
Banner com Efeitos

Featured Replies

Postado

.Qual servidor ou website você utiliza como base? 

PokemasterX

Qual o motivo deste tópico?  Duvida sobre algo que não consegui solucionar

 

Está surgindo algum erro? Se sim coloque-o aqui. 

Citar

Olá pessoal, estou tentando implementar um NPC de reset na base MasterX, porém gostaria de saber como fazer para a quantidade de resets aparecer quando um player der look no outro, alguém poderia me explica em qual arquivo pode ser editado essas informações, ficarei grato ^^

 

Você tem o código disponível? Se tiver publique-o aqui: 

--[[Script made 100% by Nogard and Night Wolf.
   You can feel free to edit anything you want, but don't remove the credits]] 


local config = {
minlevel = 500, --- level inical para resetar
price = 5000000, --- preço inicial para resetar
newlevel = 250, --- level após reset
health = 10200,
healthmax = 10200,
priceByReset = 500000, --- preço acrescentado por reset
 ---- porcentagem da vida/mana que você terá ao resetar (em relação à sua antiga vida total)
maxresets = 1000,
levelbyreset = 0 --- quanto de level vai precisar a mais no próximo reset
}
--- end config

function getResets(uid)
resets = getPlayerStorageValue(uid, 378378)
  if resets < 0 then
            resets = 0
          end
return resets
end

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


 function addReset(cid)
    if(npcHandler:isFocused(cid)) then
        npcHandler:releaseFocus(cid)
    end        
    talkState[talkUser] = 0
    resets = getResets(cid)
    setPlayerStorageValue(cid, 378378, resets+1) 
    doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
    doRemoveCreature(cid)        
    local description = resets+1
    db.executeQuery("UPDATE `players` SET `description` = ' [Reset: "..description.."]' WHERE `players`.`id`= ".. playerid .."")
    db.executeQuery("UPDATE `players` SET `level`="..config.newlevel..",`experience`= 0 WHERE `players`.`id`= ".. playerid .."")
    db.executeQuery("UPDATE `players` SET `health`="..config.health..",`experience`= 0 WHERE `players`.`id`= ".. playerid .."")
    db.executeQuery("UPDATE `players` SET `healthmax`="..config.healthmax..",`experience`= 0 WHERE `players`.`id`= ".. playerid .."")
    
    return true
end


local newPrice = config.price + (getResets(cid) * config.priceByReset)
local newminlevel = config.minlevel + (getResets(cid) * config.levelbyreset)
local time = 1
if msgcontains(msg, '!@#$#@!#%%234124312') then
    if getResets(cid) < config.maxresets then
        selfSay('Voce quer fazer o reset do character? Isso te custara '..newPrice..' dl\'s!', cid)
        talkState[talkUser] = 1
    else
        selfSay('Voce chegou ao level maximo de resets!', cid)
    end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
    if getPlayerMoney(cid) < newPrice then
        selfSay('Voce precisa de no minimo '..newPrice..' dl\'s para resetar!', cid)
    elseif getPlayerLevel(cid) < newminlevel then
        selfSay('Voce precisa de level '..newminlevel..'!', cid)
    else
        doPlayerRemoveMoney(cid,newPrice)
        playerid = getPlayerGUID(cid)
        addEvent(function()
            if isPlayer(cid) then
                addReset(cid)
            end
        end, 0)
        local number = getResets(cid)+1
        local msg ="---[Reset: "..number.."]-- Voce foi resetado, a cada 100 resets voce ganhara um Mega Token!"
        doPlayerPopupFYI(cid, msg) 
        talkState[talkUser] = 0
        npcHandler:releaseFocus(cid)
        setPlayerStorageValue(cid, 14858, -1)
        setPlayerStorageValue(cid, 14857, -1)
        setPlayerStorageValue(cid, 66661, -1)
        setPlayerStorageValue(cid, 32167, -1)
        local container = doPlayerAddItem(cid, 9523, 1)
        doAddContainerItem(container, 6497, 2)
        doAddContainerItem(container, 7735, 1)
        doAddContainerItem(container, 6548, 25)
        doAddContainerItem(container, 6547, 15)
        doAddContainerItem(container, 6549, 10)
        doAddContainerItem(container, 2145, 100)
        doAddContainerItem(container, 2145, 100)
        doAddContainerItem(container, 2145, 100)
        doAddContainerItem(container, 2145, 100)
        doAddContainerItem(container, 2145, 100)
        if getPlayerStorageValue(cid, 378378) == 24 then
        doPlayerAddItem(cid, 6556, 1)
    end
      if getPlayerStorageValue(cid, 378378) == 49 then
        doPlayerAddItem(cid, 6556, 1)
    end
      if getPlayerStorageValue(cid, 378378) == 74 then
        doPlayerAddItem(cid, 6556, 1)
    end
      if getPlayerStorageValue(cid, 378378) == 99 then
        doPlayerAddItem(cid, 6556, 1)
    end
      if getPlayerStorageValue(cid, 378378) == 124 then
        doPlayerAddItem(cid, 6556, 1)
    end
      if getPlayerStorageValue(cid, 378378) == 149 then
        doPlayerAddItem(cid, 6556, 1)
    end
      if getPlayerStorageValue(cid, 378378) == 199 then
        doPlayerAddItem(cid, 6556, 1)
    end
      if getPlayerStorageValue(cid, 378378) == 299 then
        doPlayerAddItem(cid, 6556, 1)
    end
      if getPlayerStorageValue(cid, 378378) == 399 then
        doPlayerAddItem(cid, 6556, 1)
    end
      if getPlayerStorageValue(cid, 378378) == 999 then
        doPlayerAddItem(cid, 6556, 1)
    end
    

        end

    
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no')) and isInArray({1}, talkState[talkUser]) == TRUE then
    talkState[talkUser] = 0
    npcHandler:releaseFocus(cid)
    selfSay('Ok.', cid)
elseif msgcontains(msg, 'quantidade') and getPlayerStorageValue(cid, 45821) < os.time() then
    doBroadcastMessage('[RESET RANK] O jogador '..getCreatureName(cid)..' resetou '..getResets(cid)..' vezes!') 
    selfSay('Voce resetou '..getResets(cid)..' vezes!', cid)
     setPlayerStorageValue(cid, 45821, os.time() + time*1*120)
    talkState[talkUser] = 0
    else
    selfSay('Voce precisa esperar '.. getPlayerStorageValue(cid, 45821) - os.time() ..' segundos para consultar novamente.', cid)
end

return true
end

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

 

 

Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui. 

 

  • 5 weeks later...
Postado
  • Autor
Em 13/11/2021 em 23:40, So volto tarde disse:

posta o arquivo look.lua no diretório creaturescripts/scripts

no caso o arquivo look seria esse, dscp a demora

look.lua

  • 3 weeks later...

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.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo