Forum

> > CS2D > Scripts > How to check if a player is scoping
Forums overviewCS2D overview Scripts overviewLog in to reply

English How to check if a player is scoping

10 replies
To the start Previous 1 Next To the start

old Re: How to check if a player is scoping

DC
Admin Off Offline

Quote
Hmm.. I can't think of a way to do that.

I think there's no way in general to check if a player is scoping. In hooks like cs2d lua hook 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 cs2d lua hook shieldhit doesn't even provide a damage value it's not even possible to use a damage based workaround there

old Re: How to check if a player is scoping

Mami Tomoe
User Off Offline

Quote
@user DC: I decided to use
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.

old Re: How to check if a player is scoping

Mora
User Off Offline

Quote
add a variable like
1
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
made for 3 minutes and not tested, is only the idea.
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
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview