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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
weapons_t = {1,2,3,4,5,6}
weapons_ct = {20,21,22,23,24,25}
menu_title = ''
addhook('menu','menus')
function menus(p,m,s)
	if (m == 'T - Select weapon') then
		if itemtype(weapons_t[s],'price') < player(p,'money') then
			msg2(p,'You bought '..itemtype(weapons_t[s],'name')..'!@C')
			parse('setmoney '..p..' '..player(p,'money') - itemtype(weapons_t[s],'price'))
			parse('equip '..p..' '..weapons_t[s])
			parse('setweapon '..p..' '..weapons_t[s])
		else
			msg2(p,'You dont have enough money!@C')
		end
	elseif (m == 'CT - Select weapon') then
		if itemtype(weapons_ct[s],'price') < player(p,'money') then
			msg2(p,'You bought '..itemtype(weapons_ct[s],'name')..'!@C')
			parse('setmoney '..p..' '..player(p,'money') - itemtype(weapons_ct[s],'price'))
			parse('equip '..p..' '..weapons_ct[s])
			parse('setweapon '..p..' '..weapons_ct[s])
		else
			msg2(p,'You dont have enough money!@C')
		end
	end
end
function weapon_menu_t(p)
	local i
	for i = 1, #weapons_t do
		menu_title = menu_title..''..itemtype(weapons_t[i],'name')..'|'..itemtype(weapons_t[i],'price')..'$,'
	end
	menu(p,'T - Select weapon,'..menu_title)
	menu_title = ''
end
function weapon_menu_ct(p)
	local i
	for i = 1, #weapons_ct do
		menu_title = menu_title..''..itemtype(weapons_ct[i],'name')..'|'..itemtype(weapons_ct[i],'price')..'$,'
	end
	menu(p,'CT - Select weapon,'..menu_title)
	menu_title = ''
end
addhook('serveraction','serveractions')
function serveractions(p)
	if (player(p,'team') == 1) then
		weapon_menu_t(p)
	elseif (player(p,'team') == 2) then
		weapon_menu_ct(p)
	end
end