
Forum




How to hurt once?
13 replies




1
2
3
4
5
6
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.

edited 1×, last 01.08.11 04:41:59 pm
-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!
PS. I created deticated server and it writes: LUA ERROR: sys/lua/35HP.lua:4: 'do' expected near 'if'
edited 1×, last 31.07.11 06:59:10 pm
1
2
3
4
5
6
7
8
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
edited 1×, last 31.07.11 07:13:25 pm

Quote
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
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.
1
2
3
4
5
6
7
8
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
1
2
3
4
5
6
7
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'?

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".
However lua is easier.
1
2
3
4
5
6
7
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.




