General Reference
#37

I'm not sure if this is where it goes, but I was lookign all over for this info and finally got some answers,

pawn Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
//Put hooks for players in a car here

if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT){
// Put stuff for player on foot here

if (newkeys == 1032){//SPRINT(8) + SNEAK/WALK(1024)
SendClientMessage(playerid,0xFFFFFFFF,"You have hooked the combo");
return 1;
}
}

return 0;
}
First off key values for players who are on foot are not the same as players who are in are car,
I couldnt' find the key values around here, so I found a funtion to get them, and labeled them as such,



On Foot:
--------
1=TAB
2=CROUCH
4=ATTACK
8=SPRINT
16=ENTER VEHICLE
32=JUMP
64=(I couldn't find it)
128=AIM WEAPON
256=(I couldn't find it)
512=LOOK BEHIND
1024=SNEAK/WALK

8192=LEFT ARROW(4) ON KEYPAD*
16384= RIGHT ARROR(6) ON KEYPAD*



In Vehicle:
----------
1=ATTACK
2=HORN/SIRENS
8=GAS
16=EXIT VEHICLE(EDIT: and I couldn't find this the first run lol)
32=FOOT BRAKE
64=LOOK RIGHT
128=HAND BRAKE
256=LOOK LEFT
320=LOOK BEHIND(Combo of LOOK RIGHT(64) and LOOK LEFT(256))

2048= DELETE & UP ARROW(8 ) ON KEYPAD*
4096= END & DOWN ARROW(2) ON KEYPAD*
8192=LEFT ARROW(4) ON KEYPAD*
16384=RIGHT ARROW(6) ON KEYPAD*

4=LEFT ALT(Sneak on foot for me)**
132=RIGHT Ctrl.**
512=PLUS(+) ON KEYPAD**


Keep in mind alot of these values can be added together, to catch two presses, if I am on foot and press 8=SPRINT + 1024=SNEAK/WALK my 'newkeys' would then equal 1032.


*Though these buttons did things, such as move the camera and change radio stations, but I don't know if these will be the same on everyones machine, as they are kinda sketchy, and I can change stations and move camera with mouse, and it doesn't return a value, and I know that
6144(UP(204+DOWN(4096)) and
24576(LEFT(8192)+RIGHT(16384))
will not catch, maybe a smarter person can shed some light on them?
After looking over the defines, I'm thinking that these can hook someone using an analog controller(maybe?)

**These buttons didn't do anything, I'm thinking its more the buttons themselves, than what they do like the other values, like aiming your weapon will always come back as 128 no matter what key u have it bound to.

Anyway, I hope this helps someone, as I couldn't find this info anywhere, though maybe I'm not looking hard enough, lol.

EDIT:

I used [NB]Boylett's function,
pawn Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
new string[STR];
format(string,STR,"You pressed key number %d", newkeys);
SendClientMessage(playerid,0xFFFFFFAA,string);
}
to find the the key values, thanks Boylett

EDIT:

After Y-Less's statement, I wanted to add in the key press defines from 'a_samp.inc'(included with pawno),

pawn Code:
#define KEY_ACTION              1
#define KEY_CROUCH              2
#define KEY_FIRE                4
#define KEY_SPRINT              8
#define KEY_SECONDARY_ATTACK    16
#define KEY_JUMP                32
#define KEY_LOOK_RIGHT          64
#define KEY_HANDBRAKE           128
#define KEY_LOOK_LEFT           256
#define KEY_SUBMISSION          512
#define KEY_LOOK_BEHIND         512
#define KEY_WALK                1024
#define KEY_ANALOG_UP           2048
#define KEY_ANALOG_DOWN         4096
#define KEY_ANALOG_RIGHT        8192
#define KEY_ANALOG_LEFT         16384

#define KEY_UP                  -128
#define KEY_DOWN                128
#define KEY_LEFT                -128
#define KEY_RIGHT               128
Though once agian, I will remind people, values for 'on foot' and 'in car' are not the same.

Example:

pawn Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (newkeys == KEY_HANDBRAKE){ //Would work fine if they were in a car, but if they were on foot, it would also hook every time they aimed their weapon
SendClientMessage(playerid,0xFFFFFFFF,"You have used the handbrake...or aimed your weapon..");
return 1;
}
return 0;
}
Above in my post, is one way around this problem. I hope it helps someone...

Reply


Messages In This Thread
General Reference - by Mike - 26.01.2006, 19:03
General Reference - by Simon - 04.04.2006, 10:32
General Reference - by RayW - 04.04.2006, 10:48
General Reference - by Postality - 04.04.2006, 19:42
General Reference - by Mount - 05.04.2006, 14:34
car colors - by Denver - 06.04.2006, 21:31
Sound IDs - by webspy - 10.04.2006, 18:20
General Reference - by ARMax - 10.04.2006, 18:46
General Reference - by jbeta - 11.04.2006, 01:17
General Reference - by Postality - 12.04.2006, 13:35
General Reference - by Postality - 13.04.2006, 06:10
General Reference - by jbeta - 15.04.2006, 00:01
General Reference - by Arctos - 17.04.2006, 10:39
Re: General Reference - by Denver - 24.04.2006, 06:44
Re: General Reference - by PsYcHoGoD - 15.05.2006, 15:32
Re: General Reference - by JernejL - 19.05.2006, 15:55
Re: General Reference - by Allan - 29.05.2006, 15:42
Re: General Reference - by Manej - 31.05.2006, 00:15
Re: General Reference - by Allan - 31.05.2006, 01:02
Re: General Reference - by Allan - 06.06.2006, 21:10
Re: General Reference - by SidViciousII - 16.06.2006, 20:13
Re: General Reference - by RayW - 16.06.2006, 22:22
Re: General Reference - by DracoBlue - 17.06.2006, 09:26
Re: General Reference - by Allan - 17.06.2006, 10:11
Game Object ID's - by Spectre - 18.06.2006, 02:15
Re: General Reference - by Allan - 18.06.2006, 09:36
Re: General Reference - by Drakos - 18.06.2006, 11:06
Re: General Reference - by Allan - 18.06.2006, 11:38
Re: 0.2 coding information. - by Hell_Demon - 07.06.2007, 17:53
Re: 0.2 coding information. - by 50p - 08.06.2007, 17:54
Re: 0.2 coding information. - by weedarr - 09.06.2007, 09:10
Re: General Reference - by Betamaster - 10.06.2007, 22:36
Re: 0.2 coding information. - by vick - 11.06.2007, 07:13
Re: General Reference - by boylett - 16.06.2007, 19:04
Ped IDs - by Ottae - 18.06.2007, 14:19
Re: General Reference - by DracoBlue - 21.06.2007, 10:26
Re: General Reference - by supness420 - 26.06.2007, 02:02
Re: General Reference - by supness420 - 26.06.2007, 02:43
Re: General Reference - by hansen111 - 14.01.2008, 18:21
Re: General Reference - by BeckzyBoi - 14.01.2008, 19:09
Re: General Reference - by hansen111 - 17.01.2008, 11:34
Re: General Reference - by MaXx001 - 23.01.2008, 06:13
Re: General Reference - by BeckzyBoi - 28.01.2008, 19:54
Re: General Reference - by yom - 28.01.2008, 20:14
Re: General Reference - by yom - 17.02.2008, 05:18
Re: General Reference - by Simon - 18.02.2008, 05:35
Re: General Reference - by sparker_rus - 27.02.2008, 13:07
Re: General Reference - by ConTron - 28.02.2008, 17:25
Re: General Reference - by Hiitch - 24.12.2009, 12:47
Re: General Reference - by Backwardsman97 - 24.12.2009, 17:08
Re: General Reference - by jamesbond007 - 28.03.2010, 15:28
Re: General Reference - by Masj - 07.04.2010, 20:42
Re: General Reference - by Zamaroht - 27.05.2010, 22:43
Re: General Reference - by Hiddos - 07.07.2010, 16:43
Re: General Reference - by legodude - 13.07.2010, 19:21
Re: General Reference - by Lucy - 20.07.2010, 12:38
Re: General Reference - by FireCat - 16.08.2010, 13:32
Re: General Reference - by OKStyle - 06.09.2010, 04:25
Re: General Reference - by willsuckformoney - 03.10.2010, 20:05
Respuesta: Re: General Reference - by MrDeath537 - 01.12.2010, 20:15
Re: General Reference - by Miralem - 12.01.2011, 19:45
Re: General Reference - by xalyy - 26.01.2011, 12:35
Re: General Reference - by [03]Garsino - 01.02.2011, 06:35
Re: General Reference - by Superthijs - 09.08.2011, 16:59
Re: General Reference - by [03]Garsino - 14.08.2011, 19:46
Re: General Reference - by sleepysnowflake - 14.08.2011, 19:47
Re: General Reference - by Blantas - 18.09.2011, 18:20
Re: General Reference - by [03]Garsino - 18.09.2011, 21:13
Re: General Reference - by Kimori - 01.10.2011, 17:13
Re: General Reference - by Austin - 09.10.2011, 00:35
Re: General Reference - by Kimori - 09.10.2011, 06:50
Re: General Reference - by Kyle - 09.10.2011, 07:34
Re: General Reference - by Blantas - 05.04.2012, 08:29
Re: General Reference - by Hiddos - 29.04.2012, 16:15
Re: General Reference - by iggy1 - 06.07.2012, 10:21
Re: General Reference - by Stylock - 06.07.2012, 14:16
Re: General Reference - by iggy1 - 06.07.2012, 14:25
Re: General Reference - by Stylock - 06.07.2012, 15:54
Re: General Reference - by iggy1 - 06.07.2012, 16:46
Re: General Reference - by JoBullet - 07.07.2012, 00:03
Re: General Reference - by Kar - 07.07.2012, 17:58
Re: General Reference - by detter - 21.08.2012, 00:30
Re: General Reference - by Virus. - 28.10.2012, 11:19
Re: General Reference - by Lordzy - 28.10.2012, 11:30
Re: General Reference - by Virus. - 28.10.2012, 11:37
Re: General Reference - by Y_Less - 28.10.2012, 12:05
Re: General Reference - by [KHK]Khalid - 09.11.2012, 18:28
Re: General Reference - by Virus. - 19.11.2012, 08:22
Re: General Reference - by Y_Less - 19.11.2012, 09:35
Re: General Reference - by Schocc - 17.12.2012, 12:19
Re: General Reference - by SilverKiller - 03.02.2013, 14:00
Re: General Reference - by mastermax7777 - 11.02.2013, 04:35
Re: General Reference - by Austin - 04.04.2013, 11:19
Re: General Reference - by LarzI - 04.04.2013, 13:03
Re: COMANDO COM LIMITE DE DISTГNCIA - by Smoking_Script - 18.07.2013, 13:07
Re: General Reference - by Guest4390857394857 - 30.04.2014, 17:36
Re: General Reference - by MarvinPWN - 01.09.2015, 09:56
Re: General Reference - by Yashas - 17.10.2015, 15:03
Re: General Reference - by GangstaSunny - 05.02.2016, 06:24
Re: General Reference - by Crayder - 10.02.2016, 11:36
Re: General Reference - by AndreiWow - 15.04.2017, 20:05

Forum Jump:


Users browsing this thread: 1 Guest(s)