Ir para conteúdo

[Encerrado] COMO POR PRA POKEBAR NÃO REMOVER A ADDON DO POKEMON


GniusP

Posts Recomendados

Olá pessoal, quando eu uso um pokemon pela pokebar, ela remove a addon do pokemon

Script

function createBallByStatus(cid, status, id)
slot = getPlayerSlotItem(cid, 8)
if slot.uid == 0 then
item = doPlayerAddItem(cid, id) 
else
item = addItemInFreeBag(getPlayerSlotItem(cid, 3).uid, id, 1)
end
setStatusPokeballByStatusStr(item, status)
end
 
 
function getPokemonByName(cid, pokemon)
local arraypoke = {}
local container = getPlayerSlotItem(cid, 3).uid
local pokeballs = getPokeballsInContainer(container) 
for i =1, #pokeballs do
name = getItemAttribute(pokeballs[i], "poke") 
if pokemon == name then
table.insert(arraypoke, pokeballs[i])
return arraypoke[1]
end
end
return false
end
 
function tranfBallInShiny(pokeball)
doItemSetAttribute(pokeball, "shiny", "shiny")
return true
end
 
function getShinyByPokeball(pokeball)
local shiny = getItemAttribute(pokeball, "shiny") 
return shiny == "shiny" and true or false
end
 
 
function getShinyNameByPokeball(pokeball)
local shiny = getItemAttribute(pokeball, "shiny") 
return shiny and "Shiny "..getItemAttribute(pokeball, "poke").."" or getItemAttribute(pokeball, "poke")
end
 
 
function setStatusPokeballByStatusStr(pokeball, status)
local attr = string.explode(status, ",")
local x = {"poke", "hp", "offense", "defense", "speed", "vitality", "specialattack", "happy", "gender", "hands", "description", "fakedesc", "boost", "ball", "defeated", "shiny", "level"}
for i =1, #attr do
doItemSetAttribute(pokeball, x[i], attr[i])
end
end
 
 
function copieAllStatusBalls(pokeball)
local x = {"poke", "hp", "offense", "defense", "speed", "vitality", "specialattack", "happy", "gender", "hands", "description", "fakedesc", "boost", "ball", "defeated", "shiny", "level"}
str = ""
sep = ","
for i =1, #x do
local attr = getItemAttribute(pokeball, x[i]) or 0
local t = attr ..sep
str = str..t
end
 
return str 
end
 
 
 
function atualizaPokes(cid)
local item = getPlayerSlotItem(cid, 8)
if item.uid <= 0 then return true end
if not getItemAttribute(item.uid, "poke") then
return true
end    
for i, x in pairs(fotos) do
if string.lower(getItemAttribute(item.uid, "poke")) == string.lower(i) then
doTransformItem(getPlayerSlotItem(cid, 7).uid, fotos[i])
if useOTClient then
doPlayerSendCancel(cid, '12//,show')
end
if useKpdoDlls then
useOTClient = true
useKpdoDlls = true
doUpdateMoves(cid)
end
 
end
end
end
 
 
 
function doSendPokemon(cid, pokemon)
 
 
if getPlayerStorageValue(cid, 17000) >= 1 or getPlayerStorageValue(cid, 17001) >= 1 or getPlayerStorageValue(cid, 63215) >= 1 
or getPlayerStorageValue(cid, 75846) >= 1 or getPlayerStorageValue(cid, 5700) >= 1  then    --alterado v1.9 <<
return true                                                                                                                        
end
 
if exhaustion.get(cid, 6666) and exhaustion.get(cid, 6666) > 0 then return true end
 
 
if #getCreatureSummons(cid) > 1 and getPlayerStorageValue(cid, 212124) <= 0 then     --alterado v1.6
if getPlayerStorageValue(cid, 637501) == -2 or getPlayerStorageValue(cid, 637501) >= 1 then  
BackTeam(cid)       
end
end   
 
if #getCreatureSummons(cid) > 0 then
t = getPlayerSlotItem(cid, 8)
local btype = getPokeballType(t.itemid)
local effect = pokeballs[btype].effect or 21 
 
doReturnPokemon(cid, getCreatureSummons(cid)[1], t,effect)
end
 
t = getPlayerSlotItem(cid, 8)
if t.uid ~= 0 then
pokeslot = getItemAttribute(t.uid, "poke") 
 
 
if pokeslot == pokemon then
t = getPlayerSlotItem(cid, 8)
doGoPokemon(cid, t)
atualizaPokes(cid)
return true
end
 
if getPokemonByName(cid, pokemon) then
local poke = getPokemonByName(cid, pokemon)
local attr = copieAllStatusBalls(t.uid)
local id = t.itemid
doRemoveItem(t.uid)
local attr2 = copieAllStatusBalls(poke)
local id2 = getThing(poke).itemid
doRemoveItem(getPokemonByName(cid, pokemon))
createBallByStatus(cid, attr2, id2)
createBallByStatus(cid, attr, id)
t = getPlayerSlotItem(cid, 8)
doGoPokemon(cid, t)
atualizaPokes(cid)
return true
end
end
 
 
if getPokemonByName(cid, pokemon) then
local id = getThing(getPokemonByName(cid, pokemon)).itemid
local attr = copieAllStatusBalls(getPokemonByName(cid, pokemon))
doRemoveItem(getPokemonByName(cid, pokemon))
createBallByStatus(cid, attr, id)
t = getPlayerSlotItem(cid, 8)
doGoPokemon(cid, t)
atualizaPokes(cid)
return true
end
return false
end
 
 
function sendPokeInfo(cid)
local activeimg = true
local poke = getPlayerSlotItem(cid, 8)
local pokeslot = getItemAttribute(poke.uid, "poke") 
local pokeboost = getItemAttribute(poke.uid, "boost") or 0
local pokehappy = getPlayerStorageValue(getCreatureSummons(cid)[1], 1008) or 1 
doPlayerSendCancel(cid, "NewInfo/"..pokeslot.."/"..pokeboost.."/"..pokehappy.."")
if activeimg then
local img = "ShowPoke/"
doPlayerSendCancel(cid, img..pokeslot)
end
end
 
function sendAudio(cid, audio)
 
local function getSpectatorsFromArea(fromPosition, toPosition, multifloor)
    local lenght = ((math.max(fromPosition.x, toPosition.x) - math.min(fromPosition.x, toPosition.x)) * 0.5) + 1
    local width = ((math.max(fromPosition.y, toPosition.y) - math.min(fromPosition.y, toPosition.y)) * 0.5) + 1
 
    if multifloor == true then
        local ret = {}
        for f = math.min(fromPosition.z, toPosition.z), math.max(fromPosition.z, toPosition.z) do
            local tmp = getSpectators({x = math.min(fromPosition.x, toPosition.x) + lenght, y = math.min(fromPosition.y, toPosition.y) + width, z = f}, lenght, width, false)
            for k = 1, #tmp do
table.insert(ret, tmp[k])
end
        end
        return ret
    end
    return getSpectators({x = math.min(fromPosition.x, toPosition.x) + lenght, y = math.min(fromPosition.y, toPosition.y) + width, z = fromPosition.z}, lenght, width, false)
end
 
local pos = getThingPos(cid)
 
 
local pos = getThingPos(cid)
local t = 5
local pos1 = {x = pos.x-t, y = pos.y-t, z = pos.z}
local pos2 = {x = pos.x+t, y = pos.y+t, z = pos.z}
for _, pid in pairs(getSpectatorsFromArea(pos1, pos2, true)) do
if isPlayer(pid) then
doPlayerSendCancel(pid, "Audio "..audio.."")
end
end
end
 
function doShowSelectChar(cid)
doPlayerSendCancel(cid, "ShowChar")
end
 
function doCloseSelectChar(cid)
doPlayerSendCancel(cid, "CloseChar")
end
 
function doShowLookPlayer(cid, target, msg)
doPlayerSendCancel(cid, "ShowLook/"..getPlayerStorageValue(target, 21121).."/"..msg.."")
end
 
function doCloseInfoPoke(cid)
local activeimg = true
doPlayerSendCancel(cid, "InfoClosed")
if activeimg then
local close = "ClosePoke"
doPlayerSendCancel(cid, close)
end
end
 
function sendAllPokemonsBarPoke(cid)
local container = getPlayerSlotItem(cid, 3).uid
local pokes = "Pokebar"
local t = getPlayerSlotItem(cid, 8)
if t.uid ~= 0 then
pokeslot = getItemAttribute(t.uid, "poke") 
pokes = pokes.."/"..pokeslot..""
end
local pokeballs = getPokeballsInContainer(container) 
for i =1, #pokeballs do
pokemons = getItemAttribute(pokeballs[i], "poke") 
pokes = pokes.."/"..pokemons..""
end
doPlayerSendCancel(cid, pokes)
end
Editado por GniusP
Link para o comentário
Compartilhar em outros sites

pelo visto quanto vc adiciona um addon deve receber um atributo ta uma olhada, depois quanto aciona o barra nao adiciona esse atributo perdendo - o deve adicionar nesse trecho abixo.

 

local x = {"poke", "hp", "offense", "defense", "speed", "vitality", "specialattack", "happy", "gender", "hands", "description", "fakedesc", "boost", "ball", "defeated", "shiny", "level"}

 

 

Link para o comentário
Compartilhar em outros sites

2 horas atrás, nociam disse:

pelo visto quanto vc adiciona um addon deve receber um atributo ta uma olhada, depois quanto aciona o barra nao adiciona esse atributo perdendo - o deve adicionar nesse trecho abixo.

 

local x = {"poke", "hp", "offense", "defense", "speed", "vitality", "specialattack", "happy", "gender", "hands", "description", "fakedesc", "boost", "ball", "defeated", "shiny", "level"}

 

 

Ainda continua a mesma coisa, mais esqueci de explicar uma coisa

Assim que você usa o pokemon pela pokebar o pokemon sai com addon normalmente, mais só remove a addon assim que eu troco de pokemon pela pokebar

Por exemplo:

To com 1 blastoise e ele ta usando 1 addon, ai eu vou e uso ele(a addon dele sai normal) ai quando eu uso outro pokemon pela pokebar a addon do blastoise some.

Link para o comentário
Compartilhar em outros sites

Goback.lua

local EFFECTS = {
	--[OutfitID] = {Effect}
	["Magmar"] = 35,   
	["Jynx"] = 17,          --alterado v1.5
	["Shiny Jynx"] = 17, 
    ["Piloswine"] = 205,  --alterado v1.8
    ["Swinub"] = 205,   
}

function onUse(cid, item, frompos, item2, topos)
sendAllPokemonsBarPoke(cid)

	if exhaustion.get(cid, 6666) and exhaustion.get(cid, 6666) > 0 then return true end

	if getPlayerStorageValue(cid, 17000) >= 1 or getPlayerStorageValue(cid, 17001) >= 1 or getPlayerStorageValue(cid, 63215) >= 1 
		or getPlayerStorageValue(cid, 75846) >= 1 or getPlayerStorageValue(cid, 5700) >= 1  then    --alterado v1.9 <<
		return true                                                                                                                        
	end

	local ballName = getItemAttribute(item.uid, "poke")
	local btype = getPokeballType(item.itemid)
	local usando = pokeballs[btype].use

	local effect = pokeballs[btype].effect
	if not effect then
		effect = 21
	end
		
	unLock(item.uid) --alterado v1.8

	if item.itemid == usando then                           
		if getPlayerStorageValue(cid, 990) == 1 then -- GYM
			doPlayerSendCancel(cid, "You can't return your pokemon during gym battles.")
			return true
		end
		if #getCreatureSummons(cid) > 1 and getPlayerStorageValue(cid, 212124) <= 0 then     --alterado v1.6
			if getPlayerStorageValue(cid, 637501) == -2 or getPlayerStorageValue(cid, 637501) >= 1 then  
				BackTeam(cid)       
			end
		end   
		if #getCreatureSummons(cid) == 2 and getPlayerStorageValue(cid, 212124) >= 1 then
			doPlayerSendCancel(cid, "You can't do that while is controling a mind")
			return true     --alterado v1.5
		end
		if #getCreatureSummons(cid) <= 0 then
			if isInArray(pokeballs[btype].all, item.itemid) then
				doTransformItem(item.uid, pokeballs[btype].off)
				doItemSetAttribute(item.uid, "hp", 0)
				doPlayerSendCancel(cid, "This pokemon is fainted.")
				return true
			end
		end

		local cd = getCD(item.uid, "blink", 30)
		if cd > 0 then
		   setCD(item.uid, "blink", 0)
		end
		
		local z = getCreatureSummons(cid)[1]

		if getCreatureCondition(z, CONDITION_INVISIBLE) and not isGhostPokemon(z) then
		   return true
		end
		doReturnPokemon(cid, z, item, effect)

	elseif item.itemid == pokeballs[btype].on then

		if item.uid ~= getPlayerSlotItem(cid, CONST_SLOT_FEET).uid then
			doPlayerSendCancel(cid, "You must put your pokeball in the correct place!")
			return true
		end

		local thishp = getItemAttribute(item.uid, "hp")

		if getItemAttribute(item.uid, "hp") == 0 then
			if isInArray(pokeballs[btype].all, item.itemid) then
				doTransformItem(item.uid, pokeballs[btype].off)
				doItemSetAttribute(item.uid, "hp", 0)
				doPlayerSendCancel(cid, "This pokemon is fainted.")
				return true
			end
		end

		local pokemon = getItemAttribute(item.uid, "poke")

		if not pokes[pokemon] then
			return true
		end

		local x = pokes[pokemon]
		local boost = getItemAttribute(item.uid, "boost") or 0

		if getPlayerLevel(cid) < (x.level) then
		   doPlayerSendCancel(cid, "You need level "..(x.level).." to use this pokemon.")
		   return true
		end
		
		local pk = getCreatureSummons(cid)[1]
		
		doSummonMonster(cid, pokemon)
		doItemSetAttribute(item.uid, "pokeballusada", 0)

		local pk = getCreatureSummons(cid)[1]
		if not isCreature(pk) then return true end
		

		if getCreatureName(pk) == "Ditto" or getCreatureName(pk) == "Shiny Ditto" then --edited
			local left = getItemAttribute(item.uid, "transLeft")
			local name = getItemAttribute(item.uid, "transName")

			if left and left > 0 then
				setPlayerStorageValue(pk, 1010, name)
				doSetCreatureOutfit(pk, {lookType = getItemAttribute(item.uid, "transOutfit")}, -1)
				addEvent(deTransform, left * 1000, pk, getItemAttribute(item.uid, "transTurn"))
				doItemSetAttribute(item.uid, "transBegin", os.clock())
			else
				setPlayerStorageValue(pk, 1010, getCreatureName(pk) == "Ditto" and "Ditto" or "Shiny Ditto")     --edited
			end
		end

		if isGhostPokemon(pk) then doTeleportThing(pk, getPosByDir(getThingPos(cid), math.random(0, 7)), false) end

		doCreatureSetLookDir(pk, 2)
		doCreatureSetNick(pk, nick)	
		
		adjustStatus(pk, item.uid, true, true, true)
		doAddPokemonInOwnList(cid, pokemon)

		doTransformItem(item.uid, item.itemid+1)

		local pokename = getPokeName(pk) --alterado v1.7 

		if getPlayerLanguage(cid) == 2 then
			local mgoen = gobackmsgsen[math.random(1, #gobackmsgsen)].go:gsub("doka", pokename)
			doCreatureSay(cid, mgoen, 19)
		elseif getPlayerLanguage(cid) == 0 then
			local mgo = gobackmsgs[math.random(1, #gobackmsgs)].go:gsub("doka", pokename)
			doCreatureSay(cid, mgo, 19)
		elseif getPlayerLanguage(cid) == 1 then
			local mgoes = gobackmsgses[math.random(1, #gobackmsgses)].go:gsub("doka", pokename)
			doCreatureSay(cid, mgoes, 19)
		end
		
		-- doItemSetAttribute(item.uid, "gender", math.random(3, 4))	
		doSendMagicEffect(getCreaturePosition(pk), effect)
		
		if useOTClient then
		   doPlayerSendCancel(cid, '12//,show') --alterado v1.7
		end
		
		
		local pk = getCreatureSummons(cid)[1]
		local pb = getPlayerSlotItem(cid, 8).uid
		local look = getAddonValue(pb, "addon")

		if look > 0 then
			doSetCreatureOutfit(pk, {lookType = look}, -1)
		end
	else
		doPlayerSendCancel(cid, "This pokemon is fainted.")
	end
	if useKpdoDlls then
		doUpdateMoves(cid)
	end
	return true
end

addon.lua

Citar

local addons = {
[14876] = {pokemon = "Shiny Charizard" , looktype = 1950},
[12344] = {pokemon = "Pidgeot" , looktype = 205},
[13990] = {pokemon = "Pidgeot" , looktype = 201},
--[ID do item] = {nome do pokémon, looktype},
}

local function getOldAddon (looktype)
	for index, value in pairs (addons) do
		if value.looktype == looktype then
			return index
		end
	end
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local numero = addons[item.itemid].looktype
	local pb = itemEx.uid
	local pk = addons[item.itemid].pokemon
	
	if not isPokeball(itemEx.itemid) then 
		doPlayerSendCancel(cid, "Você só poder usar este item em uma poke ball.")
	return true
	end
	
	if getPlayerSlotItem (cid, 8).uid == pb and (getPlayerStorageValue(cid, 17000) >= 1 or getPlayerStorageValue(cid, 63215) >= 1) then
		doPlayerSendCancel (cid, "Desmonte do seu pokémon e volte-o para a poke ball.")
	return true
	end
	
	if getItemAttribute(pb, "addon") and getItemAttribute(pb, "addon") == numero then
		doPlayerSendCancel(cid, "Seu pokémon já está com este addon.")
	return true
	end     
	
	if #getCreatureSummons(cid) > 0 then
		doPlayerSendCancel(cid, "Por favor, volte o seu pokémon para a poke ball.")
	return true
	end   
	
	if getItemAttribute(pb, "poke") ~= pk then
		doPlayerSendCancel(cid, "Desculpe, você não pode adicionar este addon neste pokémon.")
	return true
	end
	
	if getItemAttribute (pb, "addon") and getItemAttribute (pb, "addon") > 1 then
		doPlayerSendTextMessage(cid, 27, "Você substituiu um "..getItemNameById (getOldAddon (getItemAttribute (pb, "addon"))).." por um "..getItemNameById (item.itemid).."!")
	else
		doPlayerSendTextMessage(cid, 27, "Agora seu pokémon usará este "..getItemNameById (item.itemid).."!")
	end
	
	doRemoveItem(item.uid, 1)
	doSetItemAttribute(pb, "addon", numero)   
return true
end

 

Editado por GniusP
Link para o comentário
Compartilhar em outros sites

troque  as partes da variável x pela a de abaixo e ve se vai.

 

local x = {"poke", "hp", "offense", "defense", "speed", "vitality", "specialattack", "happy", "gender", "hands", "description", "fakedesc", "boost", "ball", "defeated", "shiny", "level", "addon"}

 

 

Link para o comentário
Compartilhar em outros sites

12 minutos atrás, nociam disse:

troque  as partes da variável x pela a de abaixo e ve se vai.

 

local x = {"poke", "hp", "offense", "defense", "speed", "vitality", "specialattack", "happy", "gender", "hands", "description", "fakedesc", "boost", "ball", "defeated", "shiny", "level", "addon"}

 

 

Não foi.

Link para o comentário
Compartilhar em outros sites

  • 7 months later...
A questão neste suporte foi encerrada por falta de respostas. Este tópico está fechado e foi movido para Suporte - Tópicos Sem Resposta.

+ Caso a dúvida não tenha sido resolvida você poderá criar outro tópico solicitando ajuda.
* Lembre-se que é permitido dar UP no tópico a cada 24 horas para assim o destacar e manter movimentado.
Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...