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



Mouse button - Ananisiki - 29.04.2014

How i can do like if the fly is 0, and player press mmb then he will fly, if he already on fly mode he will be stop from flymode, how


pawn Код:
if (newkeys == KEY_LOOK_BEHIND || newkeys == KEY_SUBMISSION)
    {
        StartFly(playerid);
    }



Re: Mouse button - Dignity - 29.04.2014

pawn Код:
// top of script

new flying[MAX_PLAYERS];

// rest..

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (newkeys == KEY_LOOK_BEHIND || newkeys == KEY_SUBMISSION)
    {
        if(flying[playerid] == 0)
        {
            StartFly(playerid);
            flying[playerid] = 1;
        }
       
        else if(flying[playerid] == 1)
        {
            StopFly(playerid);
            flying[playerid] = 0;
        }
    }
}
EDIT: I'm not sure but I don't think the "==" operator works in this case.

pawn Код:
if (newkeys == KEY_LOOK_BEHIND || newkeys == KEY_SUBMISSION)
to

pawn Код:
if (newkeys & KEY_LOOK_BEHIND || newkeys & KEY_SUBMISSION)



Re: Mouse button - Ananisiki - 29.04.2014

ty +rep