Computerguy419
Forum
CS2D Scripts Money Drop on DeathMoney Drop on Death
5 replies 1
Computerguy419
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
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 drop_all_money(id) 	local tilex = player(id,"tilex") 	local tiley = player(id,"tiley") 	if player(id,"exists") and player(id,"money") > 0 then 		while player(id,"money") >= 1000 do 			local money = player(id,"money") - 1000 			parse("setmoney ".. id .. " " ..money) 			parse("spawnitem".. " 68 " .. tilex .. " " .. tiley) 		end 		while player(id,"money") >= 500 do 			local money = player(id,"money") - 500 			parse("setmoney ".. id .. " " ..money) 			parse("spawnitem".. " 67 " .. tilex .. " " .. tiley) 		end 		while player(id,"money") >= 100 do 			local money = player(id,"money") - 100 			parse("setmoney ".. id .. " " ..money) 			parse("spawnitem".. " 66 " .. tilex .. " " .. tiley) 		end 	end end addhook("die","_die") function _die(victim,killer,weapon,x,y)	 	drop_all_money(victim) end
I guess that's somewhat the fastest way. Can't really think of any faster.
Looks pretty solid, good work! (:
EDIT: Well I just found one:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function drop_money(id,amount,iid) 	while player(id,"money") >= amount do 		local money = player(id,"money") - amount 		parse("setmoney "..id.." "..money) 		parse("spawnitem".." "..iid.." "..tilex.." "..tiley) 	end end function drop_all_money(id) 	local tilex = player(id,"tilex") 	local tiley = player(id,"tiley") 	if player(id,"exists") and player(id,"money") > 99 then 		drop_money(id,1000,68) 		drop_money(id,500,67) 		drop_money(id,100,66) 	end end addhook("die","_die") function _die(victim,killer,weapon,x,y)	 	drop_all_money(victim) end
It's not a big improvement, but it's shorter.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function drop_money(id,amount,iid) 	while player(id,"money") >= amount do 		local money = player(id,"money") - amount 		parse("setmoney "..id.. " " ..money) 		parse("spawnitem ".. iid .." " ..player(id,"tilex").. " " ..player(id,"tiley")) 	end end function drop_all_money(id) 	if player(id,"exists") and player(id,"money") > 0 then 		drop_money(id,1000,68) 		drop_money(id,500,67) 		drop_money(id,100,66) 	end end addhook("die","_die") function _die(victim,killer,weapon,x,y) 	drop_all_money(victim) 	parse("setmoney "..victim.. " " ..0) end
EDIT: Oh, you just did that (: Nice!
Computerguy419
1