function onSay(cid, words, param, channel)
local funcc = doCreateMonster
if(words:sub(2, 2) == "n") then
func = doCreateNpc
end
local pid, t = cid, string.explode(param, ",")
if(t[2]) then
pid = getPlayerByNameWildcard(t[2])
if(not pid) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[2] .. " not found.")
return true
end
end
local position, effect = getCreaturePosition(pid), CONST_ME_MAGIC_RED
errors(false)
local ret = func(t[1], position)
errors(true)
local position, effect = getCreaturePosition(pid), CONST_ME_MAGIC_RED
errors(false)
local ret = funcc(t[1], position)
errors(true)
local position, effect = getCreaturePosition(pid), CONST_ME_MAGIC_RED
errors(false)
local ret = funcc(t[1], position)
local ret = funcc(t[1], position)
local ret = funcc(t[1], position)
local ret = funcc(t[1], position)
local ret = funcc(t[1], position)
local ret = funcc(t[1], position)
local ret = funcc(t[1], position)
local ret = funcc(t[1], position)
errors(true)
if(tonumber(ret) == nil) then
effect = CONST_ME_POFF
doPlayerSendDefaultCancel(cid, (not ret and RETURNVALUE_NOTPOSSIBLE or RETURNVALUE_NOTENOUGHROOM))
end
doSendMagicEffect(position, effect)
return true
end
That spawns as example: 4x4 with demonsYou mean you want a script that spawns 4 creatures in one go?
function onSay(cid, words, param, channel)
local k, v, p = string.explode(param, ","), doCreateMonster, getCreaturePosition(cid)
if(not isPlayer(cid)) then
return true
end
if(isPlayer(cid) and k[1]) then
v(cid,k[1],position)
v(cid,k[1],position)
v(cid,k[1],position)
v(cid,k[1],position)
v(cid,k[1],position)
v(cid,k[1],position)
v(cid,k[1],position)
v(cid,k[1],position)
end
if(not v) then
print("Fail...")
return true
end
return true
end
function onSay(cid, words, param, channel)
local t = string.explode(param, ",")
local count = tonumber(t[2])
if(not count or count < 1) then
count = 15
end
local fromPos, toPos = {x = getCreaturePosition(cid).x -1, y = getCreaturePosition(cid).y -1}, {x = getCreaturePosition(cid).x +2, y = getCreaturePosition(cid).y +2}
local n = 0
local effect = CONST_ME_MAGIC_RED
for x = fromPos.x, toPos.x do
for y = fromPos.y, toPos.y do
position = {x = x, y = y, z = getCreaturePosition(cid).z}
if(not isInRange(getCreaturePosition(cid), position, position)) then
if(n < count) then
n = n + 1
local ret = doCreateMonster(t[1], position, false)
if(tonumber(ret) == nil) then
n = n - 1
effect = CONST_ME_POFF
doPlayerSendDefaultCancel(cid, (ret == false and RETURNVALUE_NOTPOSSIBLE or RETURNVALUE_NOTENOUGHROOM))
end
end
end
end
end
doSendMagicEffect(getCreaturePosition(cid), effect)
return true
end