need little help in keystatechange.
#1

Hello, I got a little problem.

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (PRESSED(KEY_ACTION))
    {
        // My enabled code
    }
    else if (PRESSED(KEY_ACTION))
    {
        // My disabled code
    }
    return 1;
}
when i press action key, it enables. But when i press that key again, it doesn't disable.
Reply
#2

pawn Код:
new SomeVar[MAX_PLAYERS];
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (PRESSED(KEY_ACTION))
    {
        if(SomeVar[playerid] == 0) {
            // My enabled code
            SomeVar[playerid] = 1;
        } else {
            // My disabled code
            SomeVar[playerid] = 0;
        }
    }
    return 1;
}
YOu can do like that.. and will be (Tap (activated) Tap (deactivated)

or you can use RELEASED .. check samp wiki for RELEASED
Reply
#3

Thank You BRO!
++Rep;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)