Key menu
#1

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");
            }
        }
    }
Reply
#2

You cannot use those keys on that callback.

https://sampwiki.blast.hk/wiki/GetPlayerKeys
Reply
#3

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?
Reply
#4

Are you using that on a timer?

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

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
Reply
#6

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"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)