Tenta assim:
function onUse(cid, item, frompos, item2, topos)
--##config##--
local ball_id = {"2222","11456","2658","2668","2666","2660","2655","2651","2220","2649","11522"}
local conid1 = 7322 -- id container do pokemon (>)
local conid2 = 7324 -- id container das stones ()
[33333] = {{x=topos.x+1,y=topos.y,z=topos.z},{x=topos.x-1,y=topos.y,z=topos.z}}, -- (/\)
[44444] = {{x=topos.x+1,y=topos.y,z=topos.z},{x=topos.x-1,y=topos.y,z=topos.z}}, -- (/\)
[55555] = {{x=topos.x+1,y=topos.y,z=topos.z},{x=topos.x-1,y=topos.y,z=topos.z}}, -- (/\)
[55551] = {{x=topos.x+1,y=topos.y,z=topos.z},{x=topos.x-1,y=topos.y,z=topos.z}}, -- (/\)
[55552] = {{x=topos.x+1,y=topos.y,z=topos.z},{x=topos.x-1,y=topos.y,z=topos.z}}, -- (/\)
[55553] = {{x=topos.x+1,y=topos.y,z=topos.z},{x=topos.x-1,y=topos.y,z=topos.z}}, -- (/\)
[55554] = {{x=topos.x+1,y=topos.y,z=topos.z},{x=topos.x-1,y=topos.y,z=topos.z}}, -- (/\)
}
local pos, pos2 = p[item.actionid][1],p[item.actionid][2]
local ball = getContainerItem(getTileItemById(pos, conid1).uid,0)
local stones = getContainerItem(getTileItemById(pos2, conid2).uid,0)
if not(ball.uid > 0 and isInArray(ball_id,ball.itemid)) then
return doPlayerSendCancel(cid, "Put a pokemon in the machine.") and doSendAnimatedText(pos, "FAIL.", 210)
end
if not(stones.uid > 0) then
return doPlayerSendCancel(cid, "Place the stone in the machine") and doSendAnimatedText(pos2, "FAIL.", 64)
end
local pokename = getItemSpecialDescription(ball.uid)
local name = getItemAttribute(ball.uid, "poke"):match("This is (.+)'s pokeball.")
if not (boost >= [stones.itemid] or isInArray(stone[stones.itemid].names,nick))then
return doPlayerSendCancel(cid, "Place the stone on the correct machine.")
end
if(pokename:find("\+(%d+)"))then
local boost = pokename:match("\+(%d+)")
local count = math.ceil(boost/pedras[stones.itemid].count)
for i=count-1,0,-1 do
local p = getContainerItem(getTileItemById(pos2, conid2).uid,i)
if not(p.uid > 0 and p.itemid == stones.itemid)then
return doPlayerSendCancel(cid, "You need "..count.." "..getItemName(stones.uid).." to use the machine.")
end
boost = tonumber(boost)
if (boost >= 50) then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your pokemon "..name.." is already the maximum allowed boost") and doSendAnimatedText(pos, "+50", 180)
end
end
for i=count-1,0, -1 do
stones = getContainerItem(getTileItemById(pos2, conid2).uid,i)
doRemoveItem(stones.uid,1)
end
doItemSetAttribute(ball.uid, "description", tostring(pokename:gsub(boost,((tonumber(boost)+1)))))
doSendAnimatedText(pos, "Boosted.", 180) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your Pokemon "..name.." is now + "..boost +1 ..".")
else
doItemSetAttribute(ball.uid, "description", "Contains a "..name.." +1.")
doRemoveItem(stones.uid,1) doSendAnimatedText(pos, "Boosted.", 180) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your Pokemon "..name.." is now + 1")
end
return true
end







info
Grupo: Cavaleiro
Registrado: 23/02/11
Posts: 157
Reputação: +1
Bom primeiro quero pedir se tiver em local errado por favor mover para o local certo.
Meu problema e o seguinte utilizo o script do grande programador Dalvorsn de Boost System estou com 2 problema nesse script se alguém poder me ajudar ficaria muito grado, outra não utilizo o serve PDA então aquele boost não funciona aqui no meu projeto.
Bom um dos erro e na parte da tabela aonde qualquer stone ta boost no pokemon gostaria que cada stone desse boost no pokemon que esta na sua propria tabela
function onUse(cid, item, frompos, item2, topos)
--##config##--
local ball_id = {"2222","11456","2658","2668","2666","2660","2655","2651","2220","2649","11522"}
local conid1 = 7322 -- id container do pokemon (>)
local conid2 = 7324 -- id container das stones (<)
local pedras = {
-- [sTONE_ID] = {pokemons que usam a stone}
--[[Fire]] [2283] = {names = {"Charmander", "Charizard"},count = 3},
--[[Crystal]] [2285] = {names = {"Dragonite"},count = 15},
--[[Enigma]] [2288] = {names = {"Alakazam"},count = 4},
--[[Venom]] [2278] = {names = {"Gloom"},count = 4},
--[[Thunder]] [2279] = {names = {"Electabuzz"},count = 4},
--[[Coccon]] [2284] = {names = {"Scyther", "Scizor"},count = 2},
--[[Leaf]] [2276] = {names = {"Venusaur"},count = 3},
--[[Water]] [2277] = {names = {"Blastoise"},count = 3},
--[[Rock]] [2280] = {names = {"Golem"},count = 3},
--[[Heart]] [2289] = {names = {"Pidgeot"},count = 3},
--[[Darkness]] [2286] = {names = {"Haunter"},count = 4},
--[[Punch]] [2281] = {names = {"Machamp"},count = 4},
--[[boost]] [2361] = {names = {"Omastar"},count = 50},
}
--##end config##--
local p = {
[11111] = {{x=topos.x+1,y=topos.y,z=topos.z},{x=topos.x-1,y=topos.y,z=topos.z}}, -- (/\)
[22222] = {{x=topos.x+1,y=topos.y,z=topos.z},{x=topos.x-1,y=topos.y,z=topos.z}}, -- (>)
[33333] = {{x=topos.x+1,y=topos.y,z=topos.z},{x=topos.x-1,y=topos.y,z=topos.z}}, -- (/\)
[44444] = {{x=topos.x+1,y=topos.y,z=topos.z},{x=topos.x-1,y=topos.y,z=topos.z}}, -- (/\)
[55555] = {{x=topos.x+1,y=topos.y,z=topos.z},{x=topos.x-1,y=topos.y,z=topos.z}}, -- (/\)
[55551] = {{x=topos.x+1,y=topos.y,z=topos.z},{x=topos.x-1,y=topos.y,z=topos.z}}, -- (/\)
[55552] = {{x=topos.x+1,y=topos.y,z=topos.z},{x=topos.x-1,y=topos.y,z=topos.z}}, -- (/\)
[55553] = {{x=topos.x+1,y=topos.y,z=topos.z},{x=topos.x-1,y=topos.y,z=topos.z}}, -- (/\)
[55554] = {{x=topos.x+1,y=topos.y,z=topos.z},{x=topos.x-1,y=topos.y,z=topos.z}}, -- (/\)
}
local pos, pos2 = p[item.actionid][1],p[item.actionid][2]
local ball = getContainerItem(getTileItemById(pos, conid1).uid,0)
local stones = getContainerItem(getTileItemById(pos2, conid2).uid,0)
if not(ball.uid > 0 and isInArray(ball_id,ball.itemid)) then
return doPlayerSendCancel(cid, "Put a pokemon in the machine.") and doSendAnimatedText(pos, "FAIL.", 210)
end
if not(stones.uid > 0) then
return doPlayerSendCancel(cid, "Place the stone in the machine") and doSendAnimatedText(pos2, "FAIL.", 64)
end
local pokename = getItemSpecialDescription(ball.uid)
local name = getItemAttribute(ball.uid, "poke"):match("This is (.+)'s pokeball.")
if not(pedras[stones.itemid] or isInArray(pedras[stones.itemid].names,name))then
return doPlayerSendCancel(cid, "Place the stone on the correct machine.")
end
if(pokename:find("\+(%d+)"))then
local boost = pokename:match("\+(%d+)")
local count = math.ceil(boost/pedras[stones.itemid].count)
for i=count-1,0,-1 do
local p = getContainerItem(getTileItemById(pos2, conid2).uid,i)
if not(p.uid > 0 and p.itemid == stones.itemid)then
return doPlayerSendCancel(cid, "You need "..count.." "..getItemName(stones.uid).." to use the machine.")
end
boost = tonumber(boost)
if (boost >= 50) then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your pokemon "..name.." is already the maximum allowed boost") and doSendAnimatedText(pos, "+50", 180)
end
end
for i=count-1,0, -1 do
stones = getContainerItem(getTileItemById(pos2, conid2).uid,i)
doRemoveItem(stones.uid,1)
end
doItemSetAttribute(ball.uid, "description", tostring(pokename:gsub(boost,((tonumber(boost)+1)))))
doSendAnimatedText(pos, "Boosted.", 180) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your Pokemon "..name.." is now + "..boost +1 ..".")
else
doItemSetAttribute(ball.uid, "description", "Contains a "..name.." +1.")
doRemoveItem(stones.uid,1) doSendAnimatedText(pos, "Boosted.", 180) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your Pokemon "..name.." is now + 1")
end
return true
end
Outro erro e quanto utilizo outro item que nao seja uma stone dentro do container das stones ( id do item 7324) aparece esse erro
[12/11/2012 14:56:07] [Error - Action Interface]
[12/11/2012 14:56:07] data/actions/scripts/boost.lua:onUse
[12/11/2012 14:56:07] Description:
[12/11/2012 14:56:07] data/actions/scripts/boost.lua:46: attempt to index field '?' (a nil value)
[12/11/2012 14:56:07] stack traceback:
[12/11/2012 14:56:07] data/actions/scripts/boost.lua:46: in function <data/actions/scripts/boost.lua:1>
Editado Novembro 12 por Huntre