Forum

> > CS2D > Scripts > How i create a menu
Forums overviewCS2D overview Scripts overviewLog in to reply

English How i create a menu

3 replies
To the start Previous 1 Next To the start

old How i create a menu

Kantos
BANNED Off Offline

Quote
i again ... again... try to making a menu for my script , but i want resolve it , help me, i need this important to
Help me , its sooo sooo important that i can't use the menu with wrong time , i need it now , please help me as u want

old Re: How i create a menu

alex72super
User Off Offline

Quote
Try this one: (its a gun menu)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
addhook('serveraction','serveraction_buymenu')
function serveraction_buymenu(id,act) -- function 1
     if act==1 then
          menu(id,'Buy Guns,Weapons,Buy HP,More HP')
     end
end

function menu_buymenu(id,title,buton) -- function 2
     if title=='Buy Guns' then
          if buton==1 then
               menu(id,'Weapon,Deagle|$500,M3|$1500,M4A1|$3000,AWP|$4000') -- The guns
          end
     end
     if title=='Weapon' then
          if buton==1 then
               if player(id,'money')>=500 then
                    parse('setmoney '..id..' '..player(id,'money')-500) -- Costs
                    parse('equip '..id..' 3')
                    parse('setweapon '..id..' 3')
               else
                    msg('©255000000Not enough money!@C') -- Not enough money
               end
	end
end

old Re: How i create a menu

Rainoth
Moderator Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
addhook("serveraction","sv_a")
function sv_a(id,b) -- ID of player and button pressed
	if b == 1 then
		menu(id,"Called Menu,button 1,button 2")
	else
		menu(id,"Called Menu,button 1,button 2")
	end
end

addhook("menu","c_m")
function c_m(id,t,b) -- ID of player, title of menu, which button is pressed
	if t == "Called Menu" then
		if b == 1
			msg("Player with ID "..id.." pressed menu with title ' "..t.." ' button "..b)
		end
	end
end

This one should work. AND it you should notice how menu is created and how it's called.
@user alex72super: You forgot to enclose an "if"
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview