Forum

> > CS2D > Scripts > What is wrong with this script?
Forums overviewCS2D overview Scripts overviewLog in to reply

English What is wrong with this script?

3 replies
To the start Previous 1 Next To the start

old What is wrong with this script?

Jenko63
User Off Offline

Quote
1
2
3
4
5
6
addhook("attack","attack")
function attack(killer,victim)
if killer ~= victim then
parse("setmaxhealth "..victim.." 100")
end
end

what is wrong with this script?

old Re: What is wrong with this script?

Rainoth
Moderator Off Offline

Quote
"attack" hook only supplies the "id" of the person who made the attack. It does not supply the id of killer or victim because these things don't happen during "attack" but during the "kill".
If you want this to work, you should replace "attack" with "kill" or "die", whichever you prefer.

Additionally, you'd set max health of the person who dies to 100.
This won't achieve any effect unless you modified max health values before that with other conditions.

old Re: What is wrong with this script?

Masea
Super User Off Offline

Quote
In fact, nothing is wrong with this script but the knowledge of yours. Why you ended up seeing no differences is because the players have default 100 max health anyway.

Also, I want to plus to user Rainoth's suggest. I'd rather go for cs2d lua hook hit hook which however will make god mode on for the victim and pretty sure you don't want something like this.

We could've been more helpful if you had mentioned what you actually want.

And by the way that if statement is almost for nothing unless friendly fire is enabled.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview