SA-MP Forums Archive
OnPlayerRequestClass [Determine 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: OnPlayerRequestClass [Determine Button] (/showthread.php?tid=442567)



OnPlayerRequestClass [Determine Button] - Glad2BeHere - 08.06.2013

Is there a way to determine whether the player pressed the back button or forward button ?


Re: OnPlayerRequestClass [Determine Button] - dEcooR - 08.06.2013

In requestclass? Backbutton ? This is 0.3x welcome


Re: OnPlayerRequestClass [Determine Button] - JaKe Elite - 08.06.2013

You can't detect it.
However, you can detect it (But both of them) which is the OnPlayerRequestClass.
You can detect if player click spawn button which is the OnPlayerRequestSpawn.


Re: OnPlayerRequestClass [Determine Button] - S0n1COwnsYou - 08.06.2013

Glad2BeHere, of you want to detect "<<" & ">>"

Create a custom OnPlayerRequestClass with clickable textdraws(Buttons)


Re: OnPlayerRequestClass [Determine Button] - Glad2BeHere - 08.06.2013

bleh.......... the was open Z... i didn't want to go there


Re: OnPlayerRequestClass [Determine Button] - Vince - 08.06.2013

It's not that hard. Just keep track of their last selected classid. If the current classid is higher than the previous one they clicked forward, if it's lower they clicked backward. Of course you would need to take into account that it also wraps around. So if you have classid 299 and the next one is 1 then the player pressed forward but the thing wrapped around.
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    static
        lastClass[MAX_PLAYERS];

    if(classid > lastClass[playerid])
    {
        // press forward
    }
    else if(classid < lastClass[playerid])
    {
        // press backward
    }
    lastClass[playerid] = classid;
    return 1;
}