Forum

> > CS2D > Scripts > How to make ON / OFF Lua scripts?
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch How to make ON / OFF Lua scripts?

7 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt How to make ON / OFF Lua scripts?

Blaster-Blade
User Off Offline

Zitieren
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.

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

Yunuu
User Off Offline

Zitieren
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

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

Talented Doge
User Off Offline

Zitieren
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

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

Bowlinghead
User Off Offline

Zitieren
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
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht