Forum

> > CS2D > Scripts > get itemid (not type id of weapon)
Forums overviewCS2D overview Scripts overviewLog in to reply

English get itemid (not type id of weapon)

3 replies
To the start Previous 1 Next To the start

old get itemid (not type id of weapon)

iii
User Off Offline

Quote
I have a problem with finding the item id for the Command item.
i try to get information about the zoom mode of a sg550. i think i can get it with item(id,"mode"). but when i go through the first 500 weapen id's and use the value exists on this command it is always false. do you know how i can solve this problem?

old Re: get itemid (not type id of weapon)

EngiN33R
Moderator Off Offline

Quote
@user Near: It's a little different.

The key thing that prevents me from helping you properly is how you put the problem. You try to get information about the zoom mode of an SG550. Do you know which one that SG550 is? In this case the indefinite article implies you don't really know which weapon it is.

In short: the mode of which SG550 are you trying to get? Here I assume that you know who the SG550 belongs to:

1
2
3
4
5
6
7
8
9
10
11
function getPlayerWeaponMode(weapon,player) -- weapon is the weapon type id, player is the player id
	for _,v in pairs(item(0,"table")) do
		if item(v,"type")==weapon then
			if item(v,"player")==player then
				return item(v,"mode")
			end
		end
	end
end

mode = getPlayerWeaponMode(37,1) -- get the mode of the SG550 that belongs to player with the ID 1

old Re: get itemid (not type id of weapon)

iii
User Off Offline

Quote
user EngiN33R has written
You try to get information about the zoom mode of an SG550.

You guessed right, that i wanted to say.

but your solution don't work, i already tested it.
item(0,"table") return only dorpped weapons.

i think i found a solution. if you zoom you tiggered attack 2. i will save this data and work with it.
anyway thank you
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview