Forum

> > CS2D > Scripts > [Solved] Menu acting as radio button.
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch [Solved] Menu acting as radio button.

6 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Re: [Solved] Menu acting as radio button.

Ajmin
User Off Offline

Zitieren
Dude sry i dont understand what u are talking about disabling a button is simple like a hell.

Edit :

Not tested also i am not sure if this is the script u need !
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
rad = {}


addhook("spawn","s")
function s(id)
rad[id]=1
menu(id,"Page,"..active(id,1).."|1,"..active(id,2).."|2")
end

function active(id,p)
     if rad[id]==p then
          return "Button(p)"

     else
          return "(Buttton("..p.."))"
     end
end

Here,rad is a table u may increase it with some specific hooks etc..
If rad is not equal to the button , that button will be disabled.
3× editiert, zuletzt 11.04.15 15:40:14

alt Re: [Solved] Menu acting as radio button.

Raaj Nadar
User Off Offline

Zitieren
Did you ever made a html radio buttton.

Like if you saw a registration form of anything there is gender which has two options male ans female we can only select one button at once.

Same like that i want a menu with 3 button and if a person uses 1st button it should be unclick able again until he selects 2nd or 3rd button.

@Ajmin I guess you'r code will work let me test and reply.

alt Re: [Solved] Menu acting as radio button.

Ajmin
User Off Offline

Zitieren
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
rad = {}


addhook("spawn","s")
function s(id)
rad[id]=0
menu(id,"Page,"..active(id,1).."|1,"..active(id,2).."|2")
end

function active(id,p)
     if rad[id]==p then
          return "(Buttton("..p..")) "

     else
          return "Button(p)"
     end
end

This could work then!

alt Re: [Solved] Menu acting as radio button.

Raaj Nadar
User Off Offline

Zitieren
No did not worked!

Can a button be disable with a if situation like a made a level script a person who is above level 5 can access the 2 button.

As soon as he reach level 10 he can access 3rd button also and so on.

alt Re: [Solved] Menu acting as radio button.

Ajmin
User Off Offline

Zitieren
> A small edit of the first code fits the lvl system!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
lvl = {}

addhook("spawn","s")
function s(id)
lvl[id]=2
menu(id,"Page,"..active(id,1).."|1,"..active(id,2).."|2,"..active(id,3).."|3")
end

function active(id,p)
     if lvl[id]>=p then
          return "Button(p)"

     else
          return "(Button("..p.."))"
     end
end



> This fits your radio like button!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
rad = {}

addhook("serveraction","s")
function s(id,a)
if a==1 then
menu(id,"Page,"..active(id,1).."|1,"..active(id,2).."|2")
end
end

addhook("menu","mm")
function mm(id,t,b)
if t=="Page" then
if b<10 then
rad[id]=b
end
end
end

function active(id,p)
     if rad[id]~=p then
          return "Button(p)"

     else
          return "(Buttton("..p.."))"
     end
end

∗ Tested

alt Re: [Solved] Menu acting as radio button.

Raaj Nadar
User Off Offline

Zitieren
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
rad = {}

addhook("serveraction","s")
function s(id,a)
if a==1 then
menu(id,"Page,"..active(id,1).."|1,"..active(id,2).."|2")
end
end

addhook("menu","mm")
function mm(id,t,b)
if t=="Page" then
if b<10 then
rad[id]=b
end
end
end

function active(id,p)
     if rad[id]~=p then
          return "Button(p)"

     else
          return "(Buttton("..p.."))"
     end
end

Yuho the code helped me now i just need to workout with this to comple my script and thanks @user Ajmin:
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht