Forum

> > CS2D > Scripts > lua that can change player to another team...
Forums overviewCS2D overview Scripts overviewLog in to reply

English lua that can change player to another team...

8 replies
To the start Previous 1 Next To the start

old Re: lua that can change player to another team...

Apache uwu
User Off Offline

Quote
Like 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
parse("mp_deathdrop 4")
parse("mp_autoteambalance 0")
addhook("say","_say")

function _say(id,message)
	if string.lower(message)=="change me" then
		toggleTeam(id)
	end
end

function toggleTeam(id)
	if player(id,"team")~=0 then
		if player(id,"health")>0 then
			pos={player(id,"x"),player(id,"y")}
			if player(id,"team")==1 then
				parse("makect "..id)
			else
				parse("maket "..id)
			end
			parse("setdeaths "..id.." "..player(id,"deaths")-1)
			parse("spawnplayer "..id.." "..pos[1].." "..pos[2])
		end
	end
end

Simply say "change me" to change teams quickly.

old Perfect !

EP
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
66
67
68
69
70
71
72
parse("sv_friendlyfire 1")

function hudtext2(id,tid,color,txt,x,y)
     local toprint = ("©"..color.." "..txt)
     parse('hudtxt2 '..id..' '..tid..' "'..toprint..'" '..x.." "..y)
end

function teamhud(id)
if teamid[id]==1 then
hudtext2(id,id+1,"255000000","Team :-RED-",500,314)
elseif teamid[id]==2 then
hudtext2(id,id+1,"000000255","Team :-BLUE-",500,314)
end
end

function Array(size,value) 
    local array = {}
    for i = 1, size do
        array[i]=value
    end
    return array
end

teamid = Array(32,0)

addhook("team","a")
function a (id,team)
if teamid[id]==0 then
msg2(id,"©255000000You must choose a team to join the game!")
return 1
end
end

addhook("serveraction","b")
function b(id,act)
if act == 1 then
	menu(id,"Choose Team,Red,Blue")
	end
end

addhook("menu","c")
function c(id,title,button)
if title == "Choose Team" then
	if button == 1 then
		teamid[id]=1
		msg2(id,"©000255000You chose the RED Team!")
		teamhud(id)
	elseif button == 2 then
		teamid[id]=2
		msg2(id,"©000255000You chose the BLUE Team!")
		teamhud(id)
	end
end
end

addhook("hit","d")
function d(id,source)
if teamid[id]==1 and teamid[source]==1 then
return 1
elseif teamid[id]==1 and teamid[source]==2 then
return 0
elseif teamid[id]==2 and teamid[source]==2 then
return 1
elseif teamid[id]==2 and teamid[source]==1 then
return 0
end
end

addhook("join","e")
function e(id)
menu(id,"Choose Team,RED,BLUE")
end
Very Fun!!!, You choose a team when you join an you start to kill the guys of the other teams, if you did not choose a team you can't join to the game ;(. To choose a Team use F2. Good luck.

old Re: lua that can change player to another team...

robed
User Off Offline

Quote
user Apache uwu has written
Like 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
parse("mp_deathdrop 4")
parse("mp_autoteambalance 0")
addhook("say","_say")

function _say(id,message)
	if string.lower(message)=="change me" then
		toggleTeam(id)
	end
end

function toggleTeam(id)
	if player(id,"team")~=0 then
		if player(id,"health")>0 then
			pos={player(id,"x"),player(id,"y")}
			if player(id,"team")==1 then
				parse("makect "..id)
			else
				parse("maket "..id)
			end
			parse("setdeaths "..id.." "..player(id,"deaths")-1)
			parse("spawnplayer "..id.." "..pos[1].." "..pos[2])
		end
	end
end

Simply say "change me" to change teams quickly.


very thanks! i was just making an antidote for zombie plauge!. and it did work! thank you!

old Perfect + Subtract

White_12E_456_789
BANNED Off Offline

Quote
user EP has written
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
66
67
68
69
70
71
72
parse("sv_friendlyfire 1")

function hudtext2(id,tid,color,txt,x,y)
     local toprint = ("©"..color.." "..txt)
     parse('hudtxt2 '..id..' '..tid..' "'..toprint..'" '..x.." "..y)
end

function teamhud(id)
if teamid[id]==1 then
hudtext2(id,id+1,"255000000","Team :-RED-",500,314)
elseif teamid[id]==2 then
hudtext2(id,id+1,"000000255","Team :-BLUE-",500,314)
end
end

function Array(size,value) 
    local array = {}
    for i = 1, size do
        array[i]=value
    end
    return array
end

teamid = Array(32,0)

addhook("team","a")
function a (id,team)
if teamid[id]==0 then
msg2(id,"©255000000You must choose a team to join the game!")
return 1
end
end

addhook("serveraction","b")
function b(id,act)
if act == 1 then
	menu(id,"Choose Team,Red,Blue")
	end
end

addhook("menu","c")
function c(id,title,button)
if title == "Choose Team" then
	if button == 1 then
		teamid[id]=1
		msg2(id,"©000255000You chose the RED Team!")
		teamhud(id)
	elseif button == 2 then
		teamid[id]=2
		msg2(id,"©000255000You chose the BLUE Team!")
		teamhud(id)
	end
end
end

addhook("hit","d")
function d(id,source)
if teamid[id]==1 and teamid[source]==1 then
return 1
elseif teamid[id]==1 and teamid[source]==2 then
return 0
elseif teamid[id]==2 and teamid[source]==2 then
return 1
elseif teamid[id]==2 and teamid[source]==1 then
return 0
end
end

addhook("join","e")
function e(id)
menu(id,"Choose Team,RED,BLUE")
end
Very Fun!!!, You choose a team when you join an you start to kill the guys of the other teams, if you did not choose a team you can't join to the game ;(. To choose a Team use F2. Good luck.


can you add this "if you click that it will subtract $16000?"
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview