It's for the shieldhit hook
Forum
CS2D Scripts How to check if a player is scopingHow to check if a player is scoping
10 replies 1
It's for the shieldhit hook
I think there's no way in general to check if a player is scoping. In hooks like hit it would be possible to check for scoping by checking the amount of damage. This isn't a 100% accurate solution in all cases though (damage can be reduced by previous hits).
Since shieldhit doesn't even provide a damage value it's not even possible to use a damage based workaround there
item(wpn_id, 'dmg').
Dirty workaround, but it works well if I use a multiplier like
* 0.5.
But then I had a problem when I thought about player scoping, for now I ignore scoping but that'll affect gameplay...
There should be a "DMG" variable that gives the amount of damage that the shield mitigated.
player(p, 'weaponmode').
But, its unefficient and not really worth the effort.
Plus, it could go wrong without you even realizing it.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
player1zoom = 0 addhook("attack2","_attack2") function _attack2(id,mode) 	if mode==1 then 		player1zoom = 1 	elseif mode==2 then 		player1zoom = 2 	end end addhook("shieldhit","_shieldhit") function _shieldhit(id,source) 	if player1zoom == 1 then 		msg("ah is one") 	elseif player1zoom == 2 then 		msg("oh is two") 	end end addhook("select","_select") function _select(id) 	player1zoom = 0 end
I think is enough to keep at least one variable for every player in that case, the select hook allow you to drop the variable(also if u even change the weapon u're in scope to the same weapon it count as "select")
/maybe i'm wrong just kill me :v
edited 2×, last 12.11.19 08:05:04 pm
1