• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

TalkAction Remove X Item At X Position

tetra20

DD
Joined
Jan 17, 2009
Messages
1,315
Solutions
4
Reaction score
323
Location
Egypt
I am new in scripting and made a new script>>>^_^ I Was Using it as a flag you can change it(it doesn't Remove Tiles
Code:
function onSay(cid, words, param)
local time = 1 -- in seconds
flagpos = {x=1003, y=995, z=8, stackpos=1}
getflag = getThingfromPos(flagpos)
if doRemoveItem(getflag.uid,1) then
	end
	end
Code:
<talkaction words="!melt" event="script" value="Anything.lua"/>
 
Like when you say .!melt it disappear for X time and appear again
 
Lua:
addEvent(doCreateItem, 20 * 1000, itemid, 1, {x=1003,y=995,z=8})
20 is the time in seconds and instead of itemid write the id of the item that will appear again.
 
@tetra20
You can use function getTileItemById(position, itemID) to find item on tile, then you can use position without stackpos (important for moveable items - someone can pick flag and put something else in that place, your script could remove his item!)
Lua:
function onSay(cid, words, param)
  local time = 20 -- respawn time in seconds
  local flagItemID = 2365 -- flag item ID
  local flagPos = {x=1003, y=995, z=8} -- position without stackpos, we don't need it, TFS will find item on tile by 'item id'
  local flagItem = getTileItemById(flagPos, flagItemID) -- if there is no item with that ID it will return 'item' (table with 4 fields uid, itemid, type, actionid) with all values = 0
-- so you can check it by flagItem.uid, flagItem.itemid - these values must be over 0 if it returned some item
  if flagItem.uid > 0 and doRemoveItem(flagItem.uid) then -- first we check if there is an item (uid of item loaded from tile must be over 0) and then remove
    addEvent(doCreateItem, time * 1000, flagItemID, 1, flagPos) -- it will create item on tile after 'time' seconds
  end
end
 
Back
Top