Forum

> > CS2D > Scripts > Check if Shift key is pressed
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Check if Shift key is pressed

3 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Re: Check if Shift key is pressed

G3tWr3ck3d
User Off Offline

Zitieren
I tried to check it but it seems that is not working.

1
2
3
4
5
6
7
8
9
10
11
12
walking = {}

addhook('move','_move')
function _move(id,x,y,walk)
	if player(id,walk) == 1 then
		walking[id] = true
		msg2(id,'You are walking')
	else
		walking[id] = false
		msg2(id,'You are running')
	end
end

It just spams with the you are running statement.

alt Re: Check if Shift key is pressed

Rainoth
Moderator Off Offline

Zitieren
That's because player table has no value "walk".
You can have
1
player(id,"name")
but not
1
player(id,"walk")

The move hook, however, provides that. So all you have to do is check like so:
1
if walk == 1 then -- walking
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht