Forum

> > CS2D > Scripts > Menu On/Off script .
Forums overviewCS2D overview Scripts overviewLog in to reply

English Menu On/Off script .

8 replies
To the start Previous 1 Next To the start

old Menu On/Off script .

lucaSWAT
User Off Offline

Quote
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 !

old Re: Menu On/Off script .

oxytamine
User Off Offline

Quote
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).

old Re: Menu On/Off script .

UnkN
User Off Offline

Quote
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")

old Re: Menu On/Off script .

uaiek
User Off Offline

Quote
user UnkN has written
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.

old Re: Menu On/Off script .

Eternal
User Off Offline

Quote
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.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview