I am using this script to make an on use item spawn a creature, the help i need is how to make the item delete its self after use. thank for the help.
Problem solved with this script if anyone else has this problem!
Code:
function onUse(cid, item, frompos, item2, topos)
local config = {monster = "demon"}
local dir = getPlayerLookDir(cid)
local pos = getPlayerPosition(cid)
if(dir==1)then
pos.x = pos.x + 1
elseif(dir==2)then
pos.y = pos.y + 1
elseif(dir==3)then
pos.x = pos.x - 1
elseif(dir==0)then
pos.y = pos.y - 1
end
if item.itemid == 2348 then
doCreateMonster(config.monster, pos)
end
return LUA_NO_ERROR
end
Problem solved with this script if anyone else has this problem!
Code:
function onUse(cid, item, frompos, item2, topos)
local config = {monster = "demon"}
local dir = getPlayerLookDir(cid)
local pos = getPlayerPosition(cid)
if(dir==1)then
pos.x = pos.x + 1
elseif(dir==2)then
pos.y = pos.y + 1
elseif(dir==3)then
pos.x = pos.x - 1
elseif(dir==0)then
pos.y = pos.y - 1
end
if getTilePzInfo(pos) == FALSE then
doCreateMonster(config.monster, pos)
doRemoveItem(item.uid, 1)
else
doPlayerSendCancel(cid, "You cannot be in PZ when using this.")
end
return LUA_NO_ERROR
end
Last edited: