SA-MP Forums Archive
Keys in other callback's. - 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: Keys in other callback's. (/showthread.php?tid=363058)



Keys in other callback's. - budelis - 26.07.2012

Hi. How i can check player pressed key, in my public? i mean i have a timer, and i want to check in him if player pressed a key like:

Код:
forward MYPUBLIC( playerid );
public MYPUBLIC( playerid )
if (PRESSED( KEY_HANDBRAKE ) )
{
//ACTION.
}
But i will get error, because newkeys is unknow and oldkeys. Maybe can help with this?


Re: Keys in other callback's. - Vince - 26.07.2012

GetPlayerKeys


Re: Keys in other callback's. - Stigg - 26.07.2012

Try:

pawn Код:
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
Lots of info here:

https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange
https://sampwiki.blast.hk/wiki/GetPlayerKeys


Re: Keys in other callback's. - budelis - 26.07.2012

Thanks. Maybe is a key ( S ) ?