Detect w
#1

I am wondering, is it possible/how to detect if player is pressing W button. I've tried with KEY_UP, but it doesnt work like it should be... - https://sampwiki.blast.hk/wiki/Keys

I am trying to detect two keys pressed, as I stated above one of them is W or KEY_UP button. I've also tried it on many other ways.. Script compiles perfectly but when I test it in game, it just doesnt work.
Reply
#2

Try KEY_SPRINT
Reply
#3

It detects SPACE, not W. W is for slow running ( not fast ).

I think it cant be anything else but KEY_UP for default settings of W, I just want to know how to use it or how to make it usable since currently it doesnt work for me.
Reply
#4

Movement keys do not trigger OnPlayerKeyStateChange. If you want to check you need OnPlayerUpdate. However, you cannot detect the 'W' key specifically, you can only detect KEY_UP. KEY_UP happens to be bound to Z in my game. (Azerty keyboard).
Reply
#5

Use GetPlayerKeys. UpDown part will detect W and S keys. Using OnPlayerKeyStateChange won't work as it doesn't register directional keys
Reply
#6

Quote:

Movement keys do not trigger OnPlayerKeyStateChange. If you want to check you need OnPlayerUpdate. However, you cannot detect the 'W' key specifically, you can only detect KEY_UP. KEY_UP happens to be bound to Z in my game. (Azerty keyboard).

I only wanted to detect default of KEY_UP - W.

Quote:

Use GetPlayerKeys. UpDown part will detect W and S keys. Using OnPlayerKeyStateChange won't work as it doesn't register directional keys

How could I combinate UpDown, LeftRight part if I want to detect two diffrent keys while holding?

Anyways I want to detect when player is using W to move/walk/slow run.
Reply
#7

Quote:

You can't detect specific keys, you can only detect actions bound to keys but you have no way to know what keys those actions are bound to. So for some people KEY_SPRINT might be "w", but for others it might not, you can't know.

Bro, I know that, I wanted a default keys, most of the people dont change them, I would say 99%.. Why changing them when you got used to default in SA singleplayer..
Reply
#8

Why people would change controls? Default controls are much easier to use than edited ones. Anyways, I've changed my mind, how could I make stock to detect if player has moved/ran or smthing..
Reply
#9

Dude, did you even read my previous post? I, for example, have an Azerty keyboard which means I control movement with ZQSD instead of WASD (click here). Several other countries use their own layouts as well.

Anyway, include the key definitions in every message sent to the player. So instead of writing 'Press W to do stuff' you write 'Press ~k~~GO_FORWARD~ to do stuff'.
Reply
#10

Ppl, are you gonna argue with me or help. Okay I made a misstake. I apology, not everyone has WASD, but I still want to detect if player has moved if I cant detect the keys they press to move...

EDIT: I just found one by Misco and it works perfectly, solved my problem. Thanks anyways for your time.. You may close this.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)