Forum

> > CS2D > Scripts > WeaponID Shakescript help
Forums overviewCS2D overview Scripts overviewLog in to reply

English WeaponID Shakescript help

3 replies
To the start Previous 1 Next To the start

old Re: WeaponID Shakescript help

Tajifun
User Off Offline

Quote
1
2
3
4
5
6
7
8
hit(id,source,weapon,hpdmg,apdmg)			on hit/damage
-id: player id (the victim)
-source: source player id or 0 (the attacker)
-weapon: weapon type / source type id
-hpdmg: caused damage (health)
-apdmg: caused damage (armor)
>return:	0 - proceed normally
		1 - ignore this hit (no damage)

Just have a look at the third parameter.
Quick example:

1
2
3
4
5
6
addhook("hit","shake")
function shake(id,s,wpn)
	if wpn == 40 then -- M249
		parse("shake "..id.." 10")
	end
end

This should work.
By the way:

This script will shake your teammates, too.
Add 'if player(id,"team) ~= player(s,"team")' if you want to prevent this.

old Re: WeaponID Shakescript help

EngiN33R
Moderator Off Offline

Quote
The attack hook only has 1 parameter, being the ID of the player who shot. You, on the other hand, assigned 3 to it. Therefore, it gives you an error. You may have wanted to use the hit hook.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview