Forum

> > CS2D > General > Teamchange Script
Forums overviewCS2D overviewGeneral overviewLog in to reply

English Teamchange Script

11 replies
To the start Previous 1 Next To the start

old Teamchange Script

Kebabgamer
User Off Offline

Quote
I'm Searching a TeamChange script if i write !change then all ct's goes to t and all t's goes to ct (only usgn) can do this.

- I Already searched but i dont found one.

greaze

old Re: Teamchange Script

limonata
User Off Offline

Quote
Here you are. Works.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Admin = {xxxxx}

addhook("say","_say")
function _say(id,txt)
for _, usgn in ipairs(Admin) do
if player(id,'usgn') == usgn then
local ct = player(0,"team2")
local t = player(0,"team1")
if txt == "!change" then
for _,ctp in pairs(ct) do
for _,tp in pairs(t) do
parse("makect "..tp)
parse("maket "..ctp)
return 1
end
end
end
end
end
end

old Re: Teamchange Script

Ashelin
BANNED Off Offline

Quote
How about u make one? Just simple Say and Makect hooks n stuff.

More >

old Re: Teamchange Script

Alistaire
User Off Offline

Quote
user limonata has written
Here you are. Works.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Admin = {xxxxx}

addhook("say","_say")
function _say(id,txt)
for _, usgn in ipairs(Admin) do
if player(id,'usgn') == usgn then
local ct = player(0,"team2")
local t = player(0,"team1")
if txt == "!change" then
for _,ctp in pairs(ct) do
for _,tp in pairs(t) do
parse("makect "..tp)
parse("maket "..ctp)
return 1
end
end
end
end
end
end


Why the Christ did you add a loop in a loop. This makes the pairs(t) one run pairs(ct) times.

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
Admins = {
	[20877] = true
}

addhook('say', 'sayHook')

function sayHook(id, txt)
	if txt:sub(1, 1) == '!' or txt:sub(1, 1) == '@' then
		if txt:sub(2) == 'change' and Admins[player(id, 'usgn')] then
			switchTeams()
		else
			msg2(id, '©255100100Not a saycommand')
		end
		return 1;
	end
end

function switchTeams()
	local a, b = player(0, 'team1'), player(0, 'team2')
	for _, id in pairs(a) do
		parse('makect '..id)
		parse('msg2 '..id..' "©000000255Your whole team has been switched to CT"')
	end
	for _, id in pairs(b) do
		parse('maket '..id)
		parse('msg2 '..id..' "©255000000Your whole team has been switched to T"')
	end
end
edited 1×, last 21.05.13 08:16:15 pm

old Re: Teamchange Script

kch
User Off Offline

Quote
I worked a bit today with lua because i'am ill and i have the time :

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
-------------------CS:2D TEAM SWITCH--------------------
--------------------------------------------------------

addhook('say','SayCommands')
function SayCommands(id,message) a = player(id,'usgn')
	for adm = 1,#admins do
		if a == admins[adm] and message == '@lock' then 
		lock_ct=1
		lock_tt=1
		msg('©255000000All Teams are locked!')
		return 1
			elseif a == admins[adm] and message == '@unlock' then 
			lock_ct=0 
			lock_tt=0 
			msg('©000255000All teams were unlocked!')
			return 1
		end
	end
end

addhook("team","OnTeam")
function OnTeam(id,team)
	if team == 1 then
		if lock_tt == 1 then
		msg2(id,"©255000000Teams are unlocked!")
		return 1
	end 
		elseif team == 2 then
			if lock_ct == 1 then
			msg2(id,"©255000000Teams are unlocked!")
			return 1
		end
	end
end

have fun, i tested it - it works!

but you need to change this one :
1
2
for adm = 1,#[u]admins[/u] do
		if a == [u]admins[/u][adm] and message == '@lock' then

There you need to write "the name of your admin list" : i think your list will be like this :
1
Admin = {xxxx}

if you dont know how to change it just use this one :
1
admins = {2422 , xxxxx , xxxxx}
edited 2×, last 22.05.13 01:02:51 pm

old Re: Teamchange Script

omg
User Off Offline

Quote
invictus u idiot, u obviously didnt test it + it wont work well + u didnt even answer the original request

old Re: Teamchange Script

kch
User Off Offline

Quote
user omg has written
invictus u idiot, u obviously didnt test it + it wont work well + u didnt even answer the original request


it works well lol "lock team -> and unlock"
and yea i missunderstand something but it is not a reason to call me as idiot.
To the start Previous 1 Next To the start
Log in to replyGeneral overviewCS2D overviewForums overview