Holding Key problem - 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: Holding Key problem (
/showthread.php?tid=607649)
Holding Key problem -
JawsPlus - 22.05.2016
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?
Re: Holding Key problem - WhiteGhost - 22.05.2016
PHP код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(HOLDING(KEY_FIRE))
{
SendClientMessage(playerid,-1,"[KEY HOLDING]:You're Now Holding LMB.");
}
return 1;
}
This Should Work.
Re: Holding Key problem -
JawsPlus - 22.05.2016
i try it but the HOLDING function is just same as PRESSED
Re: Holding Key problem -
Gammix - 22.05.2016
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.
Re: Holding Key problem -
JawsCraft - 22.05.2016
Thanks for your idea it work with a timer!