Forum

> > CS2D > Scripts > Menu On/Off script .
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Menu On/Off script .

8 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Menu On/Off script .

lucaSWAT
User Off Offline

Zitieren
I wanted to make a menu and turn off script.

1
2
3
4
5
6
7
8
9
10
11
12
13
sp = 0

[...]
elseif button == 3 then
     if sp == 0 then
          sp = 1
          dofile("sys/lua/scripts/script.lua")
          msg("©000255000Script Activated!")
     elseif sp == 1 then
          sp = 0
          msg("©255000000Script Deactivated!")
     end
[...]

° Told me that something like this if it is not so please help me.

HELP !

alt Re: Menu On/Off script .

oxytamine
User Off Offline

Zitieren
Well, it really makes no sense... It's as simple as that - just call the function when you press the button. Make the function to shut itself automatically, or make another function which will shut it (so you'll call it by pressing another button).

alt Re: Menu On/Off script .

UnkN
User Off Offline

Zitieren
1
2
3
4
5
6
7
8
9
10
11
12
13
14
sp = 0

[...]
elseif button == 3 then
     if sp == 0 then
          sp = 1
          dofile("sys/lua/scripts/script.lua")
          msg("©000255000Script Activated!")
     elseif sp == 1 then
          sp = 0
	parse("luareset")
          msg("©255000000Script Deactivated!")
     end
[...]

It very easy
parse("luareset")

alt Re: Menu On/Off script .

uaiek
User Off Offline

Zitieren
user UnkN hat geschrieben
1
2
3
4
5
6
7
8
9
10
11
12
13
14
sp = 0

[...]
elseif button == 3 then
     if sp == 0 then
          sp = 1
          dofile("sys/lua/scripts/script.lua")
          msg("©000255000Script Activated!")
     elseif sp == 1 then
          sp = 0
	parse("luareset")
          msg("©255000000Script Deactivated!")
     end
[...]

It very easy
parse("luareset")


If you deactivate the script, you won't able to activate it again, even the "©255000000Script Deactivated!" message won't appear too.

alt Re: Menu On/Off script .

Eternal
User Off Offline

Zitieren
Just insert
1
freehook("yourhook","yourname")
below the
1
elseif sp == 1 then
or you may change this
1
dofile("sys/lua/scripts/script.lua")
into this.
1
addhook("yourhook","yourname")

If i am not wrong , this should what you want.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht