local challengeMonsters = {
"Demon",
"Rat",
"Bear"
}
function onUse(cid, item, frompos, item2, topos)
local cpos = getCreaturePosition(cid)
local pos = {
[1] = {x=cpos.x-1, y=cpos.y, z=cpos.z, stackpos=253},
[2] = {x=cpos.x-1, y=cpos.y-1, z=cpos.z, stackpos=253},
[3] = {x=cpos.x, y=cpos.y-1, z=cpos.z, stackpos=253},
[4] = {x=cpos.x+1, y=cpos.y, z=cpos.z, stackpos=253},
[5] = {x=cpos.x+1, y=cpos.y+1, z=cpos.z, stackpos=253},
[6] = {x=cpos.x, y=cpos.y+1, z=cpos.z, stackpos=253},
[7] = {x=cpos.x-1, y=cpos.y+1, z=cpos.z, stackpos=253},
[8] = {x=cpos.x+1, y=cpos.y-1, z=cpos.z, stackpos=253}
}
local thing = 0
for i = 1,#pos do
doSendMagicEffect(pos[i], CONST_ME_MAGIC_RED)
local thing = getThingFromPos(pos[i])
if isCreature(thing.uid) then
if isInArray(challengeMonsters,getCreatureName(thing.uid)) then
doChallengeCreature(cid, thing.uid)
end
end
end
return true
end