Quick Help Needed! [OnPlayerKeyStateChange]
#1

Sup guys i need help with detecting if the player has pressed a key, and if he released it.

At the top of the script i have added:
pawn Код:
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
#define RELEASED(%0) \
    (((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
And:

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(PlayerInfo[playerid][XXX] == 1 && PlayerInfo[playerid][XXXY] == 1) // Line 286
    { // Line 287
        if(PRESSED(KEY_AIM)) // Line 288
        { // Line 289
            SendClientMessage(playerid, WHITE, "Something."); // Line 290
        } // Line 291
        else if(RELEASED(KEY_AIM)) // Line 292
        { // Line 293
            ClearAnimations(playerid); // Line 294
        } // Line 295
        if((newkeys & KEY_WALK) && !(oldkeys & KEY_WALK)) //line 296
        { //line 297
            ApplyAnimation(playerid,"PED","WALK_armed",4.1, 1, 1, 1, 0, 0, 0); //Line 298
        } // Line 299
    } // Line 300
}
Errors:
Код:
(Line: 288 ) : error 029: invalid expression, assumed zero
(Line: 290) : error 001: expected token: ")", but found ";"
(Line: 290) : error 036: empty statement
(Line: 292) : error 029: invalid expression, assumed zero
(Line: 294) : error 001: expected token: ")", but found ";"
(Line: 294) : error 036: empty statement
(Line: 296) : error 010: invalid function or declaration
Thanks to all the kind helpers.
Reply


Messages In This Thread
Quick Help Needed! [OnPlayerKeyStateChange] - by $Marco$ - 23.12.2013, 18:37
Re: Quick Help Needed! [OnPlayerKeyStateChange] - by Vince - 23.12.2013, 18:39
Re: Quick Help Needed! [OnPlayerKeyStateChange] - by $Marco$ - 23.12.2013, 18:41
Re: Quick Help Needed! [OnPlayerKeyStateChange] - by Konstantinos - 23.12.2013, 18:42
Re: Quick Help Needed! [OnPlayerKeyStateChange] - by $Marco$ - 23.12.2013, 18:50

Forum Jump:


Users browsing this thread: 2 Guest(s)