Forum

> > CS2D > Scripts > How does the removeitem work?
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch How does the removeitem work?

5 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt How does the removeitem work?

Mami Tomoe
User Off Offline

Zitieren
Hi this is a question and a problem.
I want to remove a fancy looking snowball at the position of: 98,106

Now I wanted to use this but I have no clue how to use it.

Please help me by explaining how does it work or giving me a easy function to learn from.

Also I really like pens (the blue ones)

alt Re: How does the removeitem work?

Yates
Reviewer Off Offline

Zitieren
You will have to loop through the list of items on the map like so:
1
2
3
4
local itemlist=item(0,"table")
for _,id in pairs(itemlist) do
   print(item(id,"name"))
end

Then once you have found the item
x
and
y
you are looking for you can use that item's
type
to remove it from the map with cs2d cmd removeitem

alt Re: How does the removeitem work?

Cure Pikachu
User Off Offline

Zitieren
@user Yates: Pretty sure you use the item's internal ID to remove an item from the map using cs2d cmd removeitem.

So it would be something like:
1
2
3
4
5
6
7
for _, iid in pairs(item(0,"table")) do
	if item(iid,"exists") and item(iid,"type") == 75 then
		if item(iid,"x") == 98 and item(iid,"y") == 106 then
			parse("removeitem "..iid)
		end
	end
end

alt Re: How does the removeitem work?

Yates
Reviewer Off Offline

Zitieren
@user Cure Pikachu: From the documentation, cs2d lua cmd item has
type
which is referred to as the internal item id.

Or am I confused again with CS2D's way with item ids?

• Edit: Oh, found it!
Zitat
item(0,"table"): returns a Lua table with all dropped item IDs (the unique instance IDs, NOT the type IDs!)

You are correct.
1× editiert, zuletzt 13.07.16 18:41:17

alt Re: How does the removeitem work?

Yates
Reviewer Off Offline

Zitieren
Indeed. These notices need to be a big bigger and brighter if you ask me. I always seem to miss them and I hope I'm not the only one
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht