• 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!

delete item by aid

Coca Cola

New Member
Joined
Apr 10, 2010
Messages
164
Reaction score
0
how can i do an comand like this :

/del aid

ex : /del 120 , and the any item with aid 120 in server gets deleted
 
Not possible to locate item by AID - You would have to loop entire map, inventory of players and content of containers.
 
how could i do that ? i've made the comand to set the uid already
Code:
function onSay(cid, words, param, channel)
 if(param == "") then
 doPlayerSendCancel(cid, "You have to type a value.")
 return true 
end 
local pos = getCreatureLookPosition(cid)
 pos.stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE 
local item = getThingFromPos(pos).uid
 if(item) then
doItemSetAttribute(item, "uid", param)
end 
return true
 end
 
LUA:
function onSay(cid, words, param, channel)
	if param == "" then
		doPlayerSendCancel(cid, "You have to type a value.")
	elseif not tonumber(param) then
		doPlayerSendCancel(cid, "You must enter a numeric value.")
	else
		local pos = getCreatureLookPosition(cid)
		pos.stackpos = 255
		local item = getThingFromPos(pos, false).uid
		if item > 0 and not isCreature(item) then
			doItemSetAttribute(item, 'uid', tonumber(param))
		else
			doPlayerSendCancel(cid, "Item not found.")
		end
	end	
	return true
end
Script for removing:
LUA:
function onSay(cid, words, param, channel)
	if param == "" then
		doPlayerSendCancel(cid, "You have to type a value.")
	elseif not tonumber(param) then
		doPlayerSendCancel(cid, "You must enter a numeric value.")
	else
		local v = getThing(tonumber(param)).uid
		if v > 0 then
			doRemoveItem(v)
			doPlayerSendCancel(cid, "Item with UID " .. param .. " has been removed.")
		else
			doPlayerSendCancel(cid, "Item not found.")
		end
	end	
	return true
end
You can't have 2 items with same UID :(
 
Last edited:
Back
Top