SA-MP Forums Archive
How to detect Left Shift inside vehicle? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to detect Left Shift inside vehicle? (/showthread.php?tid=364011)



How to detect Left Shift inside vehicle? - ricardo178 - 29.07.2012

Well, my question is simple. How do i detect when player press Left shift inside a vehicle? detecting KEY_JUMP is not working, also it says it takes no effect inside vehicle on GetPlayerKeys in wiki.

But i've seen many scripts starting car engine at Left Shift.. :/

Thanks


Re: How to detect Left Shift inside vehicle? - Vince - 29.07.2012

Keys are different in vehicle. Add a print statement in OnPlayerKeyStateChange to print the values of the keys. Then go in a vehicle and press Left Shift to see what it returns.


Re : How to detect Left Shift inside vehicle? - ricardo178 - 29.07.2012

Any tip on how to get that value? I mean, what should i make it print.


Re: How to detect Left Shift inside vehicle? - Cjgogo - 29.07.2012

Take a look at the whole page,it's interesting,I mean you are provided with the value of every key...
https://sampwiki.blast.hk/wiki/GetPlayerKeys


Re : Re: How to detect Left Shift inside vehicle? - ricardo178 - 29.07.2012

Quote:
Originally Posted by Cjgogo
Посмотреть сообщение
Take a look at the whole page,it's interesting,I mean you are provided with the value of every key...
https://sampwiki.blast.hk/wiki/GetPlayerKeys
I did, there is no information about what key to use, in case i want Shift inside vehicle.


Re: How to detect Left Shift inside vehicle? - Cjgogo - 29.07.2012

Did you see the table with all keys values and THEIR NAME for OnFoot state and OnVehicle STATE?Basically did you scroll down?


Re: How to detect Left Shift inside vehicle? - Vince - 29.07.2012

I mean like:
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    printf("[debug] OnPlayerKeyStateChange(playerid = %d, newkeys = %d, oldkeys = %d)", playerid, newkeys, oldkeys);
    // rest of code
}
Then just look what it returns for newkeys when you press LSHIFT in vehicle.


Re : How to detect Left Shift inside vehicle? - ricardo178 - 29.07.2012

Will try that Vince. Thank you.


Re : How to detect Left Shift inside vehicle? - ricardo178 - 30.07.2012

If i am outside it prints the key, otherway it just don't do anything. ;(