Xagul
deathzot.net
- Joined
- Jun 30, 2008
- Messages
- 1,294
- Solutions
- 3
- Reaction score
- 1,037
Hello, I've made a script to summon a rat however when there is not enough room it should say "Not enough room" Currently the script I am using works if there is monsters surounding me completly but if there is an item such as a "wall" or "water" then it sends an error to the console and does not say "Not enough room"
Anyone know why this is? Here is my current script:
Anyone know why this is? Here is my current script:
Code:
function onSay(cid, words, param, channel)
local pos = getClosestFreeTile(cid, getCreaturePosition(cid), false, false)
if(not pos or isInArray({pos.x, pos.y}, 0)) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Not enough room.")
return true
end
local tmp = getCreaturePosition(cid)
if(doCreateMonster("Rat", tmp)) then
doCreatureSay(cid, "rats!", TALKTYPE_ORANGE_1, cid)
end
return TRUE
end