Forum

> > CS2D > Scripts > Menu
Forums overviewCS2D overview Scripts overviewLog in to reply

English Menu

13 replies
To the start Previous 1 Next To the start

old Menu

Flame
BANNED Off Offline

Quote
addhook("serveraction","info")
function info(id,act)
if act==2 then
menu(id,"Information,Mapper,Scripter")
end
end

how to make when you press Mapper or Scripter it displays a message

old Re: Menu

Yates
Reviewer Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
addhook("menu","stuff")
function stuff(id,button,title)
	if title=="Information" then
		if button==1 then
			msg2(id,"Your message here")
		elseif button==2 then
			msg2(id,"Your message here")
		end
	end
end
You forgot to add the menu. You only added the serveraction to open it.

old Re: Menu

3RROR
User Off Offline

Quote
user Flame has written
addhook("serveraction","info")
function info(id,act)
if act==2 then
menu(id,"Information,Mapper,Scripter")
end
end

how to make when you press Mapper or Scripter it displays a message


1
2
3
4
5
6
7
8
9
10
addhook("serveraction","info")
function info(id,act,men)
if act==2 then
menu(id,"Information,Mapper,Scripter")
if men == [[Mapper] then
parse(msg "Textwhatyouwant")
end
if men == [[Scripter] then -- Continue
end
end
I guess it's that way
edited 4×, last 17.09.11 08:51:18 pm

old Re: Menu

Yates
Reviewer Off Offline

Quote
@Tauma Tizer, I'm not sure if that will work. As the addhook should (I don't know this for sure) be menu.
AND PLEASE TAB YOUR CODE

I'm not sure the script will work at all. Why did you add an end in the middle of the code, and where is the message for button 2?

AND WHAT THE FUCK IS if men == [[mapper] then !?

old Re: Menu

Yates
Reviewer Off Offline

Quote
I find your "Lua" very confusing. Seriously. I don't understand what you just wrote.

old Re: Menu

Flame
BANNED Off Offline

Quote
Yates you're dont work ;/

old Re: Menu

Yates
Reviewer Off Offline

Quote
What? It should. Add it under your lua. Don't just use mine, then of course it wouldn't work.

Edit: Ah, wait. Change title and button around.
Here, paste this over the original function (The lua I posted);
1
function stuff(id,title,button)
I had a problem once with id and team, I changed them around and it worked. Maybe this is the case here aswell.
edited 1×, last 17.09.11 09:18:50 pm

old Re: Menu

Flacko
User Off Offline

Quote
You've got the parameters order wrong.
title is the second argument while button is the third.

edit: whoops, too late

old Re: Menu

Yates
Reviewer Off Offline

Quote
user Flacko has written
title is the second argument while button is the third.

Why, actually?

old Re: Menu

Yasday
User Off Offline

Quote
Because DC made it like this.

old Re: Menu

Flacko
User Off Offline

Quote
user Yates has written
user Flacko has written
title is the second argument while button is the third.

Why, actually?


Because CS2D passes the values in that order.
The way you name the variables that hold these values doesn't really matter.
The only thing that really matters is that the second parameter of the hook is the menu title and the third one is the clicked button.

old Re: Menu

Flame
BANNED Off Offline

Quote
So can anybody tell me the right script ?

old Re: Menu

Yates
Reviewer Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
addhook("menu","stuff")
function stuff(id,title,button) -- Title and button have been switched.
	if title=="Information" then
		if button==1 then
			msg2(id,"Your message here")
		elseif button==2 then
			msg2(id,"Your message here")
		end
	end
end
Use this with your script.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview