Forum

> > CS2D > Scripts > How to make ON / OFF Lua scripts?
Forums overviewCS2D overview Scripts overviewLog in to reply

English How to make ON / OFF Lua scripts?

7 replies
To the start Previous 1 Next To the start

old How to make ON / OFF Lua scripts?

Blaster-Blade
User Off Offline

Quote
Hello!
Plase help me How to make a ON / OFF The Lua Scripts ? Like On/off Killstreak , On/off Server Title ( Strakkz Admin Scripts ) , On/Off Show Damage.
If you can find the scripts like that , Plase post in this thread!
Thanks you.

old Re: How to make ON / OFF Lua scripts?

Yunu
User Off Offline

Quote
user Avo I think he want something like this
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
messg = "OFF"

addhook("serveraction","yuac")
function yuac(id,act)
if act == 1 then
if messg == "ON" then
messg = "OFF"
elseif messg == "OFF" then
messg = "ON"
end
end
end
addhook("second","yusec")
function yusec()
if messg == "ON" then
msg("12345")
end
end

old Re: How to make ON / OFF Lua scripts?

Talented Doge
User Off Offline

Quote
for example:

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
27
hpshow = 1
Adm = {"131785"}

addhook("hit","_h")
addhook("say","_s")

function _h(vic, src, wpn, dmg)
	if hpshow then
		if src > 0 and src < 33 then
			msg2 (src, "\169255255255-"..dmg.."HP")
		end
	end
end

function _s (p, t)
	for _, usgn in pairs (Adm) do
		if player(p, "usgn") == usgn then
			if t == "!hp" then
				if hpshow == 1 then
					hpshow = 0
				else
					hpshow = 1
				end
			end
		end
	end
end

Wrote this in a minute so it's long like wtf.

You may use
1
2
true
false
instead of
1
2
0
1

old Re: How to make ON / OFF Lua scripts?

Bowlinghead
User Off Offline

Quote
You should know what you need to do!
Create a variable and set it to false whenever you want to stop the part of the script and true whenever you want to allow the part of the script.
Now you just go to your code and write this:
1
2
3
if (variable==true) then
	-- here is your code
end
If you want to have multiple toggle modes you should use numbers
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview