SA-MP Forums Archive
GetPlayerKeys - 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: GetPlayerKeys (/showthread.php?tid=608895)



GetPlayerKeys - ScIrUsna - 06.06.2016

Hi

I want in onplayerupdate getplayerkeys for ex if player press key_fire key_jump.


Re: GetPlayerKeys - BornHuman - 06.06.2016

Use 'OnPlayerKeyStateChange' (wiki link: https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange)

Here's an example

PHP код:
public OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    if(
GetPVarInt(playerid"InAnimation") >= && (newkeys KEY_SPRINT) && !(oldkeys KEY_SPRINT))
    {
        if(
GetPVarInt(playerid"LoopingAnim") >= 1StopLoopingAnim(playerid);
        else 
        {
            
ClearAnimations(playerid);
            
DeletePVar(playerid"InAnimation");
        }
        
TextDrawHideForPlayer(playerid,AnimationHelper);
    }