Jump to content
  • 0

Time remove fake icon


Question

Posted

I have this code that pulls the remaining time from a timestamp in the database, I am unable to remove the icon after the time is up, the icon count becomes negative..

 

OnPCLoginEvent:
    set @player_char_id, getcharid(0);
    // Obtém o horário atual do servidor como um tick de tempo
    set .@current_time_tick, gettimetick(2);

    // Obtém o tick de tempo de expiração de 'bossnia_free' da tabela
    query_sql("SELECT UNIX_TIMESTAMP(`bossnia_free`) FROM `char` WHERE `char_id` = " + getcharid(0), .@bossnia_free_time_tick);

    // Calcula a diferença de tempo em segundos
    set .@time_difference_seconds, (.@bossnia_free_time_tick - .@current_time_tick);

    // Verifica se o tempo restante é maior que zero
    if (.@time_difference_seconds > 0) {
        // Iniciar ou reiniciar o cronômetro
        set .@cronometer, .@time_difference_seconds;

        // Iniciar o ícone falso com o tempo em milissegundos
        set .@fake_icon_time_ms, .@cronometer * 1000;
        fakeIcon(getcharid(0), 981, .@fake_icon_time_ms, 1);
        addtimer 5000, "CheckBossniasMicroChip::OnCheckTimer";
    } else {
        // Remove o ícone se o tempo já tiver expirado
        fakeIcon(getcharid(0), 981, 0, 0);
    }

    end;


OnCheckTimer: 
    // Calcula o tempo restante

    // Verifica se ainda há tempo restante
        if (.@fake_icon_time_ms = 0) {
        fakeIcon(@player_char_id, 981, 0, 0);
        // Outras ações quando o tempo expira, se necessário
    }
    end;
}

any helps?

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...