Bruce Leal
New Member
- Joined
- Nov 9, 2017
- Messages
- 77
- Reaction score
- 3
Hail,
Hello, this script causes the player to use the "Scroll" item, write the name of the monster, and make it appear. How can I adapt it to the monster disappear in 24 hours
Hello, this script causes the player to use the "Scroll" item, write the name of the monster, and make it appear. How can I adapt it to the monster disappear in 24 hours
Code:
function onUse(cid, item, fromPos)
local cont = getItemAttribute(item.uid, "text") -- nao precisa mexer
local summons = {"demon", "dragon", "dog", "cat", "rotworm", "morgaroth", "cyclops", "dragon lord", "son of verminor", "wolf"} -- monstros disponiveis
function Summon(entity)
if fromPos.x == 65535 and fromPos.y == 64 then
doCreateMonster(entity, getThingPos(cid))
doRemoveItem(item.uid)
doSendMagicEffect(getThingPos(cid), CONST_ME_FIREWORK_YELLOW)
return true
else
doCreateMonster(entity, fromPos)
doRemoveItem(item.uid)
doSendMagicEffect(fromPos, CONST_ME_FIREWORK_YELLOW)
return true
end
return true
end
if cont ~= nil then
local monster = table.concat(cont:exp("%s"), " ")
if isInArray(summons, monster) then
Summon(monster)
return true
else
doPlayerSendCancel(cid, "You can't summon this monster!")
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
end
end
end
function string.exp(e, sep)
local result = {} e:gsub("[^".. sep .."]+", function(s) table.insert(result, s:match("^%s*(.-)%s*$")) end)
return result
end