English Script Request

12 replies
Goto Page
To the start Previous 1 Next To the start
19.07.12 08:46:26 pm
Up
Lorenzz
User
Offline Off
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 like to play CS2d,Sandbox games,and more
19.07.12 11:48:58 pm
Up
Zurak
User
Offline Off
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
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
19.07.12 11:53:05 pm
Up
Avo
User
Offline Off
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 | user DC approved file cs2d Super extra mod for CS2D (64), yeah!
19.07.12 11:56:05 pm
Up
Zurak
User
Offline Off
lol ya many mistakes, i wrote it in like less than 1 minute.
20.07.12 12:02:22 am
Up
Yates
Reviewer
Offline Off
@user Avo: Okay, wtf? - Telling him to do wrong stuff.

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.
20.07.12 12:04:14 am
Up
Zurak
User
Offline Off
i dont have time to test, but ur right.
20.07.12 12:12:14 am
Up
Avo
User
Offline Off
@user Yates: During combining number and string, variable becomes string, so he can use
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 | user DC approved file cs2d Super extra mod for CS2D (64), yeah!
20.07.12 12:36:24 am
Up
Yates
Reviewer
Offline Off
Your shit didn't work, get used to it.
20.07.12 01:33:49 am
Up
EP
User
Offline Off
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
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.
25.07.12 04:30:25 am
Up
Lorenzz
User
Offline Off
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
25.07.12 04:39:00 am
Up
Ahmad
User
Offline Off
Good luck with that.
25.07.12 11:30:10 am
Up
SkullzOrig
User
Offline Off
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.
25.07.12 11:38:14 am
Up
Yates
Reviewer
Offline Off
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