Forum

> > CS2D > Scripts > How to detect if player have special armor?
Forums overviewCS2D overview Scripts overviewLog in to reply

English How to detect if player have special armor?

5 replies
To the start Previous 1 Next To the start

old Re: How to detect if player have special armor?

Anders4000
User Off Offline

Quote
Lua function playerweapons(id): Return a table containing the types of all items carried by this player

Guess you can do something like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
iids = playerweapons(id)
function table.contains(table, e1, e2, e3, e4, e5, e6, e7, e8, e9)
	for _, value in pairs(table) do
		if value == e1 or value == e2 or value == e3... then
			return true
		end
	end
	return false
end

if table.contains(iids, IDS, OF, ARMOR, HERE) then
	-- Code
end
edited 2×, last 02.03.12 01:43:10 pm
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview