23.12.2013, 18:37
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:
And:
Errors:
Thanks to all the kind helpers.
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)))
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
}
Код:
(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