Forum

> > CS2D > Scripts > LUA Question - Ct/T win
Forums overviewCS2D overview Scripts overviewLog in to reply

English LUA Question - Ct/T win

22 replies
Page
To the start Previous 1 2 Next To the start

old LUA Question - Ct/T win

Infinite Rain
Reviewer Off Offline

Quote
Hello guys, could someone please help me ?
how to make
If terrorists win this round then something happens?

I try everything but nothing... Could someone help me please?

old Re: LUA Question - Ct/T win

Yates
Reviewer Off Offline

Quote
user J4x has written
Maybe you can make something that checks the ct/t score each round.
1
game("score_ct")

Wouldn't the function then start the next round, because at the next round then the team get the point(s).

old Re: LUA Question - Ct/T win

EngiN33R
Moderator Off Offline

Quote
It's weird but it might just work.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
addhook("startround","ifwon")
function ifwon()
if (game("winrow_t")>wt) then
--do stooffz
end
if (game("winrow_ct")>wct) then
--do stooffz
end
end

addhook("endround","numberofwins")
function numberofwins()
wt=game("winrow_t")
wct=game("winrow_ct")
end

I didn't test it though and I didn't look at Blaz's script. Plus, I don't know when the points count so you may have to try swapping the hooks.

old Re: LUA Question - Ct/T win

Vectarrio
User Off Offline

Quote
user EngiN33R has written
It's weird but it might just work.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
addhook("startround","ifwon")
function ifwon()
if (game("winrow_t")>wt) then
--do stooffz
end
if (game("winrow_ct")>wct) then
--do stooffz
end
end

addhook("endround","numberofwins")
function numberofwins()
wt=game("winrow_t")
wct=game("winrow_ct")
end

I didn't test it though and I didn't look at Blaz's script. Plus, I don't know when the points count so you may have to try swapping the hooks.


change startround and endround, might work

old Re: LUA Question - Ct/T win

EngiN33R
Moderator Off Offline

Quote
Then the only thing I can think of is to make two func_gameaction entities (or whatever it's called) - for T winning and CT winning - and just make a hook (specifically trigger hook) to see if one of them is triggered and then do stooffz.

old Re: LUA Question - Ct/T win

Lee
Moderator Off Offline

Quote
It's actually the parameter of the cs2d lua hook endround hook.

-- 20 bomb deto
-- 21 bomb def
-- 30 VIP killed?
-- 31 VIP escaped?
-- 40 red cap
-- 41 blue cap
-- 50 red dom
-- 51 blue dom
-- 60 zombies won
-- 61 survivor won

-- 1 T
-- 2 CT
-- 3 draw
-- 4 commencing
-- 5 restart

For example, to test whether T won, we would use

1
2
3
4
5
6
addhook("endround", "f")
function f(m)
	if m == 1 or m%10 == 0 then
		msg("Terrorists Won")
	end
end
To the start Previous 1 2 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview