Forum

> > CS2D > Scripts > how to not get the 2000 money after every round?
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch how to not get the 2000 money after every round?

4 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Re: how to not get the 2000 money after every round?

Bowlinghead
User Off Offline

Zitieren
You can delete it in the same second!
1
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
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

cs2d lua cmd player
cs2d lua hook endround
1× editiert, zuletzt 05.12.21 09:32:40

alt Re: how to not get the 2000 money after every round?

Bowlinghead
User Off Offline

Zitieren
Ok, thanks for the hint @user mrc

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
--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!
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht