SA-MP Forums Archive
The function for this? - 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: The function for this? (/showthread.php?tid=122865)



The function for this? - Torran - 23.01.2010

I've forgotten what function is used for this,
Ok so i will explain it so you can tell me because i cant remember it,
If i press shift it does the action: [pawn]print("Player pressed shift");[pawn]
Whats the function for that?


Re: The function for this? - LuxurioN™ - 23.01.2010

Quote:
Originally Posted by Torran
I've forgotten what function is used for this,
Ok so i will explain it so you can tell me because i cant remember it,
If i press shift it does the action: [pawn]print("Player pressed shift");[pawn]
Whats the function for that?
Prints a string to the server console. In server window (samp-server.exe).


Re: The function for this? - Torran - 23.01.2010

If you read it a bit better,
I want the bit to detect when i press shift,


Re: The function for this? - biltong - 23.01.2010

I believe it should be something like this:
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
   if(newkeys & 8) && !(oldkeys & 8)
   {
      printf("%s pressed the sprint key"); //assuming the shift key is your sprint key
      return 1;
   }
   return 1;
}
But I haven't tested it.