Jump to content
  • 0

Time remove fake icon


Westin

Question


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  11
  • Reputation:   1
  • Joined:  10/25/12
  • Last Seen:  

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?

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.05
  • Content Count:  45
  • Reputation:   25
  • Joined:  09/09/23
  • Last Seen:  

 if (.@fake_icon_time_ms = 0) {

Try changing that line to this one

 if (.@fake_icon_time_ms == 0) {

 

Link to comment
Share on other sites

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.

×
×
  • Create New...