edited 2×, last 17.12.13 08:38:02 pm
Forum
CS2D Scripts Lua Request - No money loss on teamkillLua Request - No money loss on teamkill
11 replies 1
P.S. The title is wrong. It shows that you request a lua that will make a person lose money when he kills a teammate, not vice-versa.
P.S. It's not possible
edited 2×, last 17.12.13 08:26:07 pm
@topic: even if it's not possible to change in settings you can always give money to player when he's losing it (kill hook).
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
money = 0 addhook("kill","compensate") function compensate(k,v) local cash = player(k,"money") 	if player(k,"team")==player(v,"team") then 		parse("setmoney "..k.." "..cash+money) 	end end
There. When you kill a person of same team, it'll add "money" money to your character. You should change it to 300 or whatever so whenever you kill you would lose AND get the same amount of money and therefore your money balance wouldn't change
P.S. I had similar script.
Say you got 2000$.
You lose 500$ when you kill somebody.
You use this script and change
"money = 0" into "money = 500" which is how much you want to compensate.
You kill a teammate.
The cs2d takes away 500$ from you. Now you have 1500$ and that's not good, right ? That's where my script works.
It adds the "money" to your current cash.
Set money to Current Cash + "Money" variable
Set Money to 1500 + 500
Money before kill : 2000
During kill : 2000 - 500 + 500
After Kill : 2000
The money doesn't change. You just replace the "0" to whatever money value you want. I made it because I was too lazy to check how much money a person loses when he kills a teammate.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
tbl = {} money = 3300 addhook("kill","compensate") function compensate(k,v) local cash = player(k,"money") if player(k,"team")==player(v,"team") then 	 if cash < 3301 then 	 tbl[k] = money - cash 	parse("setmoney "..k.." "..tbl[k]) 	 else 	 parse("setmoney "..k.." "..cash+money) 	 end end end
I hate editing code in this site... So inconvenient ._.
money = 0to
money = 3300in Rainy's script.
---
@ Rainoth:
If you're to lazy to check how much money player loses on team kill you could also use other, a little longer method:
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
TempMoney = {} addhook("hit", "HookHit") HookHit = function(id, src) 	TempMoney[src] = player(src, "money") end addhook("kill", "HookKill") HookKill = function(k, v) 	if player(k, "team") == player(v, "team") then 		parse("setmoney "..k.." "..TempMoney[k]) 	end end
Edit: damn, ninja'd.
1