• 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 Trash Control

Radium

Frozen-Hell.com
Joined
Nov 20, 2010
Messages
248
Reaction score
11
Location
England
Ever had someone trash your server's depot? Or trash houses? Well instead of wasting your time by using "/r", you can use this.

There are 2 options within the script.
Code:
/trash all
Which will remove all movable objects on the tile you are looking at.

OR

Code:
/trash ids, itemid, itemid2, etc
Which will remove movable objects on the tile you are looking at ONLY if you have specified it within the command.

There is a table in the script called "valubleitems", if you add the valuble items that you do not want to remove at all such as donors, when you use "/trash all" it will not remove any of the items in that table.


Talkactions.XML
Code:
<talkaction log="yes" words="/trash" access="3" event="script" value="trashremove.lua"/>
trashremove.lua
Code:
function onSay(cid, words, param, channel)

local valubleitems = {
	9971, --100gb
	8887, --frzoenplate
	6527, --frozencoin
	6536, --tear of beatrice
    6119,  -- teleport scroll
    9969,  -- Skull Remover
    7708, -- Manashield Ring
	8983,  -- Merlin's Deathbook
	10223, -- Fishmaster Deluxe c5000
	8851, --Immortal Archers Crossbow 
	4445, --Immortal Archers Legs
	4444, --Immortal Archers Armor
	4443, --Immortal Archers Helmet
	7735,  --Immortal Mages Wand
	4448, --Immortal Mages Robe
	4447, --Immortal Mages Hat
    4449, --Immortal Mages Legs
	4446, --Immortal Spellbook of Destruction
	4442, --Immortal Archers Shield
	4450, --Immortal Knights Shield
	4451, --Immortal Knights Helmet
	4452, --Immortal Knights Armor
	4453, --Immortal Knights Legs
	7405, --Immortal Knights Longsword
    7863, --Immortal Knights Waraxe
    7422, --Immortal Knights Warhammer
    2196, --Amulet of Never-Ending Loss
	10306 --Outfit Doll
}

local t = string.explode(param, ",")
local trashids = {}
pos = getCreatureLookPosition(cid)

	if not(t[1] == 'all' or t[1] == 'ids') then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Use format: /trash all OR /trash ids, itemid, itemid2, etc.")
		return true
	end

	if(t[1] == 'all') then
		if getThingFromPos(pos).uid ~= 0 then 
			pos.stackpos = 255 
			while isCreature(getThingFromPos(pos).uid) ~= true and getThingFromPos(pos).itemid > 0 and hasProperty(getThingFromPos(pos).uid, 6) == true and isInArray(valubleitems, getThingFromPos(pos).itemid) == false do 
				if getThingFromPos(pos).type ~= 0 then 
					doRemoveItem(getThingFromPos(pos).uid, getThingFromPos(pos).type) 
				else 
					doRemoveItem(getThingFromPos(pos).uid, 1) 
				end 
			end         
		end 
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You removed all the trash items from the tile infront of you.")
	elseif(t[1] == 'ids') then
		for i = 2, #t do 
			table.insert(trashids, t[i])
		end
		if getThingFromPos(pos).uid ~= 0 then 
			pos.stackpos = 255 
			while isCreature(getThingFromPos(pos).uid) ~= true and getThingFromPos(pos).itemid > 0 and hasProperty(getThingFromPos(pos).uid, 6) == true and isInArray(trashids, getThingFromPos(pos).itemid) == true do 
				if getThingFromPos(pos).type ~= 0 then 
					doRemoveItem(getThingFromPos(pos).uid, getThingFromPos(pos).type) 
				else 
					doRemoveItem(getThingFromPos(pos).uid, 1) 
				end 
			end         
		end 
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You removed the items you specified in the command.")
	return true
	end
return true
end
 
Please inform me, what the hell is the point in using "/clean tile" or even "/r all" on a depot when it will clear every item on it...

The whole point of the script is to be able to NOT lose valuble items of players.
 
why would players throw donor items to the ground?
if they do, they clearly don't want them..
 
if ppl throw stuff in ur house, you shoud close the door/windows
only gms would use that command, right? I wouldnt want my players always calling me to clean their depot locker tile if ppl threw stuff to it
 
Back
Top