04.06.2017, 19:00
Hello, how can i add a commands that will be executed when mmb is pressed?
#define PRESSED(%0) (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if(PRESSED(KEY_LOOK_BEHIND)) { // execute command } return 1; }
Код:
#define PRESSED(%0) (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0))) Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if(PRESSED(KEY_LOOK_BEHIND)) { // execute command } return 1; } |
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if(newkeys & /*<Insert your key here>*/) { //<Insert your action/code here> } return 1; }
if ((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE))