function onUse(cid, item, fromPosition, itemEx, toPosition)
-- Lista 1 es de lvl 1 al 10
-- Lista 2 es de lvl 11 al 20
-- Lista 3 es de lvl 21 a 30
-- Lista 4 es de lvl 31 a 50
-- Lista 5 es de lvl 51 a 70
-- Lista 6 es de lvl 71 a 90
-- Lista 7 es de lvl 91 a 100
-- Lista 8 es de lvl 101 a 150
-- Lista 9 es de lvl 151 a 200
-- Lista 10 es de lvl 201 a 300
local lista1 = {
[1] = "Rat",
[2] = "Bug",
[3] = "Deer",
[4] = "Troll",
[5] = "Orc",
}
local lista2 = {
[1] = "Cyclops",
[2] = "Dragon",
[3] = "Wyvern",
[4] = "Dragon Hatchling",
[5] = "Goblin",
}
local lista3 = {
[1] = "Cyclops Drone",
[2] = "Dragon Lord",
[3] = "Squirrel",
[4] = "Rabbit",
}
local lista4 = {
[1] = "Frost Dragon",
[2] = "Demon",
[3] = "Orshabaal",
[4] = "Ghazbaran",
}
local lista5 = {
[1] = "Wild Warrior",
[2] = "Warlock",
[3] = "Necromancer",
[4] = "Ghoul",
[5] = "Demon Skeleton",
}
local lista6 = {
[1] = "Skeleton Warrior",
[2] = "Dragon Lord Hatchling",
[3] = "Frost Dragon Hatchling",
}
local lista7 = {
[1] = "Dragon",
[2] = "Demon",
[3] = "Dragon Lord",
[4] = "Frost Dragon",
[5] = "Goblin",
[6] = "Rat",
[7] = "Pig",
[8] = "Squirrel",
}
local lista8 = {
[1] = "Dragon",
[2] = "Demon",
[3] = "Dragon Lord",
[4] = "Frost Dragon",
[5] = "Goblin",
[6] = "Rat",
[7] = "Pig",
[8] = "Squirrel",
}
local lista9 = {
[1] = "Dragon",
[2] = "Demon",
[3] = "Dragon Lord",
[4] = "Frost Dragon",
[5] = "Goblin",
[6] = "Rat",
[7] = "Pig",
[8] = "Squirrel",
}
local lista10 = {
[1] = "Dragon",
[2] = "Demon",
[3] = "Dragon Lord",
[4] = "Frost Dragon",
[5] = "Goblin",
[6] = "Rat",
[7] = "Pig",
[8] = "Squirrel",
}
local player = getPlayerPosition(cid)
if getPlayerLevel(cid) <= 10 then
if getTilePzInfo(player) == 0 then
doSummonCreature(lista1[math.random(1, #lista1)], player)
doPlayerSendTextMessage(cid,22,"Has convocado un monstruo salvaje!")
doRemoveItem(item.uid,1)else
doPlayerSendCancel(cid,"No puedes usar esto en protection zone.")
end
elseif getPlayerLevel(cid) >= 11 and getPlayerLevel(cid) <= 20 then
if getTilePzInfo(player) == 0 then
doSummonCreature(lista2[math.random(1, #lista2)],player)
doPlayerSendTextMessage(cid,22,"Has convocado un monstruo salvaje!")
doRemoveItem(item.uid,1)else
doPlayerSendCancel(cid,"No puedes usar esto en protection zone.")
end
elseif getPlayerLevel(cid) >= 21 and getPlayerLevel(cid) <= 30 then
if getTilePzInfo(player) == 0 then
doSummonCreature(lista3[math.random(1, #lista3)], player)
doPlayerSendTextMessage(cid,22,"Has convocado un monstruo salvaje!")
doRemoveItem(item.uid,1)
else
doPlayerSendCancel(cid,"No puedes usar esto en protection zone.")
end
elseif getPlayerLevel(cid) >= 31 and getPlayerLevel(cid) <= 50 then
if getTilePzInfo(player) == 0 then
doSummonCreature(lista4[math.random(1, #lista4)], player)
doPlayerSendTextMessage(cid,22,"Has convocado un monstruo salvaje!")
doRemoveItem(item.uid,1)
else
doPlayerSendCancel(cid,"No puedes usar esto en protection zone.")
end
elseif getPlayerLevel(cid) >= 51 and getPlayerLevel(cid) <= 70 then
if getTilePzInfo(player) == 0 then
doSummonCreature(lista5[math.random(1, #lista5)], player)
doPlayerSendTextMessage(cid,22,"Has convocado un monstruo salvaje!")
doRemoveItem(item.uid,1)
else
doPlayerSendCancel(cid,"No puedes usar esto en protection zone.")
end
elseif getPlayerLevel(cid) >= 71 and getPlayerLevel(cid) <= 90 then
if getTilePzInfo(player) == 0 then
doSummonCreature(lista6[math.random(1, #lista6)], player)
doPlayerSendTextMessage(cid,22,"Has convocado un monstruo salvaje!")
doRemoveItem(item.uid,1)
else
doPlayerSendCancel(cid,"No puedes usar esto en protection zone.")
end
elseif getPlayerLevel(cid) >= 91 and getPlayerLevel(cid) <= 100 then
if getTilePzInfo(player) == 0 then
doSummonCreature(lista7[math.random(1, #lista7)], player)
doPlayerSendTextMessage(cid,22,"Has convocado un monstruo salvaje!")
doRemoveItem(item.uid,1)
else
doPlayerSendCancel(cid,"No puedes usar esto en protection zone.")
end
elseif getPlayerLevel(cid) >= 101 and getPlayerLevel(cid) <= 150 then
if getTilePzInfo(player) == 0 then
doSummonCreature(lista8[math.random(1, #lista8)], player)
doPlayerSendTextMessage(cid,22,"Has convocado un monstruo salvaje!")
doRemoveItem(item.uid,1)
else
doPlayerSendCancel(cid,"No puedes usar esto en protection zone.")
end
elseif getPlayerLevel(cid) >= 151 and getPlayerLevel(cid) <= 200 then
if getTilePzInfo(player) == 0 then
doSummonCreature(lista9[math.random(1, #lista9)], player)
doPlayerSendTextMessage(cid,22,"Has convocado un monstruo salvaje!")
doRemoveItem(item.uid,1)
else
doPlayerSendCancel(cid,"No puedes usar esto en protection zone.")
end
elseif getPlayerLevel(cid) >= 201 and getPlayerLevel(cid) <= 300 then
if getTilePzInfo(player) == 0 then
doSummonCreature(lista10[math.random(1, #lista10)],player)
doPlayerSendTextMessage(cid,22,"Has convocado un monstruo salvaje!")
doRemoveItem(item.uid,1)
else
doPlayerSendCancel(cid,"No puedes usar esto en protection zone.")
end
end
return 1
end