Forum

> > CS2D > Scripts > [SOLVED] Lifesteal fail
Forums overviewCS2D overview Scripts overviewLog in to reply

English [SOLVED] Lifesteal fail

2 replies
To the start Previous 1 Next To the start

old [SOLVED] Lifesteal fail

Ace Howl
User Off Offline

Quote
Hello.

Whenever I try to create a code that makes attacker will gain HP when they get a kill, it always heal towards the victim.

1
2
3
4
5
6
function codeKill(id,killer,victim)
	if lifesteal[id] > 0 then
		parse("sethealth "..victim.." "..(player(victim,"health")+lifesteal[id]))
		msg(player(victim,"name").." had his health restored.") -- this line acts like debug
	end
end

Regardless the position of 'victim' and 'killer', it always point towards the dead.
edited 1×, last 01.06.15 07:58:08 am

old Re: [SOLVED] Lifesteal fail

Mora
User Off Offline

Quote
fux, i've pressed msg and failure send, there is code with msg:
1
2
3
4
5
6
7
lifesteal = 5 --5 is test, change it to your value

addhook("kill","killAt")
function killAt(killer,victim)
	parse("sethealth "..killer.." "..player(killer,"health")+lifesteal)
	msg(player(killer,"name").." has "..player(victim,"name").."'s health restored.")
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview