[Ajuda] OnPlayerKeyStateChange
#3

Quote:
Originally Posted by adailtongamer
Посмотреть сообщение
tenta ai :

PHP код:
    if ((newkeys KEY_YES) && !(oldkeys KEY_YES))
    {
        
tempo[0]++;
        
format(str,100,"PRESSED KEY_YES a %d",tempo[0]);
        
SendClientMessage(playerid, -1str);
    } 
Й a msm coisa mais vlw .-.

Eu fiz algo como isto, e funcionou porйm quando o player segura a tecla e outra junta como KEY_SPRINT, nгo adiciona o valor na variavel
PHP код:
public OnGameModeInit()
{
    
SetTimer("Opa"10001);
    return 
1;
}
new var;
forward Opa();
public 
Opa()
{
    new 
Key[3];
    
GetPlayerKeys(0Key[0], Key[1], Key[2]);
    if(
Key[0] == KEY_FIRE)
    {
        var ++;
        new 
str[120];
        
format(str,120,"KEY_FIRE %d",var);
        
SendClientMessage(0, -1str);
    }
}
#define RELEASED(%0) \
    
(((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    if(
RELEASED(KEY_FIRE))
    {
        if(var)
        {
            new 
str[120];
            
format(str,120,"KEY_FIRE parou de apertar %d",var);
            
SendClientMessage(0, -1str);
            var = 
0;
        }
    }
    return 
1;

Reply


Messages In This Thread
OnPlayerKeyStateChange - by Dayvison_ - 17.04.2015, 19:17
Re: OnPlayerKeyStateChange - by adailtongamer - 17.04.2015, 21:21
Re: OnPlayerKeyStateChange - by Dayvison_ - 17.04.2015, 21:27
Re: OnPlayerKeyStateChange - by Dayvison_ - 17.04.2015, 21:42

Forum Jump:


Users browsing this thread: 2 Guest(s)