17.04.2015, 19:17
PHP код:
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
#define HOLDING(%0) \
((newkeys & (%0)) == (%0))
#define RELEASED(%0) \
(((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
new tempo[3];
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
new str[100];
if(PRESSED(KEY_YES))
{
tempo[0]++;
format(str,100,"PRESSED KEY_YES a %d",tempo[0]);
SendClientMessage(playerid, -1, str);
}
if(HOLDING(KEY_YES))
{
tempo[1]++;
format(str,100,"HOLDING KEY_YES a %d",tempo[1]);
SendClientMessage(playerid, -1, str);
}
if(RELEASED(KEY_YES))
{
tempo[2]++;
format(str,100,"RELEASED KEY_YES a %d",tempo[2]);
SendClientMessage(playerid, -1, str);
}
return 1;
}
enquanto a tecla estiver pressionada eu gostaria que acrecentasse a variavel, porйm ela ativa se so tocar na tecla... e caso o player segure ela nгo continua acrecentando a variavel so caso solte e reaperte