Forum

> > CS2D > Scripts > Gas and Molotov ignore damage?
Forums overviewCS2D overview Scripts overviewLog in to reply

English Gas and Molotov ignore damage?

4 replies
To the start Previous 1 Next To the start

old Gas and Molotov ignore damage?

orkin2913
User Off Offline

Quote
Hi us, i have a problem.
I use hook "hit" to ignore damage from gas and molotov but if I go into the gas or molotov damage isn't ignored.

It look like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
addhook("hit","pyrohit")
function pyrohit(id,source,wpn,dmg)
	if wpn==72 then
		if pyro[id]==1 then
			return 1
		end
	end
	if wpn==73 then
		if pyro[id]==1 then
			return 1
		end
	end
end

old Re: Gas and Molotov ignore damage?

EngiN33R
Moderator Off Offline

Quote
I just tested the code and it works perfectly. Are you sure pyro[id] is 1? Also, the code could be shortened to this:

1
2
3
4
5
6
addhook("hit","pyrohit")
function pyrohit(id,source,wpn)
	if wpn==72 or wpn==73 and pyro[id]==1 then
		return 1
	end
end

old Re: Gas and Molotov ignore damage?

Cure Pikachu
User Off Offline

Quote
I had the same problem. It happens when you have too many scripts that share the same hook, especially ones that return values.

Solution: Replace
addhook("hit","pyrohit")
with
addhook("hit","pyrohit",1) -- Anything higher than 1 will do just fine.
edited 1×, last 04.03.17 06:27:02 pm

old Re: Gas and Molotov ignore damage?

orkin2913
User Off Offline

Quote
user Cure Pikachu has written
I had the same problem. It happens when you have too many scripts that share the same hook, especially ones that return values.

Solution: Replace
1
addhook("hit","pyrohit")
to
1
addhook("hit","pyrohit",1) -- Anything higher than 1 will do just fine.

You're the best
It's works!
Yes, I make quite an advanced script and I have a lot of these hooks.
Thanks, thread to close.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview