Forum

> > CS2D > Scripts > random teror (lua)
Forums overviewCS2D overview Scripts overviewLog in to reply

English random teror (lua)

2 replies
To the start Previous 1 Next To the start

old random teror (lua)

limonata
User Off Offline

Quote
Hello, i tried to make this script but it doesnt work. Where is my mistake?

Every round random terörist will be CT.

Here is my script:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
m = 0

local random_ct = player(0,'team1')
addhook("startround","asd")
function asd(id)
	for _, i in ipairs(#random_ct) do
		local a = math.random(i)
		m = 1
		parse("makect "..a)
	end
end
	
	
addhook("team","a")
function a(id,team)
	if team == 2 and m ~= 1 then
		return 1
	else
		return 0
	end
end

May someone help me ?
edited 2×, last 15.06.13 07:56:36 pm

old Re: random teror (lua)

MikuAuahDark
User Off Offline

Quote
Code to fix startround function:
1
2
3
4
5
function asd()
	if #player(0,"team1")>0 then
		parse("makect "..player(0,"team1")[math.random(1,#player(0,"team1"))])
	end
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview