Forum

> > CS2D > Scripts > items for use, else will not.
Forums overviewCS2D overview Scripts overviewLog in to reply

English items for use, else will not.

2 replies
To the start Previous 1 Next To the start

old items for use, else will not.

Mora
User Off Offline

Quote
Hello all
i wanna ask you, how i can make this:
example we have menu:
1
menu(id,"ae,1,2,3")
we have function of this menu:
1
if title=="ae"... balbalblaa
we have function of button(example 1):
1
if button == 1 then
and here is:
If player have in inventory HE grenade and Flare(example items), then if press button will ok, else if we dont have this items, then by pressin button will tell msg2(id,"You dont have items, for use this button")
Possible it?
Thanks

old Re: items for use, else will not.

Dousea
User Off Offline

Quote
1
2
3
4
5
6
7
function checkitem (id, itemid)
	for key, item in pairs (playerweapons (id)) do
		if (item == itemid) then
			return true
		end
	end
end
1
2
3
4
5
6
7
8
9
if (title == "ae") then
	if (button == 1) then
		if (checkitem (id, 51) and checkitem (id, 54)) then
			-- OK
		else
			msg2 (id, "You don't have one of items for this button")
		end
	end
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview