Forum

> > CS2D > Scripts > save/load money
Forums overviewCS2D overview Scripts overviewLog in to reply

English save/load money

1 reply
To the start Previous 1 Next To the start

old save/load money

Zurak
User Off Offline

Quote
trying to make functions for saving/loading a players money at each new roundstart. i dont get what im doing wrong here:
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
function savemoney()
		for i = 1,32 do
			if player(i,"money") ~= nil then
				tmoney[i] = money(i)
			end
		end
	end

	function loadmoney()
		for i = 1,32 do
			if player(i,"money") ~= nil then
				parse('setmoney'..i..''..tmoney[i])
			end
		end
	end

	addhook("startround","startround")
	addhook("endround","endround")

	function endround()
		savemoney()
	end

	function startround()
		loadmoney()
	end
i get error : attempt to concatenate flied (?) a boolean value.

old Re: save/load money

MikuAuahDark
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
tmoney = {} for id = 1,32 do tmoney[id]=0 end

function savemoney()
	for i in pairs(player(0,"table")) do
		tmoney[i] = player(id,"money")
	end
end
function loadmoney()
	for i in pairs(player(0,"table")) do
		parse('setmoney '..i..''..tmoney[i])
	end
end

addhook("startround","startround")
addhook("endround","endround")
function endround()
	savemoney()
end

function startround()
	loadmoney()
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview