• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Item remove, script help

jixi

Complete Noob
Joined
Sep 5, 2010
Messages
25
Reaction score
0
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.



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:
Lua:
  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)
        doRemoveItem(item.uid, 1)	
end
return LUA_NO_ERROR
end
 
OMG thank you so much! haha i figured the rest out it was jsut the remove item i didn't know how to do. thanks so much
 
Lua:
 function onUse(cid, item, frompos, item2, topos)

local config = {monster = "demon"}
local position = getPlayerPosition(cid)
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 and getTilePzInfo(position) == 0 then
        doCreateMonster(config.monster, pos)
        doRemoveItem(item.uid, 1)
        else
        doPlayerSendCancel(cid, "You need to be in pz to use this")		
end
return LUA_NO_ERROR
end

this should work.
 
Lua:
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
wow didnt even notice what i did before but it was wrong, and this should work.
 
Last edited:
Back
Top