SA-MP Forums Archive
How to .. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to .. (/showthread.php?tid=177599)



How to .. - Matej_ - 18.09.2010

How can I detect if player has pressed key space ?


Re: How to .. - Hiddos - 18.09.2010

Well, direct key detection is impossible with the standard PAWN functions, but you can detect the function that the player usually uses for the space key: The sprint function.

So I guess you'd be using it like this:

pawn Код:
new keys[3];
GetPlayerKeys(playerid, keys[0], keys[1], keys[2]); //keys[0] contains the "other" key values, keys[1] contains the left & right value, and keys[2] contains the up & down value.
if(keys[0] & KEY_SPRINT)//If the player presses the sprint key, usually spacebar
{
  //Do stuff
}



Re: How to .. - Mike_Peterson - 18.09.2010

Quote:
Originally Posted by Hiddos
Посмотреть сообщение
if(keys[0] & KEY_SPRINT)//If the player presses the sprint key, usually spacebar
disagree, lots of people have jump for spacebar not sprint.


Re: How to .. - Matej_ - 18.09.2010

Quote:
Originally Posted by Mike_Peterson
Посмотреть сообщение
disagree, lots of people have jump for spacebar not sprint.
I use left shift to jump