Forum

> > CS2D > Scripts > Roundstart hook
Forums overviewCS2D overview Scripts overviewLog in to reply

English Roundstart hook

10 replies
To the start Previous 1 Next To the start

old Roundstart hook

Alistaire
User Off Offline

Quote
Now when I use this script;

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Collectables_image1={}
Col1_Collected=0
parse('hudtxt 1 "0" 40 412')

addhook("break","Collectables_break_hook")
function Collectables_break_hook(x,y)
	if(entity(x,y,"name")=="Col1") then
		Col1_Collected = Col1_Collected + 1
		parse('hudtxt 1 "'..Col1_Collected..'" 40 412')
	end
end

Collectables_image1=image("gfx/CSP_Reborn/Crts-Col.png",17,420,2)
imageblend(Collectables_image1,1)
imagecolor(Collectables_image1,115,115,25)

The "Col1_Collected" value stays the same as before roundrestart. Is there a way to change it?

Like;

1
2
3
4
5
addhook("startround","ColReset")
function ColReset()
	Col1_Collected=0
	parse('hudtxt 1 "0" 40 412')
end

?

old Re: Roundstart hook

DC
Admin Off Offline

Quote
I guess that you just answered your question yourself. why aren't you trying your own solution before asking?

old Re: Roundstart hook

Kel9290
User Off Offline

Quote
umm..
Quote
startround(mode)                         on start of round
-mode: start/end mode id


endround(mode)                              on end of round
-mode: start/end mode id

old Re: Roundstart hook

VADemon
User Off Offline

Quote
Who doesn't understand german:
on every round end/start mode returns a value about who won and how. There're too much ways to win that's why the information about different values of mode would be a big help for some devs.

old Re: Roundstart hook

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
function hudtext2(id,tid,color,txt,x,y)
     local toprint = ("©"..color.." "..txt)
     parse('hudtxt2 '..id..' '..tid..' "'..toprint..'" '..x.." "..y)
end

Collectables_image1={}
Col1_Collected={}
parse('hudtxt 1 "0" 40 412')

function UpdateCol1Hud(id)
hudtext2(id,1,"255255255",Col1_Collected,40,412)
end

addhook("break","Collectables_break_hook")
function Collectables_break_hook(x,y)
     if(entity(x,y,"name")=="Col1") then
          Col1_Collected[id] = Col1_Collected[id] + 1
          UpdateCol1Hud(id)
     end
end

Collectables_image1=image("gfx/CSP_Reborn/Crts-Col.png",17,420,2)
imageblend(Collectables_image1,1)
imagecolor(Collectables_image1,115,115,25)

addhook("join","ColJoin")
function ColJoin(id)
	Col1_Collected[id]=0
	UpdateCol1Hud(id)
end

addhook("startround","ColReset")
function ColReset()
     Col1_Collected[id]=0
     UpdateCol1Hud(id)
end
Try it
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview