Script Request
12 replies



19.07.12 08:46:26 pm
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.
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.
I like to play CS2d,Sandbox games,and more

Code:
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
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
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
Code:
1
if txt == "!'..password..'" then
Wrong. You set here password
Code:
1
!'..pasword..'
Fix this:
Code:
1
"!'..password..'"
To:
Code:
1
"!"..password
EDIT*
Another error found. You declaired a variable and function with the same name (pass)
Trust me, I'm an engineer |
DC approved
Super extra mod for CS2D (64), yeah!



@
Avo: Okay, wtf? - Telling him to do wrong stuff.
1. Use this.
2. Use this.
3. Don't listen to someone without testing it first.

1. Use this.
Code:
1
password = "123"
2. Use this.
Code:
1
if txt == "!"..password.."" then
3. Don't listen to someone without testing it first.
@
Yates: During combining number and string, variable becomes string, so he can use
If password will contain only number, if not:
Is correct, too.

Code:
1
password=123
If password will contain only number, if not:
Code:
1
password="pass123"
Code:
1
if txt == "!"..password.."" then
Is correct, too.
Trust me, I'm an engineer |
DC approved
Super extra mod for CS2D (64), yeah!



Code:
Works, change the variable "password" to the password you want. 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
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
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
Wow, wow.. Thanks guys! I'll try one by one, and thank you very much, to everyone who posted here!
I like to play CS2d,Sandbox games,and more

Eww, you all failed.
@
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.
@
Yates: Yours will cause a error violation
@
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.
@

Make sure to test your stuff out.
@

@

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.

@
Yates: Yours will cause a error violation

Then there is something wrong with your CS2D. I tested it myself beforehand and it worked.



