SA-MP Forums Archive
problem with keys. - 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: problem with keys. (/showthread.php?tid=278535)



problem with keys. - ajwar - 22.08.2011

I want to make that if player is holding W and S he gets a sound. I use onplayerupdate:

in top:
pawn Code:
// HOLDING(keys)
#define HOLDING(%0) \
    ((newkeys & (%0)) == (%0)
pawn Code:
new newkeys, updown, leftright;
        GetPlayerKeys(playerid, newkeys, updown, leftright);
        if (HOLDING( KEY_UP | KEY_DOWN ))
        {

            SetPVarInt(playerid, "wheelsBOOM",GetPVarInt(playerid, "wheelsBOOM")+1);
            if(GetPVarInt(playerid, "wheelsBOOM") == 4)
            {
                SetPVarInt(playerid, "wheelsBOOM",0);
   
                PlayerPlaySound(playerid, 1159, 0.0, 0.0, 0.0);

            }
        }



Re: problem with keys. - sleepysnowflake - 22.08.2011

if (HOLDING( KEY_UP || KEY_DOWN ))


Re: problem with keys. - ajwar - 22.08.2011

this returns:
warning 213: tag mismatch


Re: problem with keys. - Dragony92 - 22.08.2011

if (HOLDING((KEY_UP) || (KEY_DOWN)))