local pets = {"Wolf", "Bear", "Spider", "Scorpion"}
function onCastSpell(cid, var)
local target_name = getCreatureName(variantToNumber(var))
if not isMonster(variantToNumber(var)) then
doPlayerSendCancel(cid, "You can't use this spell on players.")
return true
elseif not isInArray(pets, target_name) then
doPlayerSendCancel(cid, "You can't tame this creature.")
return true
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You successfully tamed "..target_name..".")
setPlayerStorageValue(cid, 3010, table.find(pets, target_name))
return true
end



info
Grupo: Campones
Registrado: 05/06/13
Posts: 19
Reputação: +1
Char no Tibia: Mister M
Gurizada, to morrendo pra descobrir. O objetivo é uma magia que quando usada pega o target e compara com uma tabela, se o target for igual da tabela, ele adiciona uma storage baseada na própria tabela, se nao manda erro.
A tabela se comporta assim: {monstro, monstro, monstro, monstro}
que é lido pela storage como:{1, 2, 3, 4}
porém nao ta funcionando, alguém pode me ajudar ?