Ir para conteúdo

[Encerrado] Ajuda Pokeball.!


KaboFlow29

Posts Recomendados

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

Link para o comentário
Compartilhar em outros sites

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

Link para o comentário
Compartilhar em outros sites

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 ?

Link para o comentário
Compartilhar em outros sites

  • 4 years later...
A questão neste tópico de 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.
×
×
  • Criar Novo...