Forum

> > CS2D > Scripts > sethealth with always hook
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch sethealth with always hook

2 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt sethealth with always hook

prosuWANTED
User Off Offline

Zitieren
For some reason, sethealth doesnt work for me .

1
2
3
4
5
6
7
addhook("always","big1")

function big1(id)
  if (player(id,"health")>1)
    parse('sethealth "..id.." 1')
  end
end

alt Re: sethealth with always hook

ohaz
User Off Offline

Zitieren
Your problem is that the always hook does not have any parameters - but you're trying to use it with one.
You should rather write it without the id parameter and get your id parameter by looping over the existing players table

alt Re: sethealth with always hook

prosuWANTED
User Off Offline

Zitieren
i tried that:
1
2
3
4
5
6
7
8
9
function big1()
  for id=1,32 do
    if(player(id,"exists")) then
      if (player(id,"health")>1)
        parse('sethealth "..id.." 1')
      end
    end
  end
end
... but that still didn't work.
Am i doying something wrong?
EDIT:
i forgot to add "then" :D.
It works now.
Thanks!
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht