Postado Novembro 13, 2021 3 anos Fala Galera, Boa tarde! No meu servidor quando um player usa mana fluid ela vira um Vial. Eu gostaria de fazer o Vial sumir assim que usado pelo player. esse é o script Citar local drunk = Condition(CONDITION_DRUNK) drunk:setParameter(CONDITION_PARAM_TICKS, 60000) local poison = Condition(CONDITION_POISON) poison:addDamage(1, 4000, -0) poison:addDamage(1, 4000, -10) poison:addDamage(2, 4000, -9) poison:addDamage(2, 4000, -8) poison:addDamage(3, 4000, -7) poison:addDamage(3, 4000, -6) poison:addDamage(4, 4000, -5) poison:addDamage(4, 4000, -4) poison:addDamage(6, 4000, -3) poison:addDamage(10, 4000, -2) poison:addDamage(10, 4000, -1) poison:addDamage(10, 4000, -1) poison:addDamage(10, 4000, -1) poison:addDamage(8, 3950, -1) poison:addDamage(1, 3940, -1) local messages = { [FLUID_WATER] = "Gulp.", [FLUID_WINE] = "Aah...", [FLUID_BEER] = "Aah...", [FLUID_MUD] = "Gulp.", [FLUID_BLOOD] = "Gulp.", [FLUID_SLIME] = "Urgh!", [FLUID_OIL] = "Gulp.", [FLUID_URINE] = "Urgh!", [FLUID_MILK] = "Mmmh.", [FLUID_MANAFLUID] = "Aaaah...", [FLUID_LIFEFLUID] = "Ooooh...", [FLUID_LEMONADE] = "Mmmh." } function onUse(player, item, fromPosition, target, toPosition) local targetItemType = ItemType(target:getId()) if targetItemType and targetItemType:isFluidContainer() then if target:getFluidType() == 0 and item:getFluidType() ~= 0 then target:transform(target:getId(), item:getFluidType()) item:transform(item:getId(), 0) return true elseif item:getFluidType() == 0 and target:getFluidType() ~= 0 then return false elseif target:getFluidType() ~= 0 and item:getFluidType() == 0 then target:transform(target:getId(), 0) item:transform(item:getId(), target:getFluidType()) return true end end if target:isCreature() and target == player then if item:getFluidType() == FLUID_NONE then player:sendCancelMessage("It is empty.") else local self = target == player if self and item:getFluidType() == FLUID_BEER or item:getFluidType() == FLUID_WINE then player:addCondition(drunk) elseif self and item:getFluidType() == FLUID_SLIME then player:addCondition(poison) elseif item:getFluidType() == FLUID_MANAFLUID then target:addMana(math.random(45, 85)) target:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE) elseif item:getFluidType() == FLUID_LIFEFLUID then target:addHealth(math.random(35, 60)) target:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE) end if not self then if item:getFluidType() ~= FLUID_MANAFLUID and item:getFluidType() ~= FLUID_LIFEFLUID then if toPosition.x == CONTAINER_POSITION then toPosition = player:getPosition() end -- Game.createItem(2886, item:getFluidType(), toPosition):decay() return true end end local message = messages[item:getFluidType()] if message then target:say(message, TALKTYPE_SAY) else target:say("Gulp.", TALKTYPE_SAY) end item:transform(item:getId(), FLUID_NONE) end else if toPosition.x == CONTAINER_POSITION then toPosition = player:getPosition() end local tile = Tile(toPosition) if not tile then return false end if item:getFluidType() ~= FLUID_NONE and tile:hasFlag(TILESTATE_IMMOVABLEBLOCKSOLID) then return false end local fluidSource = targetItemType and targetItemType:getFluidSource() or FLUID_NONE if fluidSource ~= FLUID_NONE then item:transform(item:getId(), fluidSource) elseif item:getFluidType() == FLUID_NONE then player:sendTextMessage(MESSAGE_STATUS_SMALL, "It is empty.") else -- Game.createItem(2886, item.type, toPosition):decay() item:transform(item:getId(), FLUID_NONE) end end return true end @Vodkart
Postado Novembro 18, 2021 3 anos Em 13/11/2021 em 16:47, Cricket disse: Fala Galera, Boa tarde! No meu servidor quando um player usa mana fluid ela vira um Vial. Eu gostaria de fazer o Vial sumir assim que usado pelo player. esse é o script @Vodkart Bom dia Amigão, pra não ficar spamando a solução, dá uma olhadinha neste link aqui do nosso fórum, acho que vai ser útil e talvez resolva o teu problema: Usar Pot Sumir vial
Postado Novembro 30, 2021 3 anos Em 23/11/2021 em 04:08, Cricket disse: Outro servidor, outra versão, outra programação. Experimente esse código local drunk = Condition(CONDITION_DRUNK) drunk:setParameter(CONDITION_PARAM_TICKS, 60000) local poison = Condition(CONDITION_POISON) poison:addDamage(1, 4000, -0) poison:addDamage(1, 4000, -10) poison:addDamage(2, 4000, -9) poison:addDamage(2, 4000, -8) poison:addDamage(3, 4000, -7) poison:addDamage(3, 4000, -6) poison:addDamage(4, 4000, -5) poison:addDamage(4, 4000, -4) poison:addDamage(6, 4000, -3) poison:addDamage(10, 4000, -2) poison:addDamage(10, 4000, -1) poison:addDamage(10, 4000, -1) poison:addDamage(10, 4000, -1) poison:addDamage(8, 3950, -1) poison:addDamage(1, 3940, -1) local messages = { [FLUID_WATER] = "Gulp.", [FLUID_WINE] = "Aah...", [FLUID_BEER] = "Aah...", [FLUID_MUD] = "Gulp.", [FLUID_BLOOD] = "Gulp.", [FLUID_SLIME] = "Urgh!", [FLUID_OIL] = "Gulp.", [FLUID_URINE] = "Urgh!", [FLUID_MILK] = "Mmmh.", [FLUID_MANAFLUID] = "Aaaah...", [FLUID_LIFEFLUID] = "Ooooh...", [FLUID_LEMONADE] = "Mmmh." } function onUse(player, item, fromPosition, target, toPosition, isHotkey) local targetItemType = ItemType(target.itemid) if targetItemType and targetItemType:isFluidContainer() then if target.type == 0 and item.type ~= 0 then target:transform(target:getId(), item.type) item:transform(item:getId(), 0) return true elseif target.type ~= 0 and item.type == 0 then target:transform(target:getId(), 0) item:transform(item:getId(), target.type) return true end end if target.itemid == 1 then if item.type == 0 then player:sendTextMessage(MESSAGE_STATUS_SMALL, "It is empty.") elseif target.uid == player.uid then if table.contains({3, 15}, item.type) then player:addCondition(drunk) elseif item.type == 4 then player:addCondition(poison) elseif item.type == 7 then player:addMana(math.random(50, 150)) fromPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE) elseif item.type == 2 then player:addHealth(60) fromPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE) end player:say(fluidMessage[item.type] or "Gulp.", TALKTYPE_MONSTER_SAY) item:transform(item:getId(), 0) else Game.createItem(2016, item.type, toPosition):decay() item:transform(item:getId(), 0) end else local fluidSource = targetItemType and targetItemType:getFluidSource() or 0 if fluidSource ~= 0 then item:transform(item:getId(), fluidSource) elseif item.type == 0 then player:sendTextMessage(MESSAGE_STATUS_SMALL, "It is empty.") else if toPosition.x == CONTAINER_POSITION then toPosition = player:getPosition() end Game.createItem(2016, item.type, toPosition):decay() item:transform(item:getId(), 0) end end return true end Alterei algumas linhas na sua funcion:onUse Testa e me diz se funcionou.
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.