Need Help with OnPlayerKeyStateChange
#1

Hi Community,
I somebody to help me.

This function won't work, but i dont know why

Function:

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys == KEY_SUBMISSION)
        {
        switch (gPlayerClass[playerid])
            {
                case 0: // Team 1
                    {
                    if(PlayerToPoint(20.0, playerid, 247.0646,1859.7402,14.0840))
                    {
                    ShowMenuForPlayer(wmenu, playerid);
                    }
                }
                case 1: // Team 2
                    {
                    if(PlayerToPoint(20.0, playerid, -8.9192,1675.0691,17.5219))
                    {
                    ShowMenuForPlayer(wmenu, playerid);
                    }
                }
            }
        }
        return 1;
}
- Regards, MikeX
Reply
#2

there is something that you cant know

--> OnPlayerKeyStateChange
Reply
#3

Hi,
Sorry my English is not so good
But i dont know what i must do, to fix it

- MikeX
Reply
#4

If you just would had clicked the link and read all that you would have known but I think thats hard if your english isnt very well so
I copied it from the wiki and I hope you understand that you need to use of one the definitions
pawn Код:
// PRESSING(newkeys, keys)
#define PRESSING(%0,%1) \
    (((%0) & (%1)) == (%1))
 
// PRESSED(newkeys, oldkeys, keys)
#define PRESSED(%0,%1,%2) \
    ((((%0) & (%2)) == (%2)) && (((%1) & (%2)) != (%2)))
 
// RELEASED(newkeys, oldkeys, keys)
#define RELEASED(%0,%1,%2) \
    ((((%0) & (%2)) != (%2)) && (((%1) & (%2)) == (%2)))
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (PRESSING(newkeys, KEY_SPRINT))
    {
        DoSomething(playerid);
    }
}
Reply
#5

Hi,

The problem is Fixed !!

- MikeX
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)