Holding Key problem
#1

I wanted to make a lumberjack system but i cant find how to detect player holding the KEY_FIRE.
I already try to use the code below , but it not work
PHP код:
#define HOLDING(%0) ((newkeys & (%0)) == (%0)) 
Someone can help me?
Reply
#2

PHP код:
public OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
if(
HOLDING(KEY_FIRE))
{
    
SendClientMessage(playerid,-1,"[KEY HOLDING]:You're Now Holding LMB.");
}
  return 
1;

This Should Work.
Reply
#3

i try it but the HOLDING function is just same as PRESSED
Reply
#4

pawn Код:
#define HOLDING(%0) ((newkeys & (%0)) == (%0))
Is only called once, its registers an instance when you start holding the key and exists until you release.
So i guess you are looking for a back to back calling, for that case, declare a timer when player starts holding and then do your code in the timer. Also, when player RELEASE the key, kill the timer.
Reply
#5

Thanks for your idea it work with a timer!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)