Ir para conteúdo
  • Cadastre-se

(Resolvido)Não se potar dentro do pz


Ir para solução Resolvido por Dwarfer,

Posts Recomendados

Fala galerinha, Eu gostaria de alguma script ou algum que players não possam se potar dentro do Pz. Eu tenho o script que os players não podem usar Potion dentro do pz, Mas alguns players pediu para liberar o uso da potion, Sendo que alguns players logam 3 chars e ficam se potando com isso podendo ser o top Ml. Eu gostaria de algum para não poder se potar dentro do protection zone 

 

 

@Dwarfer

@MatheusDuarte

@Way20

Marquei vcs , Porque vocês são fodas Leks :) Ajude-me PLix... kk 

Link para o post
Compartilhar em outros sites
1 hora atrás, MatheusDuarte disse:

Poste o seu potions.lua
 


 

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

local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)

shopModule:addBuyableItem({'small health'}, 8704, 20, 1, 'small health potion')
shopModule:addBuyableItem({'health potion'}, 7618, 45, 1, 'health potion')
shopModule:addBuyableItem({'mana potion'}, 7620, 50, 1, 'mana potion')
shopModule:addBuyableItem({'strong health'}, 7588, 100, 1, 'strong health potion')
shopModule:addBuyableItem({'strong mana'}, 7589, 80, 1, 'strong mana potion')
shopModule:addBuyableItem({'great health'}, 7591, 190, 1, 'great health potion')
shopModule:addBuyableItem({'great mana'}, 7590, 120, 1, 'great mana potion')
shopModule:addBuyableItem({'great spirit'}, 8472, 190, 1, 'great spirit potion')
shopModule:addBuyableItem({'ultimate health'}, 8473, 310, 1, 'ultimate health potion')
shopModule:addBuyableItem({'antidote potion'}, 8474, 50, 1, 'antidote potion')

shopModule:addSellableItem({'normal potion flask', 'normal flask'}, 7636, 5, 'empty small potion flask')
shopModule:addSellableItem({'strong potion flask', 'strong flask'}, 7634, 10, 'empty strong potion flask')
shopModule:addSellableItem({'great potion flask', 'great flask'}, 7635, 15, 'empty great potion flask')

shopModule:addBuyableItemContainer({'bp slhp'}, 2000, 8704, 400, 1, 'backpack of small health potions')
shopModule:addBuyableItemContainer({'bp hp'}, 2000, 7618, 900, 1, 'backpack of health potions')
shopModule:addBuyableItemContainer({'bp mp'}, 2001, 7620, 1000, 1, 'backpack of mana potions')
shopModule:addBuyableItemContainer({'bp shp'}, 2000, 7588, 2000, 1, 'backpack of strong health potions')
shopModule:addBuyableItemContainer({'bp smp'}, 2001, 7589, 1600, 1, 'backpack of strong mana potions')
shopModule:addBuyableItemContainer({'bp ghp'}, 2000, 7591, 3800, 1, 'backpack of great health potions')
shopModule:addBuyableItemContainer({'bp gmp'}, 2001, 7590, 2400, 1, 'backpack of great mana potions')
shopModule:addBuyableItemContainer({'bp gsp'}, 1999, 8472, 3800, 1, 'backpack of great spirit potions')
shopModule:addBuyableItemContainer({'bp uhp'}, 2000, 8473, 6200, 1, 'backpack of ultimate health potions')
shopModule:addBuyableItemContainer({'bp ap'}, 2002, 8474, 2000, 1, 'backpack of antidote potions')

local items = {[1] = 2190, [2] = 2182, [5] = 2190, [6] = 2182}
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, 'first rod') or msgcontains(msg, 'first wand')) then
		if(isSorcerer(cid) or isDruid(cid)) then
			if(getPlayerStorageValue(cid, 30002) <= 0) then
				selfSay('So you ask me for a {' .. getItemNameById(items[getPlayerVocation(cid)]) .. '} to begin your advanture?', cid)
				talkState[talkUser] = 1
			else
				selfSay('What? I have already gave you one {' .. getItemNameById(items[getPlayerVocation(cid)]) .. '}!', cid)
			end
		else
			selfSay('Sorry, you aren\'t a druid either a sorcerer.', cid)
		end
	elseif(msgcontains(msg, 'yes')) then
		if(talkState[talkUser] == 1) then
			doPlayerAddItem(cid, items[getPlayerVocation(cid)], 1)
			selfSay('Here you are young adept, take care yourself.', cid)
			setPlayerStorageValue(cid, 30002, 1)
		end
		talkState[talkUser] = 0
	elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser])) then
		selfSay('Ok then.', cid)
		talkState[talkUser] = 0
	end

	return true
end

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

 

Editado por helix758 (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
1 minuto atrás, Dwarfer disse:

Esse não é o seu arquivo potions.lua. Isso aí é um npc que vende potion. Procure em actions.

LOL É MESMO KKKKKKKKKKKKKKKKK FOI MAL KKKKKKKKKKKKKKKKKK EITA VIAGEM 

 

correto \/

local config = {
 removeOnUse = "no",
 usableOnTarget = "yes", -- can be used on target? (fe. healing friend)
 splashable = "no",
 realAnimation = "yes",  -- make text effect visible only for players in range 1x1
 healthMultiplier = 1.0,
 manaMultiplier = 1.0
}

config.removeOnUse = getBooleanFromString(config.removeOnUse)
config.usableOnTarget = getBooleanFromString(config.usableOnTarget)
config.splashable = getBooleanFromString(config.splashable)
config.realAnimation = getBooleanFromString(config.realAnimation)

local POTIONS = {
 [8704] = {empty = 8704, splash = 2, health = {40, 60}}, -- small health potion
 [7618] = {empty = 7618, splash = 2, health = {40, 55}}, -- health potion
 [7588] = {empty = 7588, splash = 2, health = {55, 65}, level = 13, vocations = {3, 4, 7, 8, 11, 12}, vocStr = "knights and paladins"}, -- strong health potion
 [7591] = {empty = 7591, splash = 2, health = {65, 75}, level = 1, vocations = {4, 7, 8}, vocStr = "knights"}, -- great health potion
 [8473] = {empty = 7635, splash = 2, health = {800, 1000}, level = 130, vocations = {4, 8}, vocStr = "knights"}, -- ultimate health potion

 [7620] = {empty = 7620, splash = 7, mana = {35, 45}}, -- mana potion
 [7589] = {empty = 7589, splash = 7, mana = {45, 55}, level = 13, vocations = {1, 2, 3, 5, 6, 7}, vocStr = "sorcerers, druids and paladins"}, -- strong mana potion
 [7590] = {empty = 7590, splash = 7, mana = {60, 72}, level = 1, vocations = {1, 2, 5, 6}, vocStr = "sorcerers and druids"}, -- great mana potion

 [8472] = {empty = 8472, splash = 3, health = {40, 55}, mana = {55, 68}, level = 1, vocations = {3, 7}, vocStr = "paladins"} -- great spirit potion
}

local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
 local potion = POTIONS[item.itemid]
 if(not potion) then
  return false
 end
 
 if(not isPlayer(itemEx.uid) or (not config.usableOnTarget and cid ~= itemEx.uid)) then
  if(not config.splashable) then
   return false
  end

  if(toPosition.x == CONTAINER_POSITION) then
   toPosition = getThingPos(item.uid)
  end

  doDecayItem(doCreateItem(2016, potion.splash, toPosition))
  doTransformItem(item.uid, potion.empty)
  return true
 end

 if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then
  doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
  return true
 end

 if(((potion.level and getPlayerLevel(cid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(cid)))) and
  not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES))
 then
  doCreatureSay(itemEx.uid, "Only " .. potion.vocStr .. (potion.level and (" of level " .. potion.level) or "") .. " or above may drink this fluid.", TALKTYPE_ORANGE_1)
  return true
 end

 local health = potion.health
 if(health and not doCreatureAddHealth(itemEx.uid, math.ceil(math.random(health[1], health[2]) * config.healthMultiplier))) then
  return false
 end

 local mana = potion.mana
 if(mana and not doPlayerAddMana(itemEx.uid, math.ceil(math.random(mana[1], mana[2]) * config.manaMultiplier))) then
  return false
 end

 doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
 if(not realAnimation) then
  doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
 else
  for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
   if(isPlayer(tid)) then
    doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1, false, tid)
   end
  end
 end

 doAddCondition(cid, exhaust)
 if(not potion.empty or config.removeOnUse) then
  doRemoveItem(item.uid)
  return true
 end

 doTransformItem(item.uid, potion.empty)
 return true
end

 

Link para o post
Compartilhar em outros sites
Spoiler

local config = {
 removeOnUse = "no",
 usableOnTarget = "yes", -- can be used on target? (fe. healing friend)
 splashable = "no",
 realAnimation = "yes",  -- make text effect visible only for players in range 1x1
 healthMultiplier = 1.0,
 manaMultiplier = 1.0
}

config.removeOnUse = getBooleanFromString(config.removeOnUse)
config.usableOnTarget = getBooleanFromString(config.usableOnTarget)
config.splashable = getBooleanFromString(config.splashable)
config.realAnimation = getBooleanFromString(config.realAnimation)

local POTIONS = {
 [8704] = {empty = 8704, splash = 2, health = {40, 60}}, -- small health potion
 [7618] = {empty = 7618, splash = 2, health = {40, 55}}, -- health potion
 [7588] = {empty = 7588, splash = 2, health = {55, 65}, level = 13, vocations = {3, 4, 7, 8, 11, 12}, vocStr = "knights and paladins"}, -- strong health potion
 [7591] = {empty = 7591, splash = 2, health = {65, 75}, level = 1, vocations = {4, 7, 8}, vocStr = "knights"}, -- great health potion
 [8473] = {empty = 7635, splash = 2, health = {800, 1000}, level = 130, vocations = {4, 8}, vocStr = "knights"}, -- ultimate health potion

 [7620] = {empty = 7620, splash = 7, mana = {35, 45}}, -- mana potion
 [7589] = {empty = 7589, splash = 7, mana = {45, 55}, level = 13, vocations = {1, 2, 3, 5, 6, 7}, vocStr = "sorcerers, druids and paladins"}, -- strong mana potion
 [7590] = {empty = 7590, splash = 7, mana = {60, 72}, level = 1, vocations = {1, 2, 5, 6}, vocStr = "sorcerers and druids"}, -- great mana potion

 [8472] = {empty = 8472, splash = 3, health = {40, 55}, mana = {55, 68}, level = 1, vocations = {3, 7}, vocStr = "paladins"} -- great spirit potion
}

local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
 local potion = POTIONS[item.itemid]
 if(not potion) then
  return false
 end
 
    if getTilePzInfo(getPlayerPosition(cid)) then
        return doPlayerSendDefaultCancel(cid, RETURNVALUE_ACTIONNOTPERMITTEDINPROTECTIONZONE)
    end
    
 if(not isPlayer(itemEx.uid) or (not config.usableOnTarget and cid ~= itemEx.uid)) then
  if(not config.splashable) then
   return false
  end

  if(toPosition.x == CONTAINER_POSITION) then
   toPosition = getThingPos(item.uid)
  end

  doDecayItem(doCreateItem(2016, potion.splash, toPosition))
  doTransformItem(item.uid, potion.empty)
  return true
 end

 if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then
  doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
  return true
 end

 if(((potion.level and getPlayerLevel(cid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(cid)))) and
  not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES))
 then
  doCreatureSay(itemEx.uid, "Only " .. potion.vocStr .. (potion.level and (" of level " .. potion.level) or "") .. " or above may drink this fluid.", TALKTYPE_ORANGE_1)
  return true
 end

 local health = potion.health
 if(health and not doCreatureAddHealth(itemEx.uid, math.ceil(math.random(health[1], health[2]) * config.healthMultiplier))) then
  return false
 end

 local mana = potion.mana
 if(mana and not doPlayerAddMana(itemEx.uid, math.ceil(math.random(mana[1], mana[2]) * config.manaMultiplier))) then
  return false
 end

 doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
 if(not realAnimation) then
  doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
 else
  for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
   if(isPlayer(tid)) then
    doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1, false, tid)
   end
  end
 end

 doAddCondition(cid, exhaust)
 if(not potion.empty or config.removeOnUse) then
  doRemoveItem(item.uid)
  return true
 end

 doTransformItem(item.uid, potion.empty)
 return true
end

 

 

Contato:

 

Link para o post
Compartilhar em outros sites
11 minutos atrás, Dwarfer disse:
  Mostrar conteúdo oculto


local config = {
 removeOnUse = "no",
 usableOnTarget = "yes", -- can be used on target? (fe. healing friend)
 splashable = "no",
 realAnimation = "yes",  -- make text effect visible only for players in range 1x1
 healthMultiplier = 1.0,
 manaMultiplier = 1.0
}

config.removeOnUse = getBooleanFromString(config.removeOnUse)
config.usableOnTarget = getBooleanFromString(config.usableOnTarget)
config.splashable = getBooleanFromString(config.splashable)
config.realAnimation = getBooleanFromString(config.realAnimation)

local POTIONS = {
 [8704] = {empty = 8704, splash = 2, health = {40, 60}}, -- small health potion
 [7618] = {empty = 7618, splash = 2, health = {40, 55}}, -- health potion
 [7588] = {empty = 7588, splash = 2, health = {55, 65}, level = 13, vocations = {3, 4, 7, 8, 11, 12}, vocStr = "knights and paladins"}, -- strong health potion
 [7591] = {empty = 7591, splash = 2, health = {65, 75}, level = 1, vocations = {4, 7, 8}, vocStr = "knights"}, -- great health potion
 [8473] = {empty = 7635, splash = 2, health = {800, 1000}, level = 130, vocations = {4, 8}, vocStr = "knights"}, -- ultimate health potion

 [7620] = {empty = 7620, splash = 7, mana = {35, 45}}, -- mana potion
 [7589] = {empty = 7589, splash = 7, mana = {45, 55}, level = 13, vocations = {1, 2, 3, 5, 6, 7}, vocStr = "sorcerers, druids and paladins"}, -- strong mana potion
 [7590] = {empty = 7590, splash = 7, mana = {60, 72}, level = 1, vocations = {1, 2, 5, 6}, vocStr = "sorcerers and druids"}, -- great mana potion

 [8472] = {empty = 8472, splash = 3, health = {40, 55}, mana = {55, 68}, level = 1, vocations = {3, 7}, vocStr = "paladins"} -- great spirit potion
}

local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
 local potion = POTIONS[item.itemid]
 if(not potion) then
  return false
 end
 
    if getTilePzInfo(getPlayerPosition(cid)) then
        return doPlayerSendDefaultCancel(cid, RETURNVALUE_ACTIONNOTPERMITTEDINPROTECTIONZONE)
    end
    
 if(not isPlayer(itemEx.uid) or (not config.usableOnTarget and cid ~= itemEx.uid)) then
  if(not config.splashable) then
   return false
  end

  if(toPosition.x == CONTAINER_POSITION) then
   toPosition = getThingPos(item.uid)
  end

  doDecayItem(doCreateItem(2016, potion.splash, toPosition))
  doTransformItem(item.uid, potion.empty)
  return true
 end

 if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then
  doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
  return true
 end

 if(((potion.level and getPlayerLevel(cid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(cid)))) and
  not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES))
 then
  doCreatureSay(itemEx.uid, "Only " .. potion.vocStr .. (potion.level and (" of level " .. potion.level) or "") .. " or above may drink this fluid.", TALKTYPE_ORANGE_1)
  return true
 end

 local health = potion.health
 if(health and not doCreatureAddHealth(itemEx.uid, math.ceil(math.random(health[1], health[2]) * config.healthMultiplier))) then
  return false
 end

 local mana = potion.mana
 if(mana and not doPlayerAddMana(itemEx.uid, math.ceil(math.random(mana[1], mana[2]) * config.manaMultiplier))) then
  return false
 end

 doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
 if(not realAnimation) then
  doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
 else
  for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
   if(isPlayer(tid)) then
    doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1, false, tid)
   end
  end
 end

 doAddCondition(cid, exhaust)
 if(not potion.empty or config.removeOnUse) then
  doRemoveItem(item.uid)
  return true
 end

 doTransformItem(item.uid, potion.empty)
 return true
end

 

 

Essa script eu ja tinha, Eu gostaria de tipo... Eu Usar a potion dentro do pz, Mas segundo player não usar uma potion em mim... /// Ou seja Eu posso me potar mas ningeum pode me potar (Somente dentro do pz fora do pz podem usar em mim normal) entendeu?

Link para o post
Compartilhar em outros sites

...

 

Spoiler

local config = {
 removeOnUse = "no",
 usableOnTarget = "yes", -- can be used on target? (fe. healing friend)
 splashable = "no",
 realAnimation = "yes",  -- make text effect visible only for players in range 1x1
 healthMultiplier = 1.0,
 manaMultiplier = 1.0
}

config.removeOnUse = getBooleanFromString(config.removeOnUse)
config.usableOnTarget = getBooleanFromString(config.usableOnTarget)
config.splashable = getBooleanFromString(config.splashable)
config.realAnimation = getBooleanFromString(config.realAnimation)

local POTIONS = {
 [8704] = {empty = 8704, splash = 2, health = {40, 60}}, -- small health potion
 [7618] = {empty = 7618, splash = 2, health = {40, 55}}, -- health potion
 [7588] = {empty = 7588, splash = 2, health = {55, 65}, level = 13, vocations = {3, 4, 7, 8, 11, 12}, vocStr = "knights and paladins"}, -- strong health potion
 [7591] = {empty = 7591, splash = 2, health = {65, 75}, level = 1, vocations = {4, 7, 8}, vocStr = "knights"}, -- great health potion
 [8473] = {empty = 7635, splash = 2, health = {800, 1000}, level = 130, vocations = {4, 8}, vocStr = "knights"}, -- ultimate health potion

 [7620] = {empty = 7620, splash = 7, mana = {35, 45}}, -- mana potion
 [7589] = {empty = 7589, splash = 7, mana = {45, 55}, level = 13, vocations = {1, 2, 3, 5, 6, 7}, vocStr = "sorcerers, druids and paladins"}, -- strong mana potion
 [7590] = {empty = 7590, splash = 7, mana = {60, 72}, level = 1, vocations = {1, 2, 5, 6}, vocStr = "sorcerers and druids"}, -- great mana potion

 [8472] = {empty = 8472, splash = 3, health = {40, 55}, mana = {55, 68}, level = 1, vocations = {3, 7}, vocStr = "paladins"} -- great spirit potion
}

local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
 local potion = POTIONS[item.itemid]
 if(not potion) then
  return false
 end
 
if getTilePzInfo(getThingPos(itemEx.uid)) then
return doPlayerSendDefaultCancel(cid, RETURNVALUE_ACTIONNOTPERMITTEDINPROTECTIONZONE)
end
    
 if(not isPlayer(itemEx.uid) or (not config.usableOnTarget and cid ~= itemEx.uid)) then
  if(not config.splashable) then
   return false
  end

  if(toPosition.x == CONTAINER_POSITION) then
   toPosition = getThingPos(item.uid)
  end

  doDecayItem(doCreateItem(2016, potion.splash, toPosition))
  doTransformItem(item.uid, potion.empty)
  return true
 end

 if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then
  doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
  return true
 end

 if(((potion.level and getPlayerLevel(cid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(cid)))) and
  not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES))
 then
  doCreatureSay(itemEx.uid, "Only " .. potion.vocStr .. (potion.level and (" of level " .. potion.level) or "") .. " or above may drink this fluid.", TALKTYPE_ORANGE_1)
  return true
 end

 local health = potion.health
 if(health and not doCreatureAddHealth(itemEx.uid, math.ceil(math.random(health[1], health[2]) * config.healthMultiplier))) then
  return false
 end

 local mana = potion.mana
 if(mana and not doPlayerAddMana(itemEx.uid, math.ceil(math.random(mana[1], mana[2]) * config.manaMultiplier))) then
  return false
 end

 doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
 if(not realAnimation) then
  doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
 else
  for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
   if(isPlayer(tid)) then
    doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1, false, tid)
   end
  end
 end

 doAddCondition(cid, exhaust)
 if(not potion.empty or config.removeOnUse) then
  doRemoveItem(item.uid)
  return true
 end

 doTransformItem(item.uid, potion.empty)
 return true
end

 

 

Contato:

 

Link para o post
Compartilhar em outros sites
22 minutos atrás, Dwarfer disse:

...

 

  Ocultar conteúdo


local config = {
 removeOnUse = "no",
 usableOnTarget = "yes", -- can be used on target? (fe. healing friend)
 splashable = "no",
 realAnimation = "yes",  -- make text effect visible only for players in range 1x1
 healthMultiplier = 1.0,
 manaMultiplier = 1.0
}

config.removeOnUse = getBooleanFromString(config.removeOnUse)
config.usableOnTarget = getBooleanFromString(config.usableOnTarget)
config.splashable = getBooleanFromString(config.splashable)
config.realAnimation = getBooleanFromString(config.realAnimation)

local POTIONS = {
 [8704] = {empty = 8704, splash = 2, health = {40, 60}}, -- small health potion
 [7618] = {empty = 7618, splash = 2, health = {40, 55}}, -- health potion
 [7588] = {empty = 7588, splash = 2, health = {55, 65}, level = 13, vocations = {3, 4, 7, 8, 11, 12}, vocStr = "knights and paladins"}, -- strong health potion
 [7591] = {empty = 7591, splash = 2, health = {65, 75}, level = 1, vocations = {4, 7, 8}, vocStr = "knights"}, -- great health potion
 [8473] = {empty = 7635, splash = 2, health = {800, 1000}, level = 130, vocations = {4, 8}, vocStr = "knights"}, -- ultimate health potion

 [7620] = {empty = 7620, splash = 7, mana = {35, 45}}, -- mana potion
 [7589] = {empty = 7589, splash = 7, mana = {45, 55}, level = 13, vocations = {1, 2, 3, 5, 6, 7}, vocStr = "sorcerers, druids and paladins"}, -- strong mana potion
 [7590] = {empty = 7590, splash = 7, mana = {60, 72}, level = 1, vocations = {1, 2, 5, 6}, vocStr = "sorcerers and druids"}, -- great mana potion

 [8472] = {empty = 8472, splash = 3, health = {40, 55}, mana = {55, 68}, level = 1, vocations = {3, 7}, vocStr = "paladins"} -- great spirit potion
}

local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
 local potion = POTIONS[item.itemid]
 if(not potion) then
  return false
 end
 
if getTilePzInfo(getThingPos(itemEx.uid)) then
return doPlayerSendDefaultCancel(cid, RETURNVALUE_ACTIONNOTPERMITTEDINPROTECTIONZONE)
end
    
 if(not isPlayer(itemEx.uid) or (not config.usableOnTarget and cid ~= itemEx.uid)) then
  if(not config.splashable) then
   return false
  end

  if(toPosition.x == CONTAINER_POSITION) then
   toPosition = getThingPos(item.uid)
  end

  doDecayItem(doCreateItem(2016, potion.splash, toPosition))
  doTransformItem(item.uid, potion.empty)
  return true
 end

 if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then
  doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
  return true
 end

 if(((potion.level and getPlayerLevel(cid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(cid)))) and
  not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES))
 then
  doCreatureSay(itemEx.uid, "Only " .. potion.vocStr .. (potion.level and (" of level " .. potion.level) or "") .. " or above may drink this fluid.", TALKTYPE_ORANGE_1)
  return true
 end

 local health = potion.health
 if(health and not doCreatureAddHealth(itemEx.uid, math.ceil(math.random(health[1], health[2]) * config.healthMultiplier))) then
  return false
 end

 local mana = potion.mana
 if(mana and not doPlayerAddMana(itemEx.uid, math.ceil(math.random(mana[1], mana[2]) * config.manaMultiplier))) then
  return false
 end

 doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
 if(not realAnimation) then
  doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
 else
  for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
   if(isPlayer(tid)) then
    doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1, false, tid)
   end
  end
 end

 doAddCondition(cid, exhaust)
 if(not potion.empty or config.removeOnUse) then
  doRemoveItem(item.uid)
  return true
 end

 doTransformItem(item.uid, potion.empty)
 return true
end

 

 

Não funcionou! quero que ue possa usar potion, mas teceiro não possa usar-las em mim sacou ? 

Eu posso usar potion em mim mesmo, mas segundo não pode usar-las em mim (somente dentro do pz)

Link para o post
Compartilhar em outros sites
  • Solução

Agora entendi.

 

Spoiler

local config = {
 removeOnUse = "no",
 usableOnTarget = "yes", -- can be used on target? (fe. healing friend)
 splashable = "no",
 realAnimation = "yes",  -- make text effect visible only for players in range 1x1
 healthMultiplier = 1.0,
 manaMultiplier = 1.0
}

config.removeOnUse = getBooleanFromString(config.removeOnUse)
config.usableOnTarget = getBooleanFromString(config.usableOnTarget)
config.splashable = getBooleanFromString(config.splashable)
config.realAnimation = getBooleanFromString(config.realAnimation)

local POTIONS = {
 [8704] = {empty = 8704, splash = 2, health = {40, 60}}, -- small health potion
 [7618] = {empty = 7618, splash = 2, health = {40, 55}}, -- health potion
 [7588] = {empty = 7588, splash = 2, health = {55, 65}, level = 13, vocations = {3, 4, 7, 8, 11, 12}, vocStr = "knights and paladins"}, -- strong health potion
 [7591] = {empty = 7591, splash = 2, health = {65, 75}, level = 1, vocations = {4, 7, 8}, vocStr = "knights"}, -- great health potion
 [8473] = {empty = 7635, splash = 2, health = {800, 1000}, level = 130, vocations = {4, 8}, vocStr = "knights"}, -- ultimate health potion

 [7620] = {empty = 7620, splash = 7, mana = {35, 45}}, -- mana potion
 [7589] = {empty = 7589, splash = 7, mana = {45, 55}, level = 13, vocations = {1, 2, 3, 5, 6, 7}, vocStr = "sorcerers, druids and paladins"}, -- strong mana potion
 [7590] = {empty = 7590, splash = 7, mana = {60, 72}, level = 1, vocations = {1, 2, 5, 6}, vocStr = "sorcerers and druids"}, -- great mana potion

 [8472] = {empty = 8472, splash = 3, health = {40, 55}, mana = {55, 68}, level = 1, vocations = {3, 7}, vocStr = "paladins"} -- great spirit potion
}

local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
 local potion = POTIONS[item.itemid]
 if(not potion) then
  return false
 end
 
 if itemEx.uid ~= cid and getTilePzInfo(getThingPos(itemEx.uid)) then
        return doPlayerSendDefaultCancel(cid, RETURNVALUE_ACTIONNOTPERMITTEDINPROTECTIONZONE)
    end
    
 if(not isPlayer(itemEx.uid) or (not config.usableOnTarget and cid ~= itemEx.uid)) then
  if(not config.splashable) then
   return false
  end

  if(toPosition.x == CONTAINER_POSITION) then
   toPosition = getThingPos(item.uid)
  end

  doDecayItem(doCreateItem(2016, potion.splash, toPosition))
  doTransformItem(item.uid, potion.empty)
  return true
 end

 if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then
  doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
  return true
 end

 if(((potion.level and getPlayerLevel(cid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(cid)))) and
  not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES))
 then
  doCreatureSay(itemEx.uid, "Only " .. potion.vocStr .. (potion.level and (" of level " .. potion.level) or "") .. " or above may drink this fluid.", TALKTYPE_ORANGE_1)
  return true
 end

 local health = potion.health
 if(health and not doCreatureAddHealth(itemEx.uid, math.ceil(math.random(health[1], health[2]) * config.healthMultiplier))) then
  return false
 end

 local mana = potion.mana
 if(mana and not doPlayerAddMana(itemEx.uid, math.ceil(math.random(mana[1], mana[2]) * config.manaMultiplier))) then
  return false
 end

 doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
 if(not realAnimation) then
  doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
 else
  for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
   if(isPlayer(tid)) then
    doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1, false, tid)
   end
  end
 end

 doAddCondition(cid, exhaust)
 if(not potion.empty or config.removeOnUse) then
  doRemoveItem(item.uid)
  return true
 end

 doTransformItem(item.uid, potion.empty)
 return true
end

 

 

Contato:

 

Link para o post
Compartilhar em outros sites
9 minutos atrás, Dwarfer disse:

Agora entendi.

 

  Ocultar conteúdo


local config = {
 removeOnUse = "no",
 usableOnTarget = "yes", -- can be used on target? (fe. healing friend)
 splashable = "no",
 realAnimation = "yes",  -- make text effect visible only for players in range 1x1
 healthMultiplier = 1.0,
 manaMultiplier = 1.0
}

config.removeOnUse = getBooleanFromString(config.removeOnUse)
config.usableOnTarget = getBooleanFromString(config.usableOnTarget)
config.splashable = getBooleanFromString(config.splashable)
config.realAnimation = getBooleanFromString(config.realAnimation)

local POTIONS = {
 [8704] = {empty = 8704, splash = 2, health = {40, 60}}, -- small health potion
 [7618] = {empty = 7618, splash = 2, health = {40, 55}}, -- health potion
 [7588] = {empty = 7588, splash = 2, health = {55, 65}, level = 13, vocations = {3, 4, 7, 8, 11, 12}, vocStr = "knights and paladins"}, -- strong health potion
 [7591] = {empty = 7591, splash = 2, health = {65, 75}, level = 1, vocations = {4, 7, 8}, vocStr = "knights"}, -- great health potion
 [8473] = {empty = 7635, splash = 2, health = {800, 1000}, level = 130, vocations = {4, 8}, vocStr = "knights"}, -- ultimate health potion

 [7620] = {empty = 7620, splash = 7, mana = {35, 45}}, -- mana potion
 [7589] = {empty = 7589, splash = 7, mana = {45, 55}, level = 13, vocations = {1, 2, 3, 5, 6, 7}, vocStr = "sorcerers, druids and paladins"}, -- strong mana potion
 [7590] = {empty = 7590, splash = 7, mana = {60, 72}, level = 1, vocations = {1, 2, 5, 6}, vocStr = "sorcerers and druids"}, -- great mana potion

 [8472] = {empty = 8472, splash = 3, health = {40, 55}, mana = {55, 68}, level = 1, vocations = {3, 7}, vocStr = "paladins"} -- great spirit potion
}

local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
 local potion = POTIONS[item.itemid]
 if(not potion) then
  return false
 end
 
 if itemEx.uid ~= cid and getTilePzInfo(getThingPos(itemEx.uid)) then
        return doPlayerSendDefaultCancel(cid, RETURNVALUE_ACTIONNOTPERMITTEDINPROTECTIONZONE)
    end
    
 if(not isPlayer(itemEx.uid) or (not config.usableOnTarget and cid ~= itemEx.uid)) then
  if(not config.splashable) then
   return false
  end

  if(toPosition.x == CONTAINER_POSITION) then
   toPosition = getThingPos(item.uid)
  end

  doDecayItem(doCreateItem(2016, potion.splash, toPosition))
  doTransformItem(item.uid, potion.empty)
  return true
 end

 if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then
  doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
  return true
 end

 if(((potion.level and getPlayerLevel(cid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(cid)))) and
  not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES))
 then
  doCreatureSay(itemEx.uid, "Only " .. potion.vocStr .. (potion.level and (" of level " .. potion.level) or "") .. " or above may drink this fluid.", TALKTYPE_ORANGE_1)
  return true
 end

 local health = potion.health
 if(health and not doCreatureAddHealth(itemEx.uid, math.ceil(math.random(health[1], health[2]) * config.healthMultiplier))) then
  return false
 end

 local mana = potion.mana
 if(mana and not doPlayerAddMana(itemEx.uid, math.ceil(math.random(mana[1], mana[2]) * config.manaMultiplier))) then
  return false
 end

 doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
 if(not realAnimation) then
  doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
 else
  for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
   if(isPlayer(tid)) then
    doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1, false, tid)
   end
  end
 end

 doAddCondition(cid, exhaust)
 if(not potion.empty or config.removeOnUse) then
  doRemoveItem(item.uid)
  return true
 end

 doTransformItem(item.uid, potion.empty)
 return true
end

 

 

Boa!! era isso que eu queria!!!. Poderia me informar o que foi alterado aí? Por gentileza? HAHAH grato

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.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo