Forum

> > CS2D > Scripts > Deagle HP Script Wrong
Forums overviewCS2D overview Scripts overviewLog in to reply

English Deagle HP Script Wrong

6 replies
To the start Previous 1 Next To the start

old Deagle HP Script Wrong

KaTiL
User Off Offline

Quote
What's wrong?
1
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

>Help me

old Re: Deagle HP Script Wrong

EngiN33R
Moderator Off Offline

Quote
1
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

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.

old Re: Deagle HP Script Wrong

IWhoopedPythagoras
BANNED Off Offline

Quote
user EngiN33R has written
1
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

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.

old Re: Deagle HP Script Wrong

EngiN33R
Moderator Off Offline

Quote
@IWhoopedPythagoras
Whoops, you're right, didn't see that. Thanks for fixing.

The final code:
1
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

Spoiler >
edited 2×, last 07.07.11 10:52:45 pm

old Re: Deagle HP Script Wrong

Unknown_Soldier
User Off Offline

Quote
user EngiN33R, The final code is your first code with tabbing, the "==" mistake is still there

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.

old Re: Deagle HP Script Wrong

EngiN33R
Moderator Off Offline

Quote
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.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview