Forum

> > CS2D > Maps/Editor > How to hurt once?
ForenübersichtCS2D-Übersicht Maps/Editor-ÜbersichtEinloggen, um zu antworten

Englisch How to hurt once?

13 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt How to hurt once?

-AngelOfDeath-
User Off Offline

Zitieren
Hello all, i have a question about map creating. Im going to make 35hp map but i cant do that what players would be hurted once, i tried to trigger entinies but nothing worked, maybe someone know how to do it or have ideas how to trigger it? Thanks for answers

alt Re: How to hurt once?

DannyDeth
User Off Offline

Zitieren
1
2
3
4
5
6
addhook("startround","set_hp")
function set_hp()
	for i=1,32 do
		if(player(i,"exists") and player(i,"hp") > 0) then parse("sethealth "..i.." 35") end
	end
end

EDIT: I would just like to point out that I was extremely busy + tired when I wrote the original script.
1× editiert, zuletzt 01.08.11 16:41:59

alt Re: How to hurt once?

Alistaire
User Off Offline

Zitieren
Dude,

-Copy the code to a .txt file
-Call the file "35HP.lua" and save it in sys/lua
-Add this line to your server.lua file: dofile('sys/lua/35HP.lua')
-Try again!

alt Re: How to hurt once?

-AngelOfDeath-
User Off Offline

Zitieren
im not a idiot, i do this, it wont work

PS. I created deticated server and it writes: LUA ERROR: sys/lua/35HP.lua:4: 'do' expected near 'if'
1× editiert, zuletzt 31.07.11 18:59:10

alt Re: How to hurt once?

Alistaire
User Off Offline

Zitieren
1
2
3
4
5
6
7
8
addhook("startround","set_hp")
	function set_hp()
		for i=1,32
			if(player(id,"exists")) and (player(id,"hp") > 0) 
				do parse("sethealth "..i.." 35")
			end
	end
end

Try again
1× editiert, zuletzt 31.07.11 19:13:25

alt Re: How to hurt once?

Starkkz
Moderator Off Offline

Zitieren
user Alistaire hat geschrieben
Zitat
addhook("startround","set_hp")
function set_hp()
          for i=1,32
               if(player(id,"exists")) and (player(id,"hp") > 0)
                    do parse("sethealth "..i.." 35")
               end
     end
end


Try again


The first time I saw it, I knew the bug. Btw, Danny was near.

alt Re: How to hurt once?

Alistaire
User Off Offline

Zitieren
Hurr I didn't notice that.

1
2
3
4
5
6
7
8
addhook("startround","set_hp")
function set_hp()
          for id=1,32
               if(player(id,"exists")) and (player(id,"hp") > 0) 
                    do parse("sethealth "..id.." 35")
               end
     end
end

alt Re: How to hurt once?

EngiN33R
Moderator Off Offline

Zitieren
1
2
3
4
5
6
7
addhook("startround","set_hp")
function set_hp()
for id=1,32 do
if(player(id,"exists")) and (player(id,"hp") > 0) then parse("sethealth "..id.." 35")
end
end
end

EDIT: Hold on, wait, does that actually work? What 2Fast4You wrote? I thought 'do' only goes after 'for'?

alt Re: How to hurt once?

RAVENOUS
BANNED Off Offline

Zitieren
user EngiN33R hat geschrieben
EDIT: Hold on, wait, does that actually work? What 2Fast4You wrote? I thought 'do' only goes after 'for'?


It does.

Actually, after using the if-condition, you have to use the marker "then" instead of "do".

alt Re: How to hurt once?

Apache uwu
User Off Offline

Zitieren
Hm, potentially you could add a env_hurt for 1 second when the round starts. (env_hurt,delay)

However lua is easier.

1
2
3
4
5
6
7
addhook("startround","_startround")

function _startround()
	for _,id in ipairs(player(0,"tableliving")) do
		parse("sethealth "..id.." ".." 35")
	end
end

@2Fast4You happens to everyone once in a while, and when you know different languages it tends to happen a lot when you switch back and forth between languages.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Maps/Editor-ÜbersichtCS2D-ÜbersichtForenübersicht