Forum
CS2D Scripts how to not get the 2000 money after every round?how to not get the 2000 money after every round?
4 replies 1
1
2
3
4
5
6
2
3
4
5
6
addhook("endround","er") function er() 	for _, id in ipairs(player(0,"tableliving")) do 		parse("setmoney "..id.." "..(player(id,"money")-2000)) 	end end
You probably need more use-cases because the winner team is probably going to get more money than the loosing team. Also it depends on the exact win condition I think (which gamemode; wether bomb planted/defused or all enemys killed; wins in a row; etc)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
addhook("endround","er") function er(m) 	if (m==1) then -- TT wins 		-- Reduce money for all Terrors 		for _, id in ipairs(player(0,"team1living")) do 			parse("setmoney "..id.." "..(player(id,"money")-2200)) -- TTs loose more 		end 		-- Reduce all money for all Counter-Terrors 		for _, id in ipairs(player(0,"team12living")) do 			parse("setmoney "..id.." "..(player(id,"money")-1800)) -- CTs less 		end 	elseif (m==2) then -- CT wins 	elseif (...) then 	 	... 	 	end end
player
endround
edited 1×, last 05.12.21 09:32:40 am
Bowlinghead has written
Wrong, if he reduce money on endround he will still get money on startround.
I have this script, it's really easy to do.
Here is the way easier script:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
--untested local playerMoneyzz = {} addhook("endround","OnEndround") function OnEndround() 	playerMoneyzz = {}; -- reset table 	for _, id in ipairs(player(0,"table")) do 		playerMoneyzz[id] = player(id,"money"); 	end end addhook("startround","OnStartround") function OnStartround() 	for id,euros in pairs(playerMoneyzz) do 		parse("setmoney "..id.." "..euros) 	end end addhook("leave","OnLeave") function OnLeave(id) 	playerMoneyzz[id] = nil; -- delete money value if someone leaves end
Note that this only works because the endround money is given to you at the start of the next round!
1