English Is there a way to get all the current items

7 replies
Goto Page
To the start Previous 1 Next To the start
Up
Masea
Super User
Offline Off
The title.

Maybe something like
itemtype(0, "table")
. I haven't tried this though, well it is not documented on the website. I don't mean the items on the ground by the way, more like the item types, all these: http://www.cs2d.com/weapons.php
Create your UI easy and fast: UI Framework | Go deeper into the darkness and test your bravery: file cs2d Outlast II Modification (28)
11.01.20 03:02:51 pm
Up
MikuAuahDark
User
Offline Off
Items doesn't have any ID assigned when it's being held by player. So cs2d lua cmd item(0, "table") only returns all items which is on the ground.
file cs2d LuaJIT for Dedicated Server (11) JIT POWER! | Know your Lua errors! | Draw stuff at Pixelize Art --xx-- server!
11.01.20 03:06:17 pm
Up
Masea
Super User
Offline Off
This is not about cs2d lua cmd item anyway.
Create your UI easy and fast: UI Framework | Go deeper into the darkness and test your bravery: file cs2d Outlast II Modification (28)
11.01.20 03:50:40 pm
Up
MikuAuahDark
User
Offline Off
I'm afraid you have to hardcode the item types manually then.
file cs2d LuaJIT for Dedicated Server (11) JIT POWER! | Know your Lua errors! | Draw stuff at Pixelize Art --xx-- server!
11.01.20 04:57:35 pm
Up
Bowlinghead
User
Offline Off
Code:
1
2
3
4
5
6
7
function printAllItemNames()
     for i=1,91 do
          if item(i,"exists") then
               print(item(i,"name"))
          end
     end
end

This? Didnt understood question tbh
Share time limited free games here
11.01.20 09:34:39 pm
Up
Masea
Super User
Offline Off
@user Bowlinghead: You understood it just fine and I think your code looks like the only way to get it for now. Though that should be
itemtype
instead of
item
. Thanks.
Create your UI easy and fast: UI Framework | Go deeper into the darkness and test your bravery: file cs2d Outlast II Modification (28)
12.01.20 12:02:26 am
Up
Bowlinghead
User
Offline Off
You can store it in a variable and then access it with ipairs or whatever
Share time limited free games here
13.01.20 12:57:49 pm
Up
Gaios
Security Supporter
Offline Off
You should fetch all itemtypes once to a Lua table and then access it via table-index to do faster queries between script and CS2D API.
To the start Previous 1 Next To the start