local top_left = {x = getPlayerPosition(cid).x - 1, y = getPlayerPosition(cid).y + 1, z = getPlayerPostition(cid).z, stackpos = 255)
local top_middle = {x = getPlayerPosition(cid).x, y = getPlayerPosition(cid).y + 1, z = getPlayerPosition(cid).z, stackpos = 255}
local top_right = {x = getPlayerPosition(cid).x + 1, y = getPlayerPosition(cid).y + 1, z = getPlayerPosition(cid).z, stackpos = 255}
local left = {x = getPlayerPosition(cid).x - 1, y = getPlayerPosition(cid).y, z = getPlayerPosition(cid).z, stackpos = 255}
local right = {x = getPlayerPosition(cid).x + 1, y = getPlayerPosition(cid).y, z = getPlayerPosition(cid).z, stackpos = 255}
local bottom_left = {x = getPlayerPosition(cid).x - 1, y = getPlayerPosition(cid).y - 1, z = getPlayerPosition(cid).z, stackpos = 255}
local bottom_middle = {x = getPlayerPosition(cid).x, y = getPlayerPosition(cid).y - 1, z = getPlayerPosition(cid).z, stackpos = 255}
local bottom_right = {x = getPlayerPosition(cid).x + 1, y = getPlayerPosition(cid).y - 1, z = getPlayerPosition(cid).z, stackpos = 255}
local monsters_top = {top_left, top_middle, top_right}
local magicEffect = CONST_ME_POFF
local allowed_to_spawn = 4
function onSay(cid, words, param, channel)
if(words == "/m") then
if getPlayerAccess(cid) >= allowed_to_spawn then
t = string.explode(param, ",")
t[1] = monster
if (isMonster(monster)) then
if (isMonster(top_left)) then
if (isMonster(top_middle)) then
if (isMonster(top_right)) then
if (isMonster(left)) then
if (isMonster(right)) then
if (isMonster(bottom_left)) then
if (isMonster(bottom_middle)) then
if (isMonster(bottom_right)) then
doTeleportThing(monsters_top, getCreaturePosition(monsters_top).x + 1, true)
doCreateMonster(monster, getPlayerPosition(cid), true)
doSendMagicEffect(monster, magicEffect)
return false
end
else
doCreateMonster(monster, bottom_middle)
doSendMagicEffect(bottom_middle, magicEffect)
return false
end
else
doCreateMonster(monster, bottom_left)
doSendMagicEffect(bottom_left, magicEffect)
return false
end
else
doCreateMonster(monster, right)
doSendMagicEffect(right, magicEffect)
return false
end
else
doCreateMonster(monster, left)
doSendMagicEffect(left, magicEffect)
return false
end
else
doCreateMonster(monster, top_right)
doSendMagicEffect(top_left, magicEffect)
return false
end
else
doCreateMonster(monster, top_middle)
doSendMagicEffect(top_middle, magicEffect)
return false
end
else
doCreateMonster(monster, top_left)
doSendMagicEffect(top_left, magicEffect)
return false
end
else
if (isNpc(monster)) then
if (isMonster(top_left)) then
if (isMonster(top_middle)) then
if (isMonster(top_right)) then
if (isMonster(left)) then
if (isMonster(right)) then
if (isMonster(bottom_left)) then
if (isMonster(bottom_middle)) then
if (isMonster(bottom_right)) then
doTeleportThing(monsters_top, getPlayerPosition(monsters_top).x + 1, true)
end
end
end
end
end
end
end
end
doCreateNpc(monster, getPlayerPosition(cid), true)
doSendMagicEffect(monster, magicEffect)
return false
end
end
else
doPlayerSendCancel(cid, "You cannot create monsters!.")
end
return true
end
return true
end