Forum

> > CS2D > Scripts > A chance for the case
Forums overviewCS2D overview Scripts overviewLog in to reply

English A chance for the case

7 replies
To the start Previous 1 Next To the start

old A chance for the case

Masea
Super User Off Offline

Quote
Hi guys, I have some problems at here.

If CT wins one of the players in CT will get item..(If T wins T'll get) How can I do this?

I tried like that;

1
2
3
4
5
6
7
8
9
local kutucik = math.random(1,#player(0,"team2"))
local kutusans = math.random(1,2)
	if kutusans == 1 then
	parse('hudtxt 19 "'..player(kutucik,"name")..' got a case!" 400 240 1')
	userkutu[kutucik] = userkutu[kutucik] + 1
	else
	parse('hudtxt 19 "'..player(kutucik,"name")..' got a key!" 400 240 1')
	userkey[kutucik] = userkey[kutucik] + 1
	end

But didn't work.

Thanks for now!

old Re: A chance for the case

Masea
Super User Off Offline

Quote
@user Rainoth: Thanks for help. I think its working, but not sure.

EDIT: Its not working, all people getting cases in ct, if wins.
edited 1×, last 27.09.15 04:16:13 pm

old Re: A chance for the case

tontonEd
User Off Offline

Quote
not sure I did understand what you did want
1
2
3
4
5
6
7
8
local luckerIDtt = math.random(1,#player(0,"team1"))]
local luckerIDct = math.random(1,#player(0,"team2"))]
local team = math.random(1,2)
     if team == 1 then
     parse('hudtxt 19 "'..player(luckerIDtt,"name")..' got a case!" 400 240 1')
     else
     parse('hudtxt 19 "'..player(luckerIDct,"name")..' got a key!" 400 240 1')
     end

old Re: A chance for the case

Masea
Super User Off Offline

Quote
@user tontonEd: Thanks but its not working.

I saying now what i want with an example;
When counter-terrorists wins the round, one player will get a case, if player in counter-terrorist.

old Re: A chance for the case

Nekomata
User Off Offline

Quote
Try this:
1
2
3
4
5
6
7
8
9
10
11
if game("winrow_ct") >= 1 then
	local kutucik = math.random(1,#player(0, "teamliving2"))
	local kutusans = math.random(1,2)
	if kutusans == 1 then
		print('Debug: '..player(tonumber(kutucik), "name")..' got a case')
		parse('hudtxt 19 "'..player(tonumber(kutucik),"name")..' got a case!" 400 240 1')
	else
		print('Debug: '..player(tonumber(kutucik), "name")..' got a key')
		parse('hudtxt 19 "'..player(tonumber(kutucik),"name")..' got a key!" 400 240 1')
	else
end

By the way, copy the errors you get in your console here. o.o

old Re: A chance for the case

tontonEd
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
addhook("startround","onStartround")
function onStartround(mode)
	if mode == 1 or mode == 20 then --terro win
		local luckerIDtt = math.random(1,#player(0,"team1"))]
		parse('hudtxt 19 "'..player(luckerIDtt ,"name")..' got a case!" 400 240 1')
	elseif mode == 2 or mode == 21 or mode == 22 then --ct win  
		local luckerIDct = math.random(1,#player(0,"team2"))]
		 parse('hudtxt 19 "'..player(luckerIDct ,"name")..' got a key!" 400 240 1')
	end 
end
^^?
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview