Forum

> > CS2D > Scripts > Press again change text
Forums overviewCS2D overview Scripts overviewLog in to reply

English Press again change text

10 replies
To the start Previous 1 Next To the start

old Press again change text

Dovahkin
User Off Offline

Quote
Uhm. I need help for what im making. Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
addhook("menu","lewl")
function lewl(id,title,sel)
	if title == "Duke" then
		if sel == 1 then
			enable					

			msg2(id,"Duke : Hmmmph... Just teamwork -_-")
			Dukespeak[id]= 1
			if Duketold[id] == 0 then
			msg2(id,"Duke : I just told you. Wtf? Man.")
			Duketold[id]= 0
			Dukespeak[id]= 0
			Duketold[id]= 0
			end
		end
	end
end
When you press it the first time it says msg2(id,"Duke : Hmmmph... Just teamwork -_-"). But when you press it again it says msg2(id,"Duke : I just told you. Wtf? Man.") how to do it?.
Spoiler >

old Re: Press again change text

ExecL
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
addhook("menu","lewl")
function lewl(id,title,sel)
     if title == "Duke" then
          if sel == 1 then                  
	 msg2(id,"Duke : Hmmmph... Just teamwork -_-")
            Dukespeak[id]= 1
               elseif Dukespeak[id] == 1 then
			msg2(id,"Duke : I just told you. Wtf? Man.")
		end
	end
end

Try this.

old Re: Press again change text

hacked
User Off Offline

Quote
Why don't just use double trigger system in the map?
You create one trigger_use and another trigger_use.

[DUKE]
[USE1]
[USE2]

Create a trigger_start and trig use2. When player use on use1,it triggers itself and trigger use2.

Use1 leads to the "Duke : Hmmmph... Just teamwork -_-" message.

Use2 leads to the "Duke : I just told you. Wtf? Man." message.

Example: file File does not exist (10552)
edited 1×, last 30.09.12 10:42:56 am

old Re: Press again change text

Jynxxx
User Off Offline

Quote
Guessing this is what you want.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Duke = {}

addhook("join","join")
function join(id)
	Duke[id] = {speak = 0}
end

addhook("menu","menu")
function menu(id,title,button)
	if title == "Duke" then
		if button == 1 then
			if Duke.speak[id] == 0 then
				msg2(id,"Duke : Hmmmph... Just teamwork -_-")
				Duke.speak[id] = 1
			else
				msg2(id,"Duke : I just told you. Wtf? Man.")
			end
		end
	end
end

old Re: Press again change text

danh
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
addhook("menu","lewl")
function lewl(id,title,sel)
	if title == "Duke" then
		if sel == 1 then
			if Duketold[id] == 0 then
				msg2(id, "Duke: Hmmmph... Just teamwork -_-")
				Duketold[id] = 1
			elseif Duketold[id] == 1 then
				msg2(id, "Duke: I just told you. WTF, Man?")
				Duketold[id] = 0 -- Only need one
				Dukespeak[id] = 0
			end
		end
	end
end
What did you need "enable" for?

old Re: Press again change text

Suprise
BANNED Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
addhook("menu","lewl")
function lewl(id,title,button)
	if title == "Duke" then
		if button == 1 then
			if Duketold[id] == 0 then
				msg2(id,"Duke : Hmmmph... Just teamwork -_-")
				Dukespeak[id] = 1
				Duketold[id] = 1
			elseif Duketold[id] == 1 then
				msg2(id,"Duke : I just told you. Wtf? Man.")
				Duketold[id] = 0
				Dukespeak[id] = 0
			end
		end
	end
end

EDIT: too late

old Re: Press again change text

Alistaire
User Off Offline

Quote
Actually you should put it like so;

1
2
3
4
5
6
7
8
9
10
11
12
13
addhook("menu","lewl")
function lewl(id,title,sel)
	if title == "Duke" then
		if sel == 1 then
			if Dukespeak[id] = 1 then
				msg2(id,"Duke : I just told you. Wtf? Man.")
			else
				msg2(id,"Duke : Hmmmph... Just teamwork -_-")
				Dukespeak[id] = 1
			end
		end
	end
end

> easiest

old Re: Press again change text

Jynxxx
User Off Offline

Quote
user Alistaire has written
Actually you should put it like so;

1
2
3
4
5
6
7
8
9
10
11
12
13
addhook("menu","lewl")
function lewl(id,title,sel)
	if title == "Duke" then
		if sel == 1 then
			if Dukespeak[id] = 1 then
				msg2(id,"Duke : I just told you. Wtf? Man.")
			else
				msg2(id,"Duke : Hmmmph... Just teamwork -_-")
				Dukespeak[id] = 1
			end
		end
	end
end

> easiest


You forgot to add
1
Dukespeak = 0
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview