Forum

> > CS2D > Scripts > Request about script
Forums overviewCS2D overview Scripts overviewLog in to reply

English Request about script

4 replies
To the start Previous 1 Next To the start

old Request about script

Gajos
BANNED Off Offline

Quote
IMG:img33.imageshack.us/img33/5236/blockn.gif

How do I change the script to:
∗ Now that is the menu:
> 1. Laser
> 2. Super Armor
° I need to make it so the menu:
> 1. Super Armor
> 2. Laser

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
men = {}

men.name = 'Moje menu'
men.items = {
	['Super Armor'] = function(id) parse('setarmor '..id..' 205') end;
	['Laser'] = function(id) parse('equip '..id..' 45') parse('setweapon '..id..' 45') end;
}

men.engine = {}
for _, i in pairs(men.items) do
	table.insert(men.engine,_)
end

addhook('serveraction','men.serveraction')
men.serveraction = function(id,key)
	if key == 1 then
		local str = men.name..','
		local num = 1
		for _, i in pairs(men.items) do
			str = str.._
			if num < #men.engine then
				str = str..','
			end
			num = num + 1
		end
		menu(id,str)
	end
end

addhook('menu','men.menu')
men.menu = function(id,t,b)
	if t == men.name then
		if b > 0 then
			men.items[men.engine[b]](id)
		end
	end
end
edited 1×, last 14.03.13 09:41:09 pm

old Re: Request about script

wotaan
User Off Offline

Quote
1
2
3
4
men.items = {
     ['1.Super Armor'] = function(id) parse('setarmor '..id..' 205') end;
     ['2.Laser'] = function(id) parse('equip '..id..' 45') parse('setweapon '..id..' 45') end;
}
there is always a solution to every problem.

old Re: Request about script

Alistaire
User Off Offline

Quote
user wotaan has written
1
2
3
4
men.items = {
     ['1.Super Armor'] = function(id) parse('setarmor '..id..' 205') end;
     ['2.Laser'] = function(id) parse('equip '..id..' 45') parse('setweapon '..id..' 45') end;
}
there is always a solution to every problem.


That is not a solution. It would look like this in the menu;

1 1.Super Armor
2 2.Laser

This is ugly. What you should do is adding things like;

1
2
3
4
men.items = {
	{name = 'Super Armor', function = yourfunctionetc},
	{name = 'Laser', function = ...}
}
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview