Ir para conteúdo

[PDA/TFS 0.3.6] Multi Addon System


DarkWore

Posts Recomendados

  • 1 month later...
  • 7 months later...
  • 2 months later...
Em 06/10/2018 em 19:08, DarkWore disse:

Boa Noite gente, Hoje eu venho postar um Sistema de Multi Addon System feito para o data do PDA 1.9 pode funcionar em TFS 0.3.6 com pequenas adaptações, como eu havia dito em outra postagem esse Sistema foi feito por meu Amigo Slicer e tem algumas coisas minhas e de alguns amigos, Bom em outra base aqui no fórum, na base vazada havia esse sistema que o amigo que eu passei passou para esse outro colega, enfim eu conversei com meu Amigo Slicer e decidimos por postar, vamos la.

 

data\actions\scripts crie um arquivo com nome de addon.lua e cole isso dentro:


local addons = {
	-- Shiny Alakazam
	[13089] = {addon_num = 1, pokemon= "Shiny Alakazam", looktype = 2013, nome = "Adventurer addon", fly =  0, ride = 0, surf = 0},
	[13091] = {addon_num = 2, pokemon= "Shiny Alakazam", looktype = 2014, nome = "Grey hat addon", fly =  0, ride = 0, surf = 0},
	[13092] = {addon_num = 3, pokemon= "Shiny Alakazam", looktype = 2016, nome = "Ret hat addon", fly =  0, ride = 0, surf = 0},
	[13090] = {addon_num = 4, pokemon= "Shiny Alakazam", looktype = 2015, nome = "Purple hat addon", fly =  0, ride = 0, surf = 0},
	
	-- Alakazam
	[13093] = {addon_num = 1, pokemon= "Alakazam", looktype = 2009, nome = "Adventurer addon", fly =  0, ride = 0, surf = 0},
	[13095] = {addon_num = 2, pokemon= "Alakazam", looktype = 2010, nome = "Grey hat addon", fly =  0, ride = 0, surf = 0},
	[13096] = {addon_num = 3, pokemon= "Alakazam", looktype = 2012, nome = "Ret hat addon", fly =  0, ride = 0, surf = 0},
	[13094] = {addon_num = 4, pokemon= "Alakazam", looktype = 2011, nome = "Purple hat addon", fly =  0, ride = 0, surf = 0},

	-- Shiny Tropius
	[13101] = {addon_num = 1, pokemon= "Shiny Tropius", looktype = 2019, nome = "Sorcerer addon", fly =  2065, ride = 0, surf = 0},
	[13106] = {addon_num = 2, pokemon= "Shiny Tropius", looktype = 2069, nome = "Desert flower addon", fly =  2070, ride = 0, surf = 0},

	-- Shiny Metagross
	[13098] = {addon_num = 1, pokemon= "Shiny Metagross", looktype = 2021, nome = "King's crown addon", fly =  0, ride = 2064, surf = 0},
	[13099] = {addon_num = 2, pokemon= "Shiny Metagross", looktype = 2020, nome = "Queen's crown addon", fly =  0, ride = 2067, surf = 0},

	-- Shiny Clefable
	[13097] = {addon_num = 1, pokemon= "Shiny Clefable", looktype = 2068, nome = "Angel addon", fly =  0, ride = 0, surf = 0},

	-- Clefable 
	[13102] = {addon_num = 1, pokemon= "Clefable", looktype = 2025, nome = "Angel addon", fly =  0, ride = 0, surf = 0},

	-- Shiny Jynx
	[13100] = {addon_num = 1, pokemon= "Shiny Jynx", looktype = 2023, nome = "Witch addon", fly =  0, ride = 0, surf = 0},

	-- Metagross
	[13103] = {addon_num = 1, pokemon= "Metagross", looktype = 2018, nome = "King's crown addon", fly =  0, ride = 2063, surf = 0},
	[13104] = {addon_num = 2, pokemon= "Metagross", looktype = 2017, nome = "Queen's crown addon", fly =  0, ride = 2066, surf = 0},

	-- Halloween
	[13105] = {addon_num = 1, pokemon= "Elder Charizard", looktype = 2074, nome = "Halloween addon", fly =  2072, ride = 0, surf = 0},
	[13107] = {addon_num = 2, pokemon= "Charizard", looktype = 2073, nome = "Halloween addon", fly =  2071, ride = 0, surf = 0},

	-- Shiny Blastoise
	[13108] = {addon_num = 1, pokemon= "Shiny Blastoise", looktype = 2078, nome = "Purple ninja pack addon", fly =  0, ride = 0, surf = 2083},
	[13109] = {addon_num = 2, pokemon= "Shiny Blastoise", looktype = 2076, nome = "Orange ninja pack addon", fly =  0, ride = 0, surf = 2088},
	[13110] = {addon_num = 3, pokemon= "Shiny Blastoise", looktype = 2075, nome = "Red ninja pack addon", fly =  0, ride = 0, surf = 2090},
	[13111] = {addon_num = 4, pokemon= "Shiny Blastoise", looktype = 2077, nome = "Blue ninja pack addon", fly =  0, ride = 0, surf = 2086},

	-- Blastoise
	[13112] = {addon_num = 1, pokemon= "Blastoise", looktype = 2082, nome = "Purple ninja pack addon", fly =  0, ride = 0, surf = 2083},
	[13113] = {addon_num = 2, pokemon= "Blastoise", looktype = 2080, nome = "Orange ninja pack addon", fly =  0, ride = 0, surf = 2087},
	[13114] = {addon_num = 3, pokemon= "Blastoise", looktype = 2079, nome = "Red ninja pack addon", fly =  0, ride = 0, surf = 2089},
	[13115] = {addon_num = 4, pokemon= "Blastoise", looktype = 2081, nome = "Blue ninja pack addon", fly =  0, ride = 0, surf = 2085},
	
	-- Shiny Gardevoir
	[13320] = {addon_num = 1, pokemon= "Shiny Gardevoir", looktype = 2159, nome = "Witch Apparentice addon", fly =  0, ride = 0, surf = 0},
	[13324] = {addon_num = 2, pokemon= "Shiny Gardevoir", looktype = 2164, nome = "Housekeeper addon", fly =  0, ride = 0, surf = 0},
	[13337] = {addon_num = 3, pokemon= "Shiny Gardevoir", looktype = 2136, nome = "Bride Saint Join addon", fly =  0, ride = 0, surf = 0},
	
	-- Gardevoir
	[13291] = {addon_num = 1, pokemon= "Gardevoir", looktype = 2156, nome = "Witch Apparentice addon", fly =  0, ride = 0, surf = 0},
	[13295] = {addon_num = 2, pokemon= "Gardevoir", looktype = 2161, nome = "Housekeeper addon", fly =  0, ride = 0, surf = 0},
	[13302] = {addon_num = 3, pokemon= "Gardevoir", looktype = 2198, nome = "Bride Saint Join addon", fly =  0, ride = 0, surf = 0},
	
	-- Shiny Spiritomb
	[13322] = {addon_num = 1, pokemon= "Shiny Spiritomb", looktype = 2204, nome = "Green Ballon addon", fly =  0, ride = 0, surf = 0},
	[13345] = {addon_num = 2, pokemon= "Shiny Spiritomb", looktype = 2208, nome = "Orange Ballon addon", fly =  0, ride = 0, surf = 0},
	[13347] = {addon_num = 3, pokemon= "Shiny Spiritomb", looktype = 2163, nome = "Clown Box addon", fly =  0, ride = 0, surf = 0},
	
	-- Spiritomb
	[13293] = {addon_num = 1, pokemon= "Spiritomb", looktype = 2202, nome = "Green Ballon addon", fly =  0, ride = 0, surf = 0},
	[13314] = {addon_num = 2, pokemon= "Spiritomb", looktype = 2206, nome = "Orange Ballon addon", fly =  0, ride = 0, surf = 0},
	[13316] = {addon_num = 3, pokemon= "Spiritomb", looktype = 2200, nome = "Clown Box addon", fly =  0, ride = 0, surf = 0},
	
	-- Shiny Togekiss
	[13321] = {addon_num = 1, pokemon= "Shiny Togekiss", looktype = 2205, nome = "Champion 2016 addon", fly =  2193, ride = 0, surf = 0},
	[13339] = {addon_num = 2, pokemon= "Shiny Togekiss", looktype = 2158, nome = "Superman addon", fly =  2155, ride = 0, surf = 0},
	[13342] = {addon_num = 3, pokemon= "Shiny Togekiss", looktype = 2201, nome = "Piloto addon", fly =  2203, ride = 0, surf = 0},
	
	-- Togekiss
	[13292] = {addon_num = 1, pokemon= "Togekiss", looktype = 2121, nome = "Champion 2016 addon", fly =  2189, ride = 0, surf = 0},
	[13303] = {addon_num = 2, pokemon= "Togekiss", looktype = 2158, nome = "Superman addon", fly =  2160, ride = 0, surf = 0},
	[13308] = {addon_num = 3, pokemon= "Togekiss", looktype = 2162, nome = "Piloto addon", fly =  2183, ride = 0, surf = 0},
	[13309] = {addon_num = 4, pokemon= "Togekiss", looktype = 2179, nome = "Batman addon", fly =  2182, ride = 0, surf = 0},
}

local msgs = {
	return_poke = {
		[0] = "Por favor volte seu pokémon.",
		[1] = "Por favor, vuelve su pokémon.",
		[2] = "Please back your pokémon."
	},
	cant_use = {
		[0] = "Desculpa, você não pode usar esse addon nesse pokémon.",
		[1] = "Lo sentimos, no se puede utilizar este addon en esse pokémon.",
		[2] = "Sorry, you can't use this addon on this pokémon."
	}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if #getCreatureSummons(cid) > 0 then
		doPlayerSendCancel(cid, msgs.return_poke[getPlayerLanguage(cid)])
		return false
	end  
	
	local addonNum = addons[item.itemid].addon_num
	local addon = addons[item.itemid].looktype
	local fly = addons[item.itemid].fly
	local ride = addons[item.itemid].ride
	local surf = addons[item.itemid].surf
	local addonlook = addons[item.itemid].nome
	 
	local pb = getPlayerSlotItem(cid, 8).uid
	local pk = addons[item.itemid].pokemon
	 
	if getItemAttribute(pb, "poke") ~= pk then
		doPlayerSendCancel(cid, msgs.cant_use[getPlayerLanguage(cid)])
		return false
	end
	
	if getItemAttribute(pb, "pokeballusada") == 0 then
		doRemoveItem(item.uid, 1)
		doSendMagicEffect(fromPosition, 173)
		
		updateAddonAttr(pb, "addon"    , addon    , addonNum)
		updateAddonAttr(pb, "addonfly" , fly      , addonNum)
		updateAddonAttr(pb, "addonride", ride     , addonNum)
		updateAddonAttr(pb, "addonsurf", surf     , addonNum)
		updateAddonAttr(pb, "addonlook", addonlook, addonNum)
		
		if not getItemAttribute(pb, "current_addon") then
			doSetItemAttribute(pb, "current_addon", addonNum)
		end
		return true
	end
	return false
end

Ainda em data\actions\scripts em goback.lua procure por:


if useOTClient then
   doPlayerSendCancel(cid, '12//,show') --alterado v1.7
end

Embaixo cole:


-- ADDON SYSTEM
		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

Ainda em data\actions\scripts em order.lua procure por:


doRemoveCondition(cid, CONDITION_OUTFIT)

Embaixo cole:


-- ADDON SYSTEM
		local look = getAddonValue(item.uid, "addon")
		if look > 0 then
			doSetCreatureOutfit(pk, {lookType = look}, -1)
		end

Ainda em data\actions\scripts em surf.lua procure por:


setPlayerStorageValue(cid, 63215, 1)

Embaixo cole:


-- ADDON SYSTEM
        local look = getAddonValue(pb, "addonsurf")
		if look > 0 then
			doSetCreatureOutfit(cid, {lookType = look}, -1)
		else
			doSetCreatureOutfit(cid, pokes[getCreatureName(getCreatureSummons(cid)[1])], -1)
        end

Agora em data\creaturescripts\scripts em login.lua procure por:


doRemoveCondition(cid, CONDITION_OUTFIT)

Embaixo cole:


-- ADDON SYSTEM
		local look = getAddonValue(item.uid, "addonfly")
		if look > 0 then
			doSetCreatureOutfit(cid, {lookType = look}, -1)
		else
			doSetCreatureOutfit(cid, {lookType = flys[poke][1] + 351}, -1)
		end

Ainda em data\creaturescripts\scripts em look.lua procure por:


if getItemAttribute(thing.uid, "nick") then
    table.insert(str, " [Nickname]: "..getItemAttribute(thing.uid, "nick")..". ")
end

Depois do end coloque embaixo:


if getItemAttribute(thing.uid, "addonlook") then
    table.insert(str, "Addons: "..getAddonTotalLook(getItemAttribute(thing.uid, "addonlook")).."\n")
end

Agora em data\lib em order.lua procure por:


setPlayerStorageValue(cid, 54844, speed)

Embaixo cole:


-- ADDON SYSTEM
		local pb = getPlayerSlotItem(cid, 8).uid
		local look = getAddonValue(pb, "addonfly")
		if look > 0 then
			doSetCreatureOutfit(cid, {lookType = look}, -1)
		else
			doSetCreatureOutfit(cid, {lookType = pokemon[1] + 351}, -1)
		end

Ainda em data\lib  crie um arquivo com nome de addon.lua e cole isso dentro:


ADDON_LIMIT = 5 --Limite de addons que um poke pode ter
local ADDON_BASE_STRING = string.rep("0;", ADDON_LIMIT) --String base no formato: "0;0;0;0;0;"

local function checkAddonTableConsistency(tab)
    if #tab < ADDON_LIMIT then --proteção para quando muda o ADDON_LIMIT
        for i = #tab+1, ADDON_LIMIT do
            tab[i] = 0
        end
    end
end

function updateAddonAttr(uid, attr, value, pos)
    local tmp = getItemAttribute(uid, attr) or ADDON_BASE_STRING
    tmp = type(tmp) == "string" and tmp or ADDON_BASE_STRING
    local t = string.explode(tmp, ";")

    checkAddonTableConsistency(t)
    if pos > 0 and pos <= ADDON_LIMIT then
        t[pos] = value
        return doSetItemAttribute(uid, attr, table.concat(t, ";"))
    else
        return false
    end
end

function getAddonValue(uid, attr)
    local tmp = getItemAttribute(uid, attr) or ADDON_BASE_STRING
    tmp = type(tmp) == "string" and tmp or ADDON_BASE_STRING
    tmp = string.explode(tmp, ";")
    local pos = getItemAttribute(uid, "current_addon") or 0

    checkAddonTableConsistency(tmp)
    if pos > 0 and pos <= ADDON_LIMIT then
        return tonumber(tmp[pos])
    else
        return 0
    end
end

function getAddonCount(uid)
  local tmp = getItemAttribute(uid, "addon")
  if type(tmp) ~= "string" then return 0 end
  local t = string.explode(tmp, ";")

  checkAddonTableConsistency(t)
  local count = 0
  for _,v in ipairs(t) do
    if tonumber(v) ~= 0 then count = count + 1 end
  end
  return count
end

function getAddonTotalLook(value)
local str = {}
addonValue = 0
	for addonList = 1, 5 do
	local addons = tostring(value:explode(";")[addonList])
		if addons ~= '0' then
			addonValue = addonValue + 1
		end
	end
addonValue = addonValue == 0 and "Não possui addon." or addonValue
return addonValue
end

Agora em data\talkactions/scripts crie um arquivo com nome de addon_talk.lua e cole isso dentro:


function onSay(cid, words, param)
     
	local pb = getPlayerSlotItem(cid, 8).uid
	local pos = tonumber(param)
	
    if #getCreatureSummons(cid) >= 1 then
	   doPlayerSendCancel(cid, "Volte seu pokemon para a pokebola antes de trocar o addon.")
       return true                                                                                                                        
    end
	
	if not pos then
		doPlayerSendCancel(cid, "O numero do Addon deve ser um valor entre 0 e " ..ADDON_LIMIT.. ".")
		return true
	end

	if pos >= 0 and pos <= ADDON_LIMIT then
		doSetItemAttribute(pb, "current_addon", pos)
	end
	return true
end

Arquivos Completos que eu utilizava, já que o sistema foi feito para a minha base, pode necessitar pequenas adaptações:

data\actions\scripts:

addon.lua 7 kB · 45 downloads

goback.lua 5 kB · 48 downloads

order.lua 17 kB · 42 downloads

surf.lua 6 kB · 47 downloads

 

data\creaturescripts\scripts:

login.lua 12 kB · 40 downloads

look.lua 8 kB · 35 downloads

 

data\lib:

addon.lua 1 kB · 43 downloads

order.lua 16 kB · 41 downloads

 

data\talkactions\scripts:

addon_talk.lua 655 B · 41 downloads

 

Bom é isso, Só usarem agora, Não se esqueçam de registrar os scripts no xml e os comandos do talkactions, etc.

 

Créditos:

@Slicer (Desenvolvimento em Geral)

@DarkWore (Completar Algumas coisas que ficaram pendentes/erros que surgiram)

@Jair Kevick (Completar problema que estava havendo com o Look)

 

Lembrando Nenhum dos citados oferece suporte ao sistema para erros que surgirem ou qualquer coisa do tipo, até porque ainda existe muita coisa incompleto e que pode ser melhorado nos scripts.

 

 

tenhe com test n DXP.

 

base dxp

Link para o comentário
Compartilhar em outros sites

  • 8 months later...
  • 4 months later...
Em 06/10/2018 em 19:08, DarkWore disse:

Boa Noite gente, Hoje eu venho postar um Sistema de Multi Addon System feito para o data do PDA 1.9 pode funcionar em TFS 0.3.6 com pequenas adaptações, como eu havia dito em outra postagem esse Sistema foi feito por meu Amigo Slicer e tem algumas coisas minhas e de alguns amigos, Bom em outra base aqui no fórum, na base vazada havia esse sistema que o amigo que eu passei passou para esse outro colega, enfim eu conversei com meu Amigo Slicer e decidimos por postar, vamos la.

 

data\actions\scripts crie um arquivo com nome de addon.lua e cole isso dentro:


local addons = {
	-- Shiny Alakazam
	[13089] = {addon_num = 1, pokemon= "Shiny Alakazam", looktype = 2013, nome = "Adventurer addon", fly =  0, ride = 0, surf = 0},
	[13091] = {addon_num = 2, pokemon= "Shiny Alakazam", looktype = 2014, nome = "Grey hat addon", fly =  0, ride = 0, surf = 0},
	[13092] = {addon_num = 3, pokemon= "Shiny Alakazam", looktype = 2016, nome = "Ret hat addon", fly =  0, ride = 0, surf = 0},
	[13090] = {addon_num = 4, pokemon= "Shiny Alakazam", looktype = 2015, nome = "Purple hat addon", fly =  0, ride = 0, surf = 0},
	
	-- Alakazam
	[13093] = {addon_num = 1, pokemon= "Alakazam", looktype = 2009, nome = "Adventurer addon", fly =  0, ride = 0, surf = 0},
	[13095] = {addon_num = 2, pokemon= "Alakazam", looktype = 2010, nome = "Grey hat addon", fly =  0, ride = 0, surf = 0},
	[13096] = {addon_num = 3, pokemon= "Alakazam", looktype = 2012, nome = "Ret hat addon", fly =  0, ride = 0, surf = 0},
	[13094] = {addon_num = 4, pokemon= "Alakazam", looktype = 2011, nome = "Purple hat addon", fly =  0, ride = 0, surf = 0},

	-- Shiny Tropius
	[13101] = {addon_num = 1, pokemon= "Shiny Tropius", looktype = 2019, nome = "Sorcerer addon", fly =  2065, ride = 0, surf = 0},
	[13106] = {addon_num = 2, pokemon= "Shiny Tropius", looktype = 2069, nome = "Desert flower addon", fly =  2070, ride = 0, surf = 0},

	-- Shiny Metagross
	[13098] = {addon_num = 1, pokemon= "Shiny Metagross", looktype = 2021, nome = "King's crown addon", fly =  0, ride = 2064, surf = 0},
	[13099] = {addon_num = 2, pokemon= "Shiny Metagross", looktype = 2020, nome = "Queen's crown addon", fly =  0, ride = 2067, surf = 0},

	-- Shiny Clefable
	[13097] = {addon_num = 1, pokemon= "Shiny Clefable", looktype = 2068, nome = "Angel addon", fly =  0, ride = 0, surf = 0},

	-- Clefable 
	[13102] = {addon_num = 1, pokemon= "Clefable", looktype = 2025, nome = "Angel addon", fly =  0, ride = 0, surf = 0},

	-- Shiny Jynx
	[13100] = {addon_num = 1, pokemon= "Shiny Jynx", looktype = 2023, nome = "Witch addon", fly =  0, ride = 0, surf = 0},

	-- Metagross
	[13103] = {addon_num = 1, pokemon= "Metagross", looktype = 2018, nome = "King's crown addon", fly =  0, ride = 2063, surf = 0},
	[13104] = {addon_num = 2, pokemon= "Metagross", looktype = 2017, nome = "Queen's crown addon", fly =  0, ride = 2066, surf = 0},

	-- Halloween
	[13105] = {addon_num = 1, pokemon= "Elder Charizard", looktype = 2074, nome = "Halloween addon", fly =  2072, ride = 0, surf = 0},
	[13107] = {addon_num = 2, pokemon= "Charizard", looktype = 2073, nome = "Halloween addon", fly =  2071, ride = 0, surf = 0},

	-- Shiny Blastoise
	[13108] = {addon_num = 1, pokemon= "Shiny Blastoise", looktype = 2078, nome = "Purple ninja pack addon", fly =  0, ride = 0, surf = 2083},
	[13109] = {addon_num = 2, pokemon= "Shiny Blastoise", looktype = 2076, nome = "Orange ninja pack addon", fly =  0, ride = 0, surf = 2088},
	[13110] = {addon_num = 3, pokemon= "Shiny Blastoise", looktype = 2075, nome = "Red ninja pack addon", fly =  0, ride = 0, surf = 2090},
	[13111] = {addon_num = 4, pokemon= "Shiny Blastoise", looktype = 2077, nome = "Blue ninja pack addon", fly =  0, ride = 0, surf = 2086},

	-- Blastoise
	[13112] = {addon_num = 1, pokemon= "Blastoise", looktype = 2082, nome = "Purple ninja pack addon", fly =  0, ride = 0, surf = 2083},
	[13113] = {addon_num = 2, pokemon= "Blastoise", looktype = 2080, nome = "Orange ninja pack addon", fly =  0, ride = 0, surf = 2087},
	[13114] = {addon_num = 3, pokemon= "Blastoise", looktype = 2079, nome = "Red ninja pack addon", fly =  0, ride = 0, surf = 2089},
	[13115] = {addon_num = 4, pokemon= "Blastoise", looktype = 2081, nome = "Blue ninja pack addon", fly =  0, ride = 0, surf = 2085},
	
	-- Shiny Gardevoir
	[13320] = {addon_num = 1, pokemon= "Shiny Gardevoir", looktype = 2159, nome = "Witch Apparentice addon", fly =  0, ride = 0, surf = 0},
	[13324] = {addon_num = 2, pokemon= "Shiny Gardevoir", looktype = 2164, nome = "Housekeeper addon", fly =  0, ride = 0, surf = 0},
	[13337] = {addon_num = 3, pokemon= "Shiny Gardevoir", looktype = 2136, nome = "Bride Saint Join addon", fly =  0, ride = 0, surf = 0},
	
	-- Gardevoir
	[13291] = {addon_num = 1, pokemon= "Gardevoir", looktype = 2156, nome = "Witch Apparentice addon", fly =  0, ride = 0, surf = 0},
	[13295] = {addon_num = 2, pokemon= "Gardevoir", looktype = 2161, nome = "Housekeeper addon", fly =  0, ride = 0, surf = 0},
	[13302] = {addon_num = 3, pokemon= "Gardevoir", looktype = 2198, nome = "Bride Saint Join addon", fly =  0, ride = 0, surf = 0},
	
	-- Shiny Spiritomb
	[13322] = {addon_num = 1, pokemon= "Shiny Spiritomb", looktype = 2204, nome = "Green Ballon addon", fly =  0, ride = 0, surf = 0},
	[13345] = {addon_num = 2, pokemon= "Shiny Spiritomb", looktype = 2208, nome = "Orange Ballon addon", fly =  0, ride = 0, surf = 0},
	[13347] = {addon_num = 3, pokemon= "Shiny Spiritomb", looktype = 2163, nome = "Clown Box addon", fly =  0, ride = 0, surf = 0},
	
	-- Spiritomb
	[13293] = {addon_num = 1, pokemon= "Spiritomb", looktype = 2202, nome = "Green Ballon addon", fly =  0, ride = 0, surf = 0},
	[13314] = {addon_num = 2, pokemon= "Spiritomb", looktype = 2206, nome = "Orange Ballon addon", fly =  0, ride = 0, surf = 0},
	[13316] = {addon_num = 3, pokemon= "Spiritomb", looktype = 2200, nome = "Clown Box addon", fly =  0, ride = 0, surf = 0},
	
	-- Shiny Togekiss
	[13321] = {addon_num = 1, pokemon= "Shiny Togekiss", looktype = 2205, nome = "Champion 2016 addon", fly =  2193, ride = 0, surf = 0},
	[13339] = {addon_num = 2, pokemon= "Shiny Togekiss", looktype = 2158, nome = "Superman addon", fly =  2155, ride = 0, surf = 0},
	[13342] = {addon_num = 3, pokemon= "Shiny Togekiss", looktype = 2201, nome = "Piloto addon", fly =  2203, ride = 0, surf = 0},
	
	-- Togekiss
	[13292] = {addon_num = 1, pokemon= "Togekiss", looktype = 2121, nome = "Champion 2016 addon", fly =  2189, ride = 0, surf = 0},
	[13303] = {addon_num = 2, pokemon= "Togekiss", looktype = 2158, nome = "Superman addon", fly =  2160, ride = 0, surf = 0},
	[13308] = {addon_num = 3, pokemon= "Togekiss", looktype = 2162, nome = "Piloto addon", fly =  2183, ride = 0, surf = 0},
	[13309] = {addon_num = 4, pokemon= "Togekiss", looktype = 2179, nome = "Batman addon", fly =  2182, ride = 0, surf = 0},
}

local msgs = {
	return_poke = {
		[0] = "Por favor volte seu pokémon.",
		[1] = "Por favor, vuelve su pokémon.",
		[2] = "Please back your pokémon."
	},
	cant_use = {
		[0] = "Desculpa, você não pode usar esse addon nesse pokémon.",
		[1] = "Lo sentimos, no se puede utilizar este addon en esse pokémon.",
		[2] = "Sorry, you can't use this addon on this pokémon."
	}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if #getCreatureSummons(cid) > 0 then
		doPlayerSendCancel(cid, msgs.return_poke[getPlayerLanguage(cid)])
		return false
	end  
	
	local addonNum = addons[item.itemid].addon_num
	local addon = addons[item.itemid].looktype
	local fly = addons[item.itemid].fly
	local ride = addons[item.itemid].ride
	local surf = addons[item.itemid].surf
	local addonlook = addons[item.itemid].nome
	 
	local pb = getPlayerSlotItem(cid, 8).uid
	local pk = addons[item.itemid].pokemon
	 
	if getItemAttribute(pb, "poke") ~= pk then
		doPlayerSendCancel(cid, msgs.cant_use[getPlayerLanguage(cid)])
		return false
	end
	
	if getItemAttribute(pb, "pokeballusada") == 0 then
		doRemoveItem(item.uid, 1)
		doSendMagicEffect(fromPosition, 173)
		
		updateAddonAttr(pb, "addon"    , addon    , addonNum)
		updateAddonAttr(pb, "addonfly" , fly      , addonNum)
		updateAddonAttr(pb, "addonride", ride     , addonNum)
		updateAddonAttr(pb, "addonsurf", surf     , addonNum)
		updateAddonAttr(pb, "addonlook", addonlook, addonNum)
		
		if not getItemAttribute(pb, "current_addon") then
			doSetItemAttribute(pb, "current_addon", addonNum)
		end
		return true
	end
	return false
end

Ainda em data\actions\scripts em goback.lua procure por:


if useOTClient then
   doPlayerSendCancel(cid, '12//,show') --alterado v1.7
end

Embaixo cole:


-- ADDON SYSTEM
		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

Ainda em data\actions\scripts em order.lua procure por:


doRemoveCondition(cid, CONDITION_OUTFIT)

Embaixo cole:


-- ADDON SYSTEM
		local look = getAddonValue(item.uid, "addon")
		if look > 0 then
			doSetCreatureOutfit(pk, {lookType = look}, -1)
		end

Ainda em data\actions\scripts em surf.lua procure por:


setPlayerStorageValue(cid, 63215, 1)

Embaixo cole:


-- ADDON SYSTEM
        local look = getAddonValue(pb, "addonsurf")
		if look > 0 then
			doSetCreatureOutfit(cid, {lookType = look}, -1)
		else
			doSetCreatureOutfit(cid, pokes[getCreatureName(getCreatureSummons(cid)[1])], -1)
        end

Agora em data\creaturescripts\scripts em login.lua procure por:


doRemoveCondition(cid, CONDITION_OUTFIT)

Embaixo cole:


-- ADDON SYSTEM
		local look = getAddonValue(item.uid, "addonfly")
		if look > 0 then
			doSetCreatureOutfit(cid, {lookType = look}, -1)
		else
			doSetCreatureOutfit(cid, {lookType = flys[poke][1] + 351}, -1)
		end

Ainda em data\creaturescripts\scripts em look.lua procure por:


if getItemAttribute(thing.uid, "nick") then
    table.insert(str, " [Nickname]: "..getItemAttribute(thing.uid, "nick")..". ")
end

Depois do end coloque embaixo:


if getItemAttribute(thing.uid, "addonlook") then
    table.insert(str, "Addons: "..getAddonTotalLook(getItemAttribute(thing.uid, "addonlook")).."\n")
end

Agora em data\lib em order.lua procure por:


setPlayerStorageValue(cid, 54844, speed)

Embaixo cole:


-- ADDON SYSTEM
		local pb = getPlayerSlotItem(cid, 8).uid
		local look = getAddonValue(pb, "addonfly")
		if look > 0 then
			doSetCreatureOutfit(cid, {lookType = look}, -1)
		else
			doSetCreatureOutfit(cid, {lookType = pokemon[1] + 351}, -1)
		end

Ainda em data\lib  crie um arquivo com nome de addon.lua e cole isso dentro:


ADDON_LIMIT = 5 --Limite de addons que um poke pode ter
local ADDON_BASE_STRING = string.rep("0;", ADDON_LIMIT) --String base no formato: "0;0;0;0;0;"

local function checkAddonTableConsistency(tab)
    if #tab < ADDON_LIMIT then --proteção para quando muda o ADDON_LIMIT
        for i = #tab+1, ADDON_LIMIT do
            tab[i] = 0
        end
    end
end

function updateAddonAttr(uid, attr, value, pos)
    local tmp = getItemAttribute(uid, attr) or ADDON_BASE_STRING
    tmp = type(tmp) == "string" and tmp or ADDON_BASE_STRING
    local t = string.explode(tmp, ";")

    checkAddonTableConsistency(t)
    if pos > 0 and pos <= ADDON_LIMIT then
        t[pos] = value
        return doSetItemAttribute(uid, attr, table.concat(t, ";"))
    else
        return false
    end
end

function getAddonValue(uid, attr)
    local tmp = getItemAttribute(uid, attr) or ADDON_BASE_STRING
    tmp = type(tmp) == "string" and tmp or ADDON_BASE_STRING
    tmp = string.explode(tmp, ";")
    local pos = getItemAttribute(uid, "current_addon") or 0

    checkAddonTableConsistency(tmp)
    if pos > 0 and pos <= ADDON_LIMIT then
        return tonumber(tmp[pos])
    else
        return 0
    end
end

function getAddonCount(uid)
  local tmp = getItemAttribute(uid, "addon")
  if type(tmp) ~= "string" then return 0 end
  local t = string.explode(tmp, ";")

  checkAddonTableConsistency(t)
  local count = 0
  for _,v in ipairs(t) do
    if tonumber(v) ~= 0 then count = count + 1 end
  end
  return count
end

function getAddonTotalLook(value)
local str = {}
addonValue = 0
	for addonList = 1, 5 do
	local addons = tostring(value:explode(";")[addonList])
		if addons ~= '0' then
			addonValue = addonValue + 1
		end
	end
addonValue = addonValue == 0 and "Não possui addon." or addonValue
return addonValue
end

Agora em data\talkactions/scripts crie um arquivo com nome de addon_talk.lua e cole isso dentro:


function onSay(cid, words, param)
     
	local pb = getPlayerSlotItem(cid, 8).uid
	local pos = tonumber(param)
	
    if #getCreatureSummons(cid) >= 1 then
	   doPlayerSendCancel(cid, "Volte seu pokemon para a pokebola antes de trocar o addon.")
       return true                                                                                                                        
    end
	
	if not pos then
		doPlayerSendCancel(cid, "O numero do Addon deve ser um valor entre 0 e " ..ADDON_LIMIT.. ".")
		return true
	end

	if pos >= 0 and pos <= ADDON_LIMIT then
		doSetItemAttribute(pb, "current_addon", pos)
	end
	return true
end

Arquivos Completos que eu utilizava, já que o sistema foi feito para a minha base, pode necessitar pequenas adaptações:

data\actions\scripts:

addon.lua 7.81 kB · 64 downloads

goback.lua 5.36 kB · 64 downloads

order.lua 17.42 kB · 58 downloads

surf.lua 6.21 kB · 65 downloads

 

data\creaturescripts\scripts:

login.lua 12.25 kB · 57 downloads

look.lua 8.25 kB · 48 downloads

 

data\lib:

addon.lua 1.76 kB · 58 downloads

order.lua 16.23 kB · 54 downloads

 

data\talkactions\scripts:

addon_talk.lua 655 B · 57 downloads

 

Bom é isso, Só usarem agora, Não se esqueçam de registrar os scripts no xml e os comandos do talkactions, etc.

 

Créditos:

@Slicer (Desenvolvimento em Geral)

@DarkWore (Completar Algumas coisas que ficaram pendentes/erros que surgiram)

@Jair Kevick (Completar problema que estava havendo com o Look)

 

Lembrando Nenhum dos citados oferece suporte ao sistema para erros que surgirem ou qualquer coisa do tipo, até porque ainda existe muita coisa incompleto e que pode ser melhorado nos scripts.

 

pra pda mais old?

 

qero pra a base..

https://xtibia.com/forum/topic/252837-pxm-pfield-open-source-2021

 

Link para o comentário
Compartilhar em outros sites

Em 06/10/2018 em 19:08, DarkWore disse:

Boa Noite gente, Hoje eu venho postar um Sistema de Multi Addon System feito para o data do PDA 1.9 pode funcionar em TFS 0.3.6 com pequenas adaptações, como eu havia dito em outra postagem esse Sistema foi feito por meu Amigo Slicer e tem algumas coisas minhas e de alguns amigos, Bom em outra base aqui no fórum, na base vazada havia esse sistema que o amigo que eu passei passou para esse outro colega, enfim eu conversei com meu Amigo Slicer e decidimos por postar, vamos la.

 

data\actions\scripts crie um arquivo com nome de addon.lua e cole isso dentro:



local addons = {
	-- Shiny Alakazam
	[13089] = {addon_num = 1, pokemon= "Shiny Alakazam", looktype = 2013, nome = "Adventurer addon", fly =  0, ride = 0, surf = 0},
	[13091] = {addon_num = 2, pokemon= "Shiny Alakazam", looktype = 2014, nome = "Grey hat addon", fly =  0, ride = 0, surf = 0},
	[13092] = {addon_num = 3, pokemon= "Shiny Alakazam", looktype = 2016, nome = "Ret hat addon", fly =  0, ride = 0, surf = 0},
	[13090] = {addon_num = 4, pokemon= "Shiny Alakazam", looktype = 2015, nome = "Purple hat addon", fly =  0, ride = 0, surf = 0},
	
	-- Alakazam
	[13093] = {addon_num = 1, pokemon= "Alakazam", looktype = 2009, nome = "Adventurer addon", fly =  0, ride = 0, surf = 0},
	[13095] = {addon_num = 2, pokemon= "Alakazam", looktype = 2010, nome = "Grey hat addon", fly =  0, ride = 0, surf = 0},
	[13096] = {addon_num = 3, pokemon= "Alakazam", looktype = 2012, nome = "Ret hat addon", fly =  0, ride = 0, surf = 0},
	[13094] = {addon_num = 4, pokemon= "Alakazam", looktype = 2011, nome = "Purple hat addon", fly =  0, ride = 0, surf = 0},

	-- Shiny Tropius
	[13101] = {addon_num = 1, pokemon= "Shiny Tropius", looktype = 2019, nome = "Sorcerer addon", fly =  2065, ride = 0, surf = 0},
	[13106] = {addon_num = 2, pokemon= "Shiny Tropius", looktype = 2069, nome = "Desert flower addon", fly =  2070, ride = 0, surf = 0},

	-- Shiny Metagross
	[13098] = {addon_num = 1, pokemon= "Shiny Metagross", looktype = 2021, nome = "King's crown addon", fly =  0, ride = 2064, surf = 0},
	[13099] = {addon_num = 2, pokemon= "Shiny Metagross", looktype = 2020, nome = "Queen's crown addon", fly =  0, ride = 2067, surf = 0},

	-- Shiny Clefable
	[13097] = {addon_num = 1, pokemon= "Shiny Clefable", looktype = 2068, nome = "Angel addon", fly =  0, ride = 0, surf = 0},

	-- Clefable 
	[13102] = {addon_num = 1, pokemon= "Clefable", looktype = 2025, nome = "Angel addon", fly =  0, ride = 0, surf = 0},

	-- Shiny Jynx
	[13100] = {addon_num = 1, pokemon= "Shiny Jynx", looktype = 2023, nome = "Witch addon", fly =  0, ride = 0, surf = 0},

	-- Metagross
	[13103] = {addon_num = 1, pokemon= "Metagross", looktype = 2018, nome = "King's crown addon", fly =  0, ride = 2063, surf = 0},
	[13104] = {addon_num = 2, pokemon= "Metagross", looktype = 2017, nome = "Queen's crown addon", fly =  0, ride = 2066, surf = 0},

	-- Halloween
	[13105] = {addon_num = 1, pokemon= "Elder Charizard", looktype = 2074, nome = "Halloween addon", fly =  2072, ride = 0, surf = 0},
	[13107] = {addon_num = 2, pokemon= "Charizard", looktype = 2073, nome = "Halloween addon", fly =  2071, ride = 0, surf = 0},

	-- Shiny Blastoise
	[13108] = {addon_num = 1, pokemon= "Shiny Blastoise", looktype = 2078, nome = "Purple ninja pack addon", fly =  0, ride = 0, surf = 2083},
	[13109] = {addon_num = 2, pokemon= "Shiny Blastoise", looktype = 2076, nome = "Orange ninja pack addon", fly =  0, ride = 0, surf = 2088},
	[13110] = {addon_num = 3, pokemon= "Shiny Blastoise", looktype = 2075, nome = "Red ninja pack addon", fly =  0, ride = 0, surf = 2090},
	[13111] = {addon_num = 4, pokemon= "Shiny Blastoise", looktype = 2077, nome = "Blue ninja pack addon", fly =  0, ride = 0, surf = 2086},

	-- Blastoise
	[13112] = {addon_num = 1, pokemon= "Blastoise", looktype = 2082, nome = "Purple ninja pack addon", fly =  0, ride = 0, surf = 2083},
	[13113] = {addon_num = 2, pokemon= "Blastoise", looktype = 2080, nome = "Orange ninja pack addon", fly =  0, ride = 0, surf = 2087},
	[13114] = {addon_num = 3, pokemon= "Blastoise", looktype = 2079, nome = "Red ninja pack addon", fly =  0, ride = 0, surf = 2089},
	[13115] = {addon_num = 4, pokemon= "Blastoise", looktype = 2081, nome = "Blue ninja pack addon", fly =  0, ride = 0, surf = 2085},
	
	-- Shiny Gardevoir
	[13320] = {addon_num = 1, pokemon= "Shiny Gardevoir", looktype = 2159, nome = "Witch Apparentice addon", fly =  0, ride = 0, surf = 0},
	[13324] = {addon_num = 2, pokemon= "Shiny Gardevoir", looktype = 2164, nome = "Housekeeper addon", fly =  0, ride = 0, surf = 0},
	[13337] = {addon_num = 3, pokemon= "Shiny Gardevoir", looktype = 2136, nome = "Bride Saint Join addon", fly =  0, ride = 0, surf = 0},
	
	-- Gardevoir
	[13291] = {addon_num = 1, pokemon= "Gardevoir", looktype = 2156, nome = "Witch Apparentice addon", fly =  0, ride = 0, surf = 0},
	[13295] = {addon_num = 2, pokemon= "Gardevoir", looktype = 2161, nome = "Housekeeper addon", fly =  0, ride = 0, surf = 0},
	[13302] = {addon_num = 3, pokemon= "Gardevoir", looktype = 2198, nome = "Bride Saint Join addon", fly =  0, ride = 0, surf = 0},
	
	-- Shiny Spiritomb
	[13322] = {addon_num = 1, pokemon= "Shiny Spiritomb", looktype = 2204, nome = "Green Ballon addon", fly =  0, ride = 0, surf = 0},
	[13345] = {addon_num = 2, pokemon= "Shiny Spiritomb", looktype = 2208, nome = "Orange Ballon addon", fly =  0, ride = 0, surf = 0},
	[13347] = {addon_num = 3, pokemon= "Shiny Spiritomb", looktype = 2163, nome = "Clown Box addon", fly =  0, ride = 0, surf = 0},
	
	-- Spiritomb
	[13293] = {addon_num = 1, pokemon= "Spiritomb", looktype = 2202, nome = "Green Ballon addon", fly =  0, ride = 0, surf = 0},
	[13314] = {addon_num = 2, pokemon= "Spiritomb", looktype = 2206, nome = "Orange Ballon addon", fly =  0, ride = 0, surf = 0},
	[13316] = {addon_num = 3, pokemon= "Spiritomb", looktype = 2200, nome = "Clown Box addon", fly =  0, ride = 0, surf = 0},
	
	-- Shiny Togekiss
	[13321] = {addon_num = 1, pokemon= "Shiny Togekiss", looktype = 2205, nome = "Champion 2016 addon", fly =  2193, ride = 0, surf = 0},
	[13339] = {addon_num = 2, pokemon= "Shiny Togekiss", looktype = 2158, nome = "Superman addon", fly =  2155, ride = 0, surf = 0},
	[13342] = {addon_num = 3, pokemon= "Shiny Togekiss", looktype = 2201, nome = "Piloto addon", fly =  2203, ride = 0, surf = 0},
	
	-- Togekiss
	[13292] = {addon_num = 1, pokemon= "Togekiss", looktype = 2121, nome = "Champion 2016 addon", fly =  2189, ride = 0, surf = 0},
	[13303] = {addon_num = 2, pokemon= "Togekiss", looktype = 2158, nome = "Superman addon", fly =  2160, ride = 0, surf = 0},
	[13308] = {addon_num = 3, pokemon= "Togekiss", looktype = 2162, nome = "Piloto addon", fly =  2183, ride = 0, surf = 0},
	[13309] = {addon_num = 4, pokemon= "Togekiss", looktype = 2179, nome = "Batman addon", fly =  2182, ride = 0, surf = 0},
}

local msgs = {
	return_poke = {
		[0] = "Por favor volte seu pokémon.",
		[1] = "Por favor, vuelve su pokémon.",
		[2] = "Please back your pokémon."
	},
	cant_use = {
		[0] = "Desculpa, você não pode usar esse addon nesse pokémon.",
		[1] = "Lo sentimos, no se puede utilizar este addon en esse pokémon.",
		[2] = "Sorry, you can't use this addon on this pokémon."
	}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if #getCreatureSummons(cid) > 0 then
		doPlayerSendCancel(cid, msgs.return_poke[getPlayerLanguage(cid)])
		return false
	end  
	
	local addonNum = addons[item.itemid].addon_num
	local addon = addons[item.itemid].looktype
	local fly = addons[item.itemid].fly
	local ride = addons[item.itemid].ride
	local surf = addons[item.itemid].surf
	local addonlook = addons[item.itemid].nome
	 
	local pb = getPlayerSlotItem(cid, 8).uid
	local pk = addons[item.itemid].pokemon
	 
	if getItemAttribute(pb, "poke") ~= pk then
		doPlayerSendCancel(cid, msgs.cant_use[getPlayerLanguage(cid)])
		return false
	end
	
	if getItemAttribute(pb, "pokeballusada") == 0 then
		doRemoveItem(item.uid, 1)
		doSendMagicEffect(fromPosition, 173)
		
		updateAddonAttr(pb, "addon"    , addon    , addonNum)
		updateAddonAttr(pb, "addonfly" , fly      , addonNum)
		updateAddonAttr(pb, "addonride", ride     , addonNum)
		updateAddonAttr(pb, "addonsurf", surf     , addonNum)
		updateAddonAttr(pb, "addonlook", addonlook, addonNum)
		
		if not getItemAttribute(pb, "current_addon") then
			doSetItemAttribute(pb, "current_addon", addonNum)
		end
		return true
	end
	return false
end

Ainda em data\actions\scripts em goback.lua procure por:



if useOTClient then
   doPlayerSendCancel(cid, '12//,show') --alterado v1.7
end

Embaixo cole:



-- ADDON SYSTEM
		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

Ainda em data\actions\scripts em order.lua procure por:



doRemoveCondition(cid, CONDITION_OUTFIT)

Embaixo cole:



-- ADDON SYSTEM
		local look = getAddonValue(item.uid, "addon")
		if look > 0 then
			doSetCreatureOutfit(pk, {lookType = look}, -1)
		end

Ainda em data\actions\scripts em surf.lua procure por:



setPlayerStorageValue(cid, 63215, 1)

Embaixo cole:



-- ADDON SYSTEM
        local look = getAddonValue(pb, "addonsurf")
		if look > 0 then
			doSetCreatureOutfit(cid, {lookType = look}, -1)
		else
			doSetCreatureOutfit(cid, pokes[getCreatureName(getCreatureSummons(cid)[1])], -1)
        end

Agora em data\creaturescripts\scripts em login.lua procure por:



doRemoveCondition(cid, CONDITION_OUTFIT)

Embaixo cole:



-- ADDON SYSTEM
		local look = getAddonValue(item.uid, "addonfly")
		if look > 0 then
			doSetCreatureOutfit(cid, {lookType = look}, -1)
		else
			doSetCreatureOutfit(cid, {lookType = flys[poke][1] + 351}, -1)
		end

Ainda em data\creaturescripts\scripts em look.lua procure por:



if getItemAttribute(thing.uid, "nick") then
    table.insert(str, " [Nickname]: "..getItemAttribute(thing.uid, "nick")..". ")
end

Depois do end coloque embaixo:



if getItemAttribute(thing.uid, "addonlook") then
    table.insert(str, "Addons: "..getAddonTotalLook(getItemAttribute(thing.uid, "addonlook")).."\n")
end

Agora em data\lib em order.lua procure por:



setPlayerStorageValue(cid, 54844, speed)

Embaixo cole:



-- ADDON SYSTEM
		local pb = getPlayerSlotItem(cid, 8).uid
		local look = getAddonValue(pb, "addonfly")
		if look > 0 then
			doSetCreatureOutfit(cid, {lookType = look}, -1)
		else
			doSetCreatureOutfit(cid, {lookType = pokemon[1] + 351}, -1)
		end

Ainda em data\lib  crie um arquivo com nome de addon.lua e cole isso dentro:



ADDON_LIMIT = 5 --Limite de addons que um poke pode ter
local ADDON_BASE_STRING = string.rep("0;", ADDON_LIMIT) --String base no formato: "0;0;0;0;0;"

local function checkAddonTableConsistency(tab)
    if #tab < ADDON_LIMIT then --proteção para quando muda o ADDON_LIMIT
        for i = #tab+1, ADDON_LIMIT do
            tab[i] = 0
        end
    end
end

function updateAddonAttr(uid, attr, value, pos)
    local tmp = getItemAttribute(uid, attr) or ADDON_BASE_STRING
    tmp = type(tmp) == "string" and tmp or ADDON_BASE_STRING
    local t = string.explode(tmp, ";")

    checkAddonTableConsistency(t)
    if pos > 0 and pos <= ADDON_LIMIT then
        t[pos] = value
        return doSetItemAttribute(uid, attr, table.concat(t, ";"))
    else
        return false
    end
end

function getAddonValue(uid, attr)
    local tmp = getItemAttribute(uid, attr) or ADDON_BASE_STRING
    tmp = type(tmp) == "string" and tmp or ADDON_BASE_STRING
    tmp = string.explode(tmp, ";")
    local pos = getItemAttribute(uid, "current_addon") or 0

    checkAddonTableConsistency(tmp)
    if pos > 0 and pos <= ADDON_LIMIT then
        return tonumber(tmp[pos])
    else
        return 0
    end
end

function getAddonCount(uid)
  local tmp = getItemAttribute(uid, "addon")
  if type(tmp) ~= "string" then return 0 end
  local t = string.explode(tmp, ";")

  checkAddonTableConsistency(t)
  local count = 0
  for _,v in ipairs(t) do
    if tonumber(v) ~= 0 then count = count + 1 end
  end
  return count
end

function getAddonTotalLook(value)
local str = {}
addonValue = 0
	for addonList = 1, 5 do
	local addons = tostring(value:explode(";")[addonList])
		if addons ~= '0' then
			addonValue = addonValue + 1
		end
	end
addonValue = addonValue == 0 and "Não possui addon." or addonValue
return addonValue
end

Agora em data\talkactions/scripts crie um arquivo com nome de addon_talk.lua e cole isso dentro:



function onSay(cid, words, param)
     
	local pb = getPlayerSlotItem(cid, 8).uid
	local pos = tonumber(param)
	
    if #getCreatureSummons(cid) >= 1 then
	   doPlayerSendCancel(cid, "Volte seu pokemon para a pokebola antes de trocar o addon.")
       return true                                                                                                                        
    end
	
	if not pos then
		doPlayerSendCancel(cid, "O numero do Addon deve ser um valor entre 0 e " ..ADDON_LIMIT.. ".")
		return true
	end

	if pos >= 0 and pos <= ADDON_LIMIT then
		doSetItemAttribute(pb, "current_addon", pos)
	end
	return true
end

Arquivos Completos que eu utilizava, já que o sistema foi feito para a minha base, pode necessitar pequenas adaptações:

data\actions\scripts:

addon.lua 7.81 kB · 64 downloads

goback.lua 5.36 kB · 64 downloads

order.lua 17.42 kB · 58 downloads

surf.lua 6.21 kB · 65 downloads

 

data\creaturescripts\scripts:

login.lua 12.25 kB · 57 downloads

look.lua 8.25 kB · 48 downloads

 

data\lib:

addon.lua 1.76 kB · 58 downloads

order.lua 16.23 kB · 54 downloads

 

data\talkactions\scripts:

addon_talk.lua 655 B · 57 downloads

 

Bom é isso, Só usarem agora, Não se esqueçam de registrar os scripts no xml e os comandos do talkactions, etc.

 

Créditos:

@Slicer (Desenvolvimento em Geral)

@DarkWore (Completar Algumas coisas que ficaram pendentes/erros que surgiram)

@Jair Kevick (Completar problema que estava havendo com o Look)

 

Lembrando Nenhum dos citados oferece suporte ao sistema para erros que surgirem ou qualquer coisa do tipo, até porque ainda existe muita coisa incompleto e que pode ser melhorado nos scripts.

 

[08/03/2021 15:07:48] [Error - LuaScriptInterface::loadFile] data/actions/scripts/goback.lua:304: 'end' expected (to close 'function' at line 21) near 'else'
[08/03/2021 15:07:48] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/goback.lua)
[08/03/2021 15:07:48] data/actions/scripts/goback.lua:304: 'end' expected (to close 'function' at line 21) near 'else'

 

 

agora ja vlw resolvi aqi

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

×
×
  • Criar Novo...