21.05.2013, 15:01
How do I listen to keys and let them return cmds?
For example:
I press F and the command /hi will happen.
For example:
I press F and the command /hi will happen.
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (PRESSED(KEY_SECONDARY_ATTACK))
{
CMD:hi(playerid, params[])
{
/// Your things
}
}
return 1;
}
if (PRESSED(KEY_SECONDARY_ATTACK)) { return cmd_enter(playerid, params); } |
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (PRESSED(KEY_SECONDARY_ATTACK))
{
CMD:hi(playerid, params[])
{
/// Your things
}
}
return 1;
}