itemsummon.lua
function onUse(cid, item, fromPosition, itemEx, toPosition)
local tempo = 900 -- Tempo para usar novamente (em segundos)
local storage = 23574 -- storage pra verificar se o player já pode usar novamente
if exhaustion.check(cid, storage) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Mensagem dizendo ao player que ele tem que esperar")
return true
end
exhaustion.set(cid, storage, tempo)
local func = doCreateMonster
local position = getCreaturePosition(cid)
local effect = CONST_ME_MAGIC_RED
local creature = "Rat" -- Nome da criatura a ser summonada
local ret = func(creature, position, false)
if(tonumber(ret) == nil) then
effect = CONST_ME_POFF
doPlayerSendDefaultCancel(cid, (ret == false and RETURNVALUE_NOTPOSSIBLE or RETURNVALUE_NOTENOUGHROOM))
end
doSendMagicEffect(position, effect)
return true
end
Actions.xml
<action itemid="xxxx" script="itemsummon.lua" />