Forum

> > CS2D > Scripts > Script Request
Forums overviewCS2D overview Scripts overviewLog in to reply

English Script Request

12 replies
To the start Previous 1 Next To the start

old Script Request

Lorenzz
User Off Offline

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

old Re: Script Request

Zurak
User Off Offline

Quote
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.
edited 5×, last 20.07.12 12:04:42 am

old Re: Script Request

Avo
User Off Offline

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

old Re: Script Request

Yates
Reviewer Off Offline

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

old Re: Script Request

Avo
User Off Offline

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

old Re: Script Request

EP
User Off Offline

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

old Re: Script Request

Lorenzz
User Off Offline

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

old Re: Script Request

SkullzOrig
User Off Offline

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

old Re: Script Request

Yates
Reviewer Off Offline

Quote
user SkullzOrig has written
@user Yates: Yours will cause a error violation

Then there is something wrong with your CS2D. I tested it myself beforehand and it worked.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview