SA-MP Forums Archive
Key menu - 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 menu (/showthread.php?tid=584791)



Key menu - cnoopers - 08.08.2015

yo im just tryna make interactive menu that we can choose option by keys. i added there test messages which are unfortunately not called. what is wrong?
Код:
    if (newkeys & KEY_LEFT)
    {
        if(IsChosingClothe[playerid])
        {
            if(currentbinco[playerid] > 6)
            {
                currentbinco[playerid] = 0;
            }else
            {
            	currentbinco[playerid] = currentbinco[playerid]+1;
            }
            
            if(currentbinco[playerid] == 0)
            {
                SendClientMessage(playerid, -1, "0");
            }else if(currentbinco[playerid] == 1)
            {
                SendClientMessage(playerid, -1, "1");
            }else if(currentbinco[playerid] == 2)
            {
                SendClientMessage(playerid, -1, "2");
            }else if(currentbinco[playerid] == 3)
            {
                SendClientMessage(playerid, -1, "3");
            }else if(currentbinco[playerid] == 4)
            {
                SendClientMessage(playerid, -1, "4");
            }else if(currentbinco[playerid] == 5)
            {
                SendClientMessage(playerid, -1, "5");
            }else if(currentbinco[playerid] == 6)
            {
                SendClientMessage(playerid, -1, "6");
            }
        }
    }
    
    if (newkeys & KEY_RIGHT)
    {
        if(IsChosingClothe[playerid])
        {
            if(currentbinco[playerid] > 6)
            {
                currentbinco[playerid] = 0;
            }else
            {
            	currentbinco[playerid] = currentbinco[playerid]-1;
            }

            if(currentbinco[playerid] == 6)
            {
                SendClientMessage(playerid, -1, "6");
            }else if(currentbinco[playerid] == 5)
            {
                SendClientMessage(playerid, -1, "5");
            }else if(currentbinco[playerid] == 4)
            {
                SendClientMessage(playerid, -1, "4");
            }else if(currentbinco[playerid] == 3)
            {
                SendClientMessage(playerid, -1, "3");
            }else if(currentbinco[playerid] == 2)
            {
                SendClientMessage(playerid, -1, "2");
            }else if(currentbinco[playerid] == 1)
            {
                SendClientMessage(playerid, -1, "1");
            }else if(currentbinco[playerid] == 0)
            {
    			SendClientMessage(playerid, -1, "0");
            }
        }
    }



Re: Key menu - SickAttack - 08.08.2015

You cannot use those keys on that callback.

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


Re: Key menu - cnoopers - 08.08.2015

aight, i got that but key right is not callin properly - aint opposite to left just doesnt work if i wanna go from 0 to 6
Код:
    if (lr == KEY_LEFT)
    {
        if(IsChosingClothe[playerid])
        {
            if(currentbinco[playerid] > 6)
            {
                currentbinco[playerid] = 0;
            }else
            {
            	currentbinco[playerid] = currentbinco[playerid]+1;
            }

            if(currentbinco[playerid] == 0)
            {
                SendClientMessage(playerid, -1, "0");
            }else if(currentbinco[playerid] == 1)
            {
                SendClientMessage(playerid, -1, "1");
            }else if(currentbinco[playerid] == 2)
            {
                SendClientMessage(playerid, -1, "2");
            }else if(currentbinco[playerid] == 3)
            {
                SendClientMessage(playerid, -1, "3");
            }else if(currentbinco[playerid] == 4)
            {
                SendClientMessage(playerid, -1, "4");
            }else if(currentbinco[playerid] == 5)
            {
                SendClientMessage(playerid, -1, "5");
            }else if(currentbinco[playerid] == 6)
            {
                SendClientMessage(playerid, -1, "6");
            }
        }
    }

    if (lr == KEY_RIGHT)
    {
        if(IsChosingClothe[playerid])
        {
            if(currentbinco[playerid] > 6)
            {
                currentbinco[playerid] = 0;
            }else
            {
            	currentbinco[playerid] = currentbinco[playerid]-1;
            }

            if(currentbinco[playerid] == 6)
            {
                SendClientMessage(playerid, -1, "6");
            }else if(currentbinco[playerid] == 5)
            {
                SendClientMessage(playerid, -1, "5");
            }else if(currentbinco[playerid] == 4)
            {
                SendClientMessage(playerid, -1, "4");
            }else if(currentbinco[playerid] == 3)
            {
                SendClientMessage(playerid, -1, "3");
            }else if(currentbinco[playerid] == 2)
            {
                SendClientMessage(playerid, -1, "2");
            }else if(currentbinco[playerid] == 1)
            {
                SendClientMessage(playerid, -1, "1");
            }else if(currentbinco[playerid] == 0)
            {
    			SendClientMessage(playerid, -1, "0");
            }
        }
    }
whats wit it?


Re: Key menu - SickAttack - 08.08.2015

Are you using that on a timer?

If you want to use OnPlayerKeyStateChange(...), then consider using different keys.


Re: Key menu - cnoopers - 08.08.2015

i just put this stuff on onplayerupdate.
the problem is just with right key that from 0 cant go to 6 and then lower u know what im sayin


Re: Key menu - xVIP3Rx - 08.08.2015

Quote:
Originally Posted by cnoopers
Посмотреть сообщение
i just put this stuff on onplayerupdate.
the problem is just with right key that from 0 cant go to 6 and then lower u know what im sayin
I don't think you should use onplayerupdate for this kind of checks, however if you want to use it under "onplayerupdate" use "GetPlayerKeys"