SA-MP Forums Archive
key-strokes if - 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: key-strokes if (/showthread.php?tid=426314)



key-strokes if - Omirrow - 28.03.2013

Graffiti System for "key_fire" and "key_aim" where editing? how should



Re: key-strokes if - MP2 - 28.03.2013

Sense made this did.


Re: key-strokes if - Omirrow - 28.03.2013

Key-strokes' how can I do?

I did;

if ((newkeys & KEY_FIRE) && (OldKeys & KEY_FIRE) | | (newkeys & KEY_FIRE) && (OldKeys & KEY_HANDBRAKE))


Re: key-strokes if - Omirrow - 28.03.2013

I'd appreciate it if you help just stayed.


Re: key-strokes if - MP2 - 28.03.2013

if(HOLDING(KEY_AIM) && PRESSED(KEY_FIRE))

KEY_AIM isn't defined by default. Add this at the top of your script:

#define KEY_AIM KEY_HANDBRAKE

Also, HOLDING() and PRESSED() are macros that can be found here: https://sampwiki.blast.hk/wiki/GetPlayerKeys

Help to happy, am I.


Re: key-strokes if - Omirrow - 28.03.2013

Quote:
Originally Posted by MP2
Посмотреть сообщение
if(HOLDING(KEY_AIM) && PRESSED(KEY_FIRE))

KEY_AIM isn't defined by default. Add this at the top of your script:

#define KEY_AIM KEY_HANDBRAKE

Also, HOLDING() and PRESSED() are macros that can be found here: https://sampwiki.blast.hk/wiki/GetPlayerKeys

Help to happy, am I.
Thank you


Re: key-strokes if - MP2 - 28.03.2013

Wrong wiki article, I meant

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


Re: key-strokes if - Omirrow - 28.03.2013

https://sampforum.blast.hk/showthread.php?tid=425664 - Can help?




Re: key-strokes if - Omirrow - 28.03.2013

"undefined" error fix

pawn Код:
#define HOLDING(%0) \
    ((newkeys & (%0)) == (%0))
   

#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))



Re: key-strokes if - Omirrow - 28.03.2013

codes did not work

I fixed;

pawn Код:
if((newkeys & KEY_FIRE) && (oldkeys & KEY_FIRE) || (newkeys & KEY_FIRE) && (oldkeys & KEY_HANDBRAKE))
           {
                    if(GetPlayerWeapon(playerid) == 41 && GraffitiBoyuyor[playerid] == 1)
                    {
           SetTimerEx("SprayBoyuyorKontrol", 500, false, "d", playerid);
                    }
           }
pawn Код:
forward SprayBoyuyorKontrol(playerid);
    public SprayBoyuyorKontrol(playerid)
    {
            new keys, ud, lr;
            GetPlayerKeys(playerid, keys, ud, lr);

            if (!(keys & CCKey))
            {
                    return false;
            }
                if(PlayerToPoint(5.0,playerid,Graffitiler[DuzenledigiGraffiti[playerid]][ObjeX],Graffitiler[DuzenledigiGraffiti[playerid]][ObjeY],Graffitiler[DuzenledigiGraffiti[playerid]][ObjeZ]))
                {
                    if(GetPlayerWeapon(playerid) == 41 && GraffitiBoyuyor[playerid] == 1)
                    {
                        Graffitiler[DuzenledigiGraffiti[playerid]][Kalan] -= 1;
                    }
                }
            return SetTimerEx("SprayBoyuyorKontrol",500, false, "d", playerid);
    }