Forum

> > CS2D > Scripts > Lock team script
Forums overviewCS2D overview Scripts overviewLog in to reply

English Lock team script

20 replies
Page
To the start Previous 1 2 Next To the start

old Lock team script

asdx
User Off Offline

Quote
Hi, sorry for the title, I didn't find one more descripting.
I have a script which is used by USGN, and I want to use it without usgn. I wanna use it by RCon. I hope you understand me (srry for my bad English).
The script is this:
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
32
33
34
35
36
37
38
39
40
41
admins = {xxxxx}

lock_ct = {}
lock_tt = {}

addhook("say","Cmd")
function Cmd(id,t)
a = player(id,"usgn")
for adm = 1,#admins do
if a == admins[adm] and t == "@lockct" then
lock_ct=1
msg("©255000000Counter-Terrorist team has been locked!")
return 1
elseif a == admins[adm] and t == "@unlockall" then
lock_ct=0
lock_tt=0
msg("©000255000All teams were unlocked!")
return 1
elseif a == admins[adm] and t == "@lockt" then
lock_tt=1
msg("©255000000Terrorist team has been locked!")
return 1
end
end
end


addhook("team","lol")
function lol(id,team)
if team == 1 then
if lock_tt == 1 then
msg2(id,"©255000000Terrorist team is locked!")
return 1
end 
elseif team == 2 then
if lock_ct == 1 then
msg2(id,"©255000000Counter-Terrorist team is locked!")
return 1
end
end
end

Thank you.

old Re: Lock team script

asdx
User Off Offline

Quote
user Alistaire: You didn't understand me. I want to use the script with RCon. I don't want to change rcon. If you have the server's RCon, you can use this script, and if you haven't the rcon, you can't use this script because you're not an admin.

old Re: Lock team script

asdx
User Off Offline

Quote
user Alistaire: Yes, but I don't wanna use my USGN in-game. I prefer RCon. And another question:

Do you know how to combine these scripts (lock team script with reset score script?:


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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
admins = {xxxxx} 

--Lock team script

lock_ct = {}
lock_tt = {}

addhook("say","Cmd")
function Cmd(id,t)
a = player(id,"usgn")
for adm = 1,#admins do
if a == admins[adm] and t == "@lockct" then
lock_ct=1
msg("©255000000Counter-Terrorist team has been locked!")
return 1
elseif a == admins[adm] and t == "@unlockall" then
lock_ct=0
lock_tt=0
msg("©000255000All teams were unlocked!")
return 1
elseif a == admins[adm] and t == "@lockt" then
lock_tt=1
msg("©255000000Terrorist team has been locked!")
return 1
end
end
end


addhook("team","lol")
function lol(id,team)
if team == 1 then
if lock_tt == 1 then
msg2(id,"©255000000Terrorist team is locked!")
return 1
end 
elseif team == 2 then
if lock_ct == 1 then
msg2(id,"©255000000Counter-Terrorist team is locked!")
return 1
end
end
end


--Reset score

addhook("say","rs")
function rs(p,txt)
	if txt=="!resetscore" or txt=="!rs" then
		if player(p,'deaths')>0 then
			parse("setscore "..p.." 0")
			parse("setdeaths "..p.." 0")
			msg(player(p,"name").." has reseted his/her score.")
		else
			msg2(p,'You have to have at least one death to reset your score.')
		end
		return 1
	end
end


Because when I type !rs, the msg "has reseted his score" is showed, but !rs is appeared too. I hope you understand me. Please solve these two dudes.

old Re: Lock team script

palomino
User Off Offline

Quote
Merge the two say hooks together.

user Alistaire has written
What? You can't use this with Rcon. Rcon can't be changed with Lua scripts.


parse("sv_rcon [rcon]")


Also, using message instead of txt would not help in any way.

old Re: Lock team script

asdx
User Off Offline

Quote
Please give me the script.
How can I merge the two say hooks together?
How can I use the lock team script with/by RCon?
Sry bad English

old Re: Lock team script

Alistaire
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
addhook('say','SayCommands')
function SayCommands(id,message) a = player(id,'usgn')
	if message=='!resetscore' or message=='!rs' then
		if player(id,'deaths')>0 then parse('setscore '..id..' 0') parse('setdeaths '..id..' 0') msg(player(id,'name')..' has reseted his/her score.')
		else msg2(id,'You have to have at least one death to reset your score.')
		end
		return 1
	end
	for adm = 1,#admins do
		if a == admins[adm] and message == '@lockct' then lock_ct=1 msg('©255000000Counter-Terrorist team has been locked!')
			return 1
		elseif a == admins[adm] and message == '@unlockall' then lock_ct=0 lock_tt=0 msg('©000255000All teams were unlocked!')
			return 1
		elseif a == admins[adm] and message == '@lockt' then lock_tt=1 msg('©255000000Terrorist team has been locked!')
			return 1
		end
	end
end

old Re: Lock team script

asdx
User Off Offline

Quote
user Alistaire: Oh thank you. It works. Now if you can, give me the same lock team script, but:
-If you don't have RCon, you are not an admin and you can't use it.
-If you have the server's RCon, you can use it.

Understand me please! (if this is possible).

old Re: Lock team script

Apache uwu
User Off Offline

Quote
I believe player(id,"rcon") returns a boolean
     --> true when player has the rcon via (rcon_pw *)
     --> false when player does not

old Re: Lock team script

Alistaire
User Off Offline

Quote
That would be inconvenient. As admin you have to enter the rcon in the irritating way before you could use the script.

And admins can be corrupt too, they could give your rcon to someone else. You could add a line which makes it unable to say the rcon and kick the person who says it though.

old Re: Lock team script

asdx
User Off Offline

Quote
user Apache uwu: Yes, I want something like that because I never use my usgn in game, and I always use RCon. Can you make this script? (Sorry, I'm not a scripter). I never give RCon to other people.

user Alistaire:
Quote
You could add a line which makes it unable to say the rcon and kick the person who says it though.

Is this possible? Please add this!

old Re: Lock team script

Kirby7
User Off Offline

Quote
I don't know if youre fine with it , but i created a script which "adds" new rcon commands to lock the teams instead of the chatcommands. So take it if you want.
The commands should pretty much explain themselves.

Spoiler >

old untested ...

sheeL
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
admins = {45813,xxxxx,xxxxx} 

function totable(t,match)
if not match then match = "[^%s]+" end
for word in string.gmatch(t, match) do
table.insert(cmd, word)
end
return cmd
end

lock_ct = {}
lock_tt = {}
local cmd = {}

addhook("say","commands")
function commands(id,t)
a = player(id,"usgn")
for adm = 1,#admins do
if a == admins[adm] and t == "@lockct" or cmd "!lockct" then
lock_ct=1
msg("©255000000Counter-Terrorist team has been locked!")
return 1
elseif a == admins[adm] and t == "@unlockall" or cmd "!unlockall" then
lock_ct=0
lock_tt=0
msg("©000255000All teams were unlocked!")
return 1
elseif a == admins[adm] and t == "@lockt" or cmd "!lockt" then
lock_tt=1
msg("©255000000Terrorist team has been locked!")
return 1
end -- close
end -- close 
end -- close


addhook("team","OnTeam")
function OnTeam(id,team)
if team == 1 then
if lock_tt == 1 then
msg2(id,"©000255000Terrorist team is locked!")
return 1
end 
elseif team == 2 then
if lock_ct == 1 then
msg2(id,"©255000000Counter-Terrorist team is locked!")
return 1
end -- close
end -- close
end -- close

addhook("say","reset")
function reset(pl,txt)
     if txt=="!resetscore" or txt=="@resetscore" then
          if player(pl,"deaths")>0 then
               parse("setscore "..pl.." 0 ")
               parse("setdeaths "..pl.." 0 ")
               msg(player(p,"name").." has reseted your score.")
msg(id,"©160160160(player(p,name").." Used @Resetscore ")
          else
               msg2(p,'You have to have at least one death to reset your score.')
          end -- close
          return false
     end -- close
end -- close

old Re: Lock team script

asdx
User Off Offline

Quote
user sheeL:
1
LUA ERROR: sys/lua/samples/main.lua:59: unexpected symbol near '..'
What change did you make/do?
It works with an adminlist. I don't like adminlists.

user Kirby7: Yes, I'm fine with this! But it only works in a dedicated server. Can you do it with a listen server too? The best answer until now.

old Re: Lock team script

Kirby7
User Off Offline

Quote
There you go.
Spoiler >
To the start Previous 1 2 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview