Forum

> > CS2D > Scripts > Press again change text
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Press again change text

10 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Press again change text

Dovahkin
User Off Offline

Zitieren
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 >

alt Re: Press again change text

ExecL
User Off Offline

Zitieren
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.

alt Re: Press again change text

hacked
User Off Offline

Zitieren
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 Datei existiert nicht (10552)
1× editiert, zuletzt 30.09.12 10:42:56

alt Re: Press again change text

Jynxxx
User Off Offline

Zitieren
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

alt Re: Press again change text

danh
User Off Offline

Zitieren
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?

alt Re: Press again change text

Suprise
BANNED Off Offline

Zitieren
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

alt Re: Press again change text

Alistaire
User Off Offline

Zitieren
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

alt Re: Press again change text

Jynxxx
User Off Offline

Zitieren
user Alistaire hat geschrieben
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
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht