Forum

> > CS2D > Scripts > Script Request
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Script Request

12 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Script Request

Lorenzz
User Off Offline

Zitieren
Hello, fellow players! I'm completely newbie at Lua or any other kind of Scripting. I'd like to request an Script for my server in CS2D. An simple Team Script.
I'd like an Script that makes all the players spawn automatically in Terrorist, and only who has an password set by the Admin, can get into the Counter Terrorist force.
Basically, the CT team is Password protected.
Thank you for your patience gentlemen, i'll be waiting for it!
Thanks.

alt Re: Script Request

Zurak
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
27
28
29
30
31
able = {}
password = "123" --Your Password.

addhook("join","join")
function join(id)
	able[id] = 0
end

addhook("say","pass")
function pass(id,txt)
	if txt == "!'..password..'" then
	able[id] = 1
	return 0
end

addhook("changeteam","change")
function change(id,team)
	if team == 0 then
		local lock = 0
	elseif team == 2 then
		if able[id] == 1 then
			local lock = 0
		elseif able[id] == 0 then
			local local = 1
			msg2(id,"you dont have access to join CT")
		end
	elseif team == 1 then
		local lock = 0
	end
	return lock
end
i think this is it, some1 correct me if i'm wrong.
5× editiert, zuletzt 20.07.12 00:04:42

alt Re: Script Request

Avo
User Off Offline

Zitieren
1
if txt == "!'..password..'" then
Wrong. You set here password
1
!'..pasword..'

Fix this:
1
"!'..password..'"
To:
1
"!"..password

EDIT*

Another error found. You declaired a variable and function with the same name (pass)

alt Re: Script Request

Yates
Reviewer Off Offline

Zitieren
@user Avo: Okay, wtf? - Telling him to do wrong stuff.

1. Use this.
1
password = "123"
2. Use this.
1
if txt == "!"..password.."" then
3. Don't listen to someone without testing it first.

alt Re: Script Request

Avo
User Off Offline

Zitieren
@user Yates: During combining number and string, variable becomes string, so he can use
1
password=123
If password will contain only number, if not:
1
password="pass123"

1
if txt == "!"..password.."" then
Is correct, too.

alt Re: Script Request

EP
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
27
password = "asdf"
allowed = {}
addhook("join","a")
function a(id)
	allowed[id] = false
end
addhook("say","b")
function b(id,txt)
	if txt:sub(1,5) == "!pass" then
		if txt:sub(7,7+#password) == password then
			msg2(id,"©000255000You have entered the correct password!")
			allowed[id] = true
			return 1
		end
		msg2(id,"©255000000Incorrect pass!")
		return 1
	end
end
addhook("team","c")
function c(id,t)
	if t == 2 then
		if allowed[id] then
			return 0
		end
		return 1
	end
end
Works, change the variable "password" to the password you want.

alt Re: Script Request

Lorenzz
User Off Offline

Zitieren
Wow, wow.. Thanks guys! I'll try one by one, and thank you very much, to everyone who posted here!

alt Re: Script Request

SkullzOrig
User Off Offline

Zitieren
Eww, you all failed.

@user Avo: you are just wrong you are editing wrong part, the part that is incorrect is the password, and you you all forgot if password wrong then [id] join t

Make sure to test your stuff out.

@user Yates: Yours will cause a error violation

@user Zurak: Yeah, just stop. Please go work on different script.

And yes I have tested all of yours, you all seem to forget to add a hook for the usgn player to join ct if he has enter the password correct.

alt Re: Script Request

Yates
Reviewer Off Offline

Zitieren
user SkullzOrig hat geschrieben
@user Yates: Yours will cause a error violation

Then there is something wrong with your CS2D. I tested it myself beforehand and it worked.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht