Manin Mostra O Catch Como Disse Sempre Que Vocé Por Uma Duvida Vocé Bota O Scripter Pra Ajudar.
- Fórum
- OTServ
- Suporte
- Tópicos Sem Resposta
- [Encerrado] Ajuda Pokeball.!
info
Grupo: Infante
Registrado: 06/03/13
Posts: 1.6k
Reputação: +319
Gênero: Masculino
Char no Tibia: Lord Sorte

info
Grupo: Visconde
Registrado: 22/11/12
Posts: 267
Reputação: +26
Gênero: Masculino
Char no Tibia: ADM Kabo

local notAllowed = {"Ferumbras", "Demon"}
local storage = {
status = 25650,
pokeName = 25651
}
local actionid_used = 7510
function onUse(cid, item, fromPos, item2, toPos)
local pokeballStatus = getPlayerStorageValue(cid, storage.status)
local pokeName = getPlayerStorageString(cid, storage.pokeName)
pos = getPlayerPosition(cid) pos.stackpos = 0
if pokeballStatus == -1 then
toPos.stackpos = 253
local pokeThing = getThingfromPos(toPos)
if isCreature(pokeThing.uid) == TRUE then
if isPlayer(pokeThing.uid) == FALSE then
local pokename_ = getCreatureName(pokeThing.uid)
if item.actionid ~= actionid_used then
-- local maxHealth = 400
-- local creatureHealth = getCreatureHealth(pokeThing.uid)
-- local divNum = (string.len(maxHealth)-1)^2
-- local result = math.floor((creatureHealth/divNum)/10)
-- local chance = math.random(1, math.random(4, math.random(7, math.max(result, 7))))
-- if chance == result then
if isInTable(notAllowed, pokename_) == TRUE then
doPlayerSendCancel(cid, "You cannot catch this creature")
else
setPlayerStorageString(cid, storage.pokeName, pokename_)
doRemoveCreature(pokeThing.uid)
doSendDistanceShoot(fromPos, toPos, 37)
setPlayerStorageValue(cid, storage.status, 1)
doSetItemSpecialDescription(item.uid, "it contains a " .. pokename_ .. ".")
doSetItemActionId(item.uid, actionid_used)
end
-- else
-- doSendMagicEffect(fromPos, 2)
-- doPlayerSendCancel(cid, "The Pokemom Escaped")
-- end
elseif item.actionid == actionid_used and pokename_ == pokeName then
doPlayerSay(cid, pokeName .. " Back!!", TALKTYPE_SAY)
doRemoveCreature(pokeThing.uid)
doSetItemSpecialDescription(item.uid, "it contains a " .. pokename_ .. ".")
setPlayerStorageValue(cid, storage.status, 1)
doSendDistanceShoot(fromPos, toPos, 37)
else
doSendMagicEffect(fromPos, 2)
doPlayerSendCancel(cid, "This pokeball is already used")
end
else
doPlayerSendCancel(cid, "You cannot catch this creature")
end
else
doPlayerSendCancel(cid, "Creature not found")
end
elseif pokeballStatus == 1 then
summons = getCreatureSummons(cid)
-- if #summons >= 2 then
-- doPlayerSendCancel(cid, "You cannot call more pokemons")
-- else
doConvinceSummon(cid, pokeName, 0, toPos)
doSendDistanceShoot(fromPos, toPos, 37)
doPlayerSay(cid, pokeName .. " Go!!", TALKTYPE_SAY)
setPlayerStorageValue(cid, storage.status, -1)
doSetItemSpecialDescription(item.uid, "it is empty.")
-- end
end
else
return 1
end
function isInTable(t, val)
for _, v in pairs(t) do
if v == val then
return TRUE
end
end
return LUA_ERROR
end
info
Grupo: Infante
Registrado: 06/03/13
Posts: 1.6k
Reputação: +319
Gênero: Masculino
Char no Tibia: Lord Sorte

Tenta Esse Aki
local notAllowed = {"Ferumbras", "Demon"}
local storage = {
status = 25650,
pokeName = [ { Monster.xml } ]
}
local actionid_used = 7510[/size][/size][/font]
[font=comic sans ms,cursive][size=5][size=4]function onUse(cid, item, fromPos, item2, toPos)
local pokeballStatus = getPlayerStorageValue(cid, storage.status)
local pokeName = getPlayerStorageString(cid, storage.pokeName)
pos = getPlayerPosition(cid) pos.stackpos = 0
if pokeballStatus == -1 then
toPos.stackpos = 253
local pokeThing = getThingfromPos(toPos)
if isCreature(pokeThing.uid) == TRUE then
if isPlayer(pokeThing.uid) == FALSE then
local pokename_ = getCreatureName(pokeThing.uid)
if item.actionid ~= actionid_used then
-- local maxHealth = 400
-- local creatureHealth = getCreatureHealth(pokeThing.uid)
-- local divNum = (string.len(maxHealth)-1)^2
-- local result = math.floor((creatureHealth/divNum)/10)
-- local chance = math.random(1, math.random(4, math.random(7, math.max(result, 7))))
-- if chance == result then
if isInTable(notAllowed, pokename_) == TRUE then
doPlayerSendCancel(cid, "You cannot catch this creature")
else
setPlayerStorageString(cid, storage.pokeName, pokename_)
doRemoveCreature(pokeThing.uid)
doSendDistanceShoot(fromPos, toPos, 37)
setPlayerStorageValue(cid, storage.status, 1)
doSetItemSpecialDescription(item.uid, "it contains a " .. pokename_ .. ".")
doSetItemActionId(item.uid, actionid_used)
end
-- else
-- doSendMagicEffect(fromPos, 2)
-- doPlayerSendCancel(cid, "The Pokemom Escaped")
-- end
elseif item.actionid == actionid_used and pokename_ == pokeName then
doPlayerSay(cid, pokeName .. " Back!!", TALKTYPE_SAY)
doRemoveCreature(pokeThing.uid)
doSetItemSpecialDescription(item.uid, "it contains a " .. pokename_ .. ".")
setPlayerStorageValue(cid, storage.status, 1)
doSendDistanceShoot(fromPos, toPos, 37)
else
doSendMagicEffect(fromPos, 2)
doPlayerSendCancel(cid, "This pokeball is already used")
end
else
doPlayerSendCancel(cid, "You cannot catch this creature")
end
else
doPlayerSendCancel(cid, "Creature not found")
end
elseif pokeballStatus == 1 then
summons = getCreatureSummons(cid)
-- if #summons >= 2 then
-- doPlayerSendCancel(cid, "You cannot call more pokemons")
-- else
doConvinceSummon(cid, pokeName, 0, toPos)
doSendDistanceShoot(fromPos, toPos, 37)
doPlayerSay(cid, pokeName .. " Go!!", TALKTYPE_SAY)
setPlayerStorageValue(cid, storage.status, -1)
doSetItemSpecialDescription(item.uid, "it is empty.")
-- end
end
else[/size][/size][/font]
[font=comic sans ms,cursive][size=5][size=4]return 1
end[/size][/size][/font]
[font=comic sans ms,cursive][size=5][size=4]function isInTable(t, val)
for _, v in pairs(t) do
if v == val then
return TRUE
end
end
return LUA_ERROR
end
outra pergunta qual e o seu serve e pda ?
info
Grupo: Visconde
Registrado: 22/11/12
Posts: 267
Reputação: +26
Gênero: Masculino
Char no Tibia: ADM Kabo

PDA V1.8_f Creditos - Slicer, Stylo Maldoso Modicicaoo.
info
Grupo: Herói
Registrado: 28/11/10
Posts: 3.4k
Reputação: +585
Gênero: Masculino

+ 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.



info
Grupo: Visconde
Registrado: 22/11/12
Posts: 267
Reputação: +26
Gênero: Masculino
Char no Tibia: ADM Kabo
[27/04/2013 00:21:28] [Error - LuaScriptInterface::loadFile] data/actions/scripts/pokeball.lua:67: 'end' expected (to close 'function' at line 8) near 'else'
[27/04/2013 00:21:28] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/pokeball.lua)
[27/04/2013 00:21:28] data/actions/scripts/pokeball.lua:67: 'end' expected (to close 'function' at line 8) near 'else'
Please Ajuda...