English Press again change text

10 replies
Goto Page
To the start Previous 1 Next To the start
30.09.12 10:31:38 am
Up
Dovahkin
User
Offline Off
Uhm. I need help for what im making. Example
Code:
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 >
IMG:http://i561.photobucket.com/albums/ss59/killerboy_04/76561198036665859.png
30.09.12 10:34:57 am
Up
danh
User
Offline Off
Did you get any errors in the console?
What is "enable"?
30.09.12 10:38:16 am
Up
ExecL
User
Offline Off
Code:
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.
30.09.12 10:38:25 am
Up
hacked
User
Offline Off
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 cs2d Double Trigger Test map (2)
edited 1×, last 30.09.12 10:42:56 am
30.09.12 10:39:03 am
Up
Jynxxx
User
Offline Off
Guessing this is what you want.
Code:
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
30.09.12 10:43:27 am
Up
danh
User
Offline Off
Code:
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?
30.09.12 10:44:14 am
Up
Suprise
BANNED
Offline Off
Code:
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
30.09.12 10:46:20 am
Up
Alistaire
User
Offline Off
Actually you should put it like so;

Code:
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
IMG:http://i.imgur.com/5zhwOTP.png
30.09.12 10:48:38 am
Up
danh
User
Offline Off
He's not even online anymore. Just leave him to choose one when he gets back.
30.09.12 11:13:55 am
Up
Jynxxx
User
Offline Off
user Alistaire has written:
Actually you should put it like so;

Code:
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
Code:
1
Dukespeak = 0
30.09.12 11:44:54 am
Up
Dovahkin
User
Offline Off
Thank Blau Burger. That helped.


Thanks everyone for the Replies
IMG:http://i561.photobucket.com/albums/ss59/killerboy_04/76561198036665859.png
To the start Previous 1 Next To the start