Forum

> > CS2D > Scripts > Lock team script
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Lock team script

20 Antworten
Seite
Zum Anfang Vorherige 1 2 Nächste Zum Anfang

alt Lock team script

asdx
User Off Offline

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

alt Re: Lock team script

asdx
User Off Offline

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

alt Re: Lock team script

asdx
User Off Offline

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

alt Re: Lock team script

palomino
User Off Offline

Zitieren
Merge the two say hooks together.

user Alistaire hat geschrieben
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.

alt Re: Lock team script

asdx
User Off Offline

Zitieren
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

alt Re: Lock team script

Alistaire
User Off Offline

Zitieren
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

alt Re: Lock team script

asdx
User Off Offline

Zitieren
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).

alt Re: Lock team script

Apache uwu
User Off Offline

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

alt Re: Lock team script

Alistaire
User Off Offline

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

alt Re: Lock team script

asdx
User Off Offline

Zitieren
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:
Zitat
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!

alt Re: Lock team script

Kirby7
User Off Offline

Zitieren
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 >

alt untested ...

sheeL
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
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

alt Re: Lock team script

asdx
User Off Offline

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

alt Re: Lock team script

Kirby7
User Off Offline

Zitieren
There you go.
Spoiler >
Zum Anfang Vorherige 1 2 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht