Baah 6 #1 Posted December 2, 2019 Criei esse código há algum tempo e talvez seja útil para alguém. Com esse código, que deve ser instalado em creaturescripts, o jogador que morrer e tiver os items especificados na backpack receberá todas as blessings ANTES de morrer. Esse script funciona com TFS 1.x, e pode ser compatível com OTBR Global com alguns ajustes. config = { id = 2195, -- id do item bless = 5, -- quantidade de blessings do servidor remover = true, -- remover item? true/false minLvl = 100 -- level minimo } -- lBaah function hasAllBlessings(player) --Verifica se o player tem todas blessings local cont = 0 for i=1,config.bless do if player:hasBlessing(i) then cont = cont+1 end end if cont >= config.bless then -- se nao tiver alguma bless prossegue com o sitema return true else return false end end function onPrepareDeath(creature, killer) if not creature:isPlayer() then return true end if hasAllBlessings(creature) then -- lBaah creature:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You are already protected by blessings.") return true end if creature:getLevel() >= config.minLvl then if creature:getItemCount(config.id) >= 1 then for i = 1, config.bless do creature:addBlessing(i) end if config.remover then creature:removeItem(config.id, 1) creature:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You were protected by a blessing charm.") end creature:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You have been blessed by the charm before dying.") else creature:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You were not wearing a blessing charm and was not blessed when died.") end else creature:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You need level " .. config.minLvl .. " or higher to be automatic blessed.") end return true end 2 Majesty and HeberPcL reacted to this Share this post Link to post
Majesty 1,756 #2 Posted December 3, 2019 Muito obrigado pela sua contribuição, seu tópico de conteúdo foi aprovado!Nós do OTServ Brasil agradecemos, seu conteúdo com certeza ajudará a muitos outros. Você recebeu +1 REP! Share this post Link to post