Forum

> > CS2D > Scripts > How to check if a player is scoping
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch How to check if a player is scoping

10 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Re: How to check if a player is scoping

DC
Admin Off Offline

Zitieren
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

alt Re: How to check if a player is scoping

Mami Tomoe
User Off Offline

Zitieren
@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.

alt Re: How to check if a player is scoping

Mora
User Spielt CS2D

Zitieren
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
2× editiert, zuletzt 12.11.19 20:05:04
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht