Forum

> > CS2D > Scripts > What is wrong with this script?
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch What is wrong with this script?

3 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt What is wrong with this script?

Jenko63
User Off Offline

Zitieren
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?

alt Re: What is wrong with this script?

Rainoth
Moderator Off Offline

Zitieren
"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.

alt Re: What is wrong with this script?

Masea
Super User Off Offline

Zitieren
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.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht