Well, I wanted to make a Healing Gun for my server, but I can't seem to get it right.
Can someone tell me what's wrong on this?:
1
2
3
4
5
6
7
8
addhook("hit","heal")
function heal(id,source,weapon,hpdmg,apdmg)
if (weapon==3) then
if player(id,"team")==player(source,"team") then
		parse("sethealth "..id.." player(id,"health")+50")
end
end
end
Admin/mod comment
use the lua scripting thread! closed! /DC theres something wrong with the "heal" thing at the start, i think it should be a weapon name.
1
2
3
4
5
6
addhook("hit","deagle")
	function deagle(id,source,weapon,hpdmg,apdmg)
	 if(weapon == 3) then
parse ("sethealth "..id.." "..player(id,"health")+10)
	 end
end
made a lua, here you go. edited 1×, last 30.08.10 03:19:59 am
Mod has written
theres something wrong with the "heal" thing at the start, i think it should be a weapon name.
1
2
3
4
5
6
addhook("hit","deagle")
	function deagle(id,source,weapon,hpdmg,apdmg)
	 if(weapon == 3) then
parse ("sethealth "..id.." "..player(id,"health")+10)
	 end
end
made a lua, here you go.
Didn't work.
'Heal' is the function name, it can be anything. It doesn't affect the script's behavior. Replace this line
1
2
3
parse("sethealth "..id.." player(id,"health")+50")
--BY THIS ONE
parse("sethealth " .. id .. " " .. (player(id,"health")+50))
You messed up the quotes Flacko has written
Replace this line
1
2
3
parse("sethealth "..id.." player(id,"health")+50")
--BY THIS ONE
parse("sethealth " .. id .. " " .. (player(id,"health")+50))
You messed up the quotes
I still get this on the console:
LUA ERROR: attempt to call a nil value
Every time I try to shoot someone. ask this question in the Lua section and you might get somewhere. Make sure the function name matches the second parameter of addhook()
Or try to copy paste this script
1
2
3
4
5
6
7
addhook("hit","_hit")
function _hit(id,src,w)
	if player(id,"team") == player(src,"team") and w==3 then
		parse("sethealth "..id.." ".. player(id,"health")+50)
		return 1
	end
end