Deagle HP Script Wrong
6 replies



07.07.11 07:35:04 pm
What's wrong?
Help me
Code:
1
2
3
4
5
6
2
3
4
5
6
addhook('hit', 'hp')
function hp(id,wpn)
if wpn = 3 then
parse("sethealth "..id.." "..player(id,"health")+25)
end
end
function hp(id,wpn)
if wpn = 3 then
parse("sethealth "..id.." "..player(id,"health")+25)
end
end


Code:
1
2
3
4
5
6
2
3
4
5
6
addhook('hit', 'hp')
function hp(id,src,wpn)
if wpn = 3 then
parse("sethealth "..id.." "..player(id,"health")+25)
end
end
function hp(id,src,wpn)
if wpn = 3 then
parse("sethealth "..id.." "..player(id,"health")+25)
end
end
You have to keep the order of the arguments, if e.g. you have the arguments id,src,wpn you can't throw away src.
I code, therefore I exist.

Code:
1
2
3
4
5
6
2
3
4
5
6
addhook('hit', 'hp')
function hp(id,src,wpn)
if wpn = 3 then
parse("sethealth "..id.." "..player(id,"health")+25)
end
end
function hp(id,src,wpn)
if wpn = 3 then
parse("sethealth "..id.." "..player(id,"health")+25)
end
end
You have to keep the order of the arguments, if e.g. you have the arguments id,src,wpn you can't throw away src.
Don't forget the difference between = and ==. A beginner mistake that many people overlook.
@IWhoopedPythagoras
Whoops, you're right, didn't see that. Thanks for fixing.
The final code:
Whoops, you're right, didn't see that. Thanks for fixing.
The final code:
Code:
1
2
3
4
5
6
7
2
3
4
5
6
7
addhook('hit', 'hp')
function hp(id,src,wpn)
if wpn == 3 then
parse("sethealth "..id.." "..player(id,"health")+25)
return 1
end
end
function hp(id,src,wpn)
if wpn == 3 then
parse("sethealth "..id.." "..player(id,"health")+25)
return 1
end
end
edited 2×, last 07.07.11 10:52:45 pm
I code, therefore I exist.

btw that script should heal your teammates (with Friendly fire off, since you can't damage allies) but will reduce the damage of the deagle if you shoot the enemy, I don't know what is the purpose of this script.
Should I come back and make one last map for CS2D?
I'm sorry Unknown, I'm malfunctioning when it gets midnight and when I only got 5 hours of sleep. I also put a return 1 to negate the actual hurting damage.
I code, therefore I exist.



