[Решено] Уничтожение таймера или ошибка Native "KillTimer" reported: Invalid timer handle

Тема в разделе "Программирование / Скриптинг", создана пользователем legend1998, 12 дек 2012.

  1. legend1998

    legend1998

    Сообщения:
    292
    Симпатии:
    178
    Всем привет!
    У меня возникла проблема при уничтожении таймера...
    Код снизу.

    Лог ошибок:
    HTML:
    L 12/12/2012 - 09:53:37: [SM] Native "KillTimer" reported: Invalid timer handle 4d190350 (error 1)
    L 12/12/2012 - 09:53:37: [SM] Displaying call stack trace for plugin "ata_rollthedice.smx":
    L 12/12/2012 - 09:53:37: [SM]   [0]  Line 455, ata_rollthedice.sp::EventPlayerSpawn()
    L 12/12/2012 - 09:55:29: [SM] Native "KillTimer" reported: Invalid timer handle 4d190350 (error 1)
    L 12/12/2012 - 09:55:29: [SM] Displaying call stack trace for plugin "ata_rollthedice.smx":
    L 12/12/2012 - 09:55:29: [SM]   [0]  Line 455, ata_rollthedice.sp::EventPlayerSpawn()
    L 12/12/2012 - 09:56:16: [SM] Native "KillTimer" reported: Invalid timer handle 4d190350 (error 3)
    L 12/12/2012 - 09:56:16: [SM] Displaying call stack trace for plugin "ata_rollthedice.smx":
    L 12/12/2012 - 09:56:16: [SM]   [0]  Line 675, ata_rollthedice.sp::EventPlayerDeath()
    L 12/12/2012 - 09:56:23: [SM] Native "KillTimer" reported: Invalid timer handle 4d190350 (error 3)
    L 12/12/2012 - 09:56:23: [SM] Displaying call stack trace for plugin "ata_rollthedice.smx":
    L 12/12/2012 - 09:56:23: [SM]   [0]  Line 455, ata_rollthedice.sp::EventPlayerSpawn()
    L 12/12/2012 - 09:57:19: [SM] Native "KillTimer" reported: Invalid timer handle 4d190350 (error 3)
    L 12/12/2012 - 09:57:19: [SM] Displaying call stack trace for plugin "ata_rollthedice.smx":
    L 12/12/2012 - 09:57:19: [SM]   [0]  Line 675, ata_rollthedice.sp::EventPlayerDeath()
    L 12/12/2012 - 09:57:43: [SM] Native "KillTimer" reported: Invalid timer handle 4d190350 (error 3)
    L 12/12/2012 - 09:57:43: [SM] Displaying call stack trace for plugin "ata_rollthedice.smx":
    L 12/12/2012 - 09:57:43: [SM]   [0]  Line 455, ata_rollthedice.sp::EventPlayerSpawn()
    L 12/12/2012 - 09:58:37: [SM] Native "KillTimer" reported: Invalid timer handle 4d190350 (error 3)
    L 12/12/2012 - 09:58:37: [SM] Displaying call stack trace for plugin "ata_rollthedice.smx":
    L 12/12/2012 - 09:58:37: [SM]   [0]  Line 675, ata_rollthedice.sp::EventPlayerDeath()
    L 12/12/2012 - 09:59:10: [SM] Native "KillTimer" reported: Invalid timer handle 4d190350 (error 3)
    L 12/12/2012 - 09:59:10: [SM] Displaying call stack trace for plugin "ata_rollthedice.smx":
    L 12/12/2012 - 09:59:10: [SM]   [0]  Line 455, ata_rollthedice.sp::EventPlayerSpawn()
    L 12/12/2012 - 10:00:37: [SM] Native "KillTimer" reported: Invalid timer handle 4d190350 (error 3)
    L 12/12/2012 - 10:00:37: [SM] Displaying call stack trace for plugin "ata_rollthedice.smx":
    L 12/12/2012 - 10:00:37: [SM]   [0]  Line 455, ata_rollthedice.sp::EventPlayerSpawn()
    L 12/12/2012 - 10:01:45: [SM] Native "KillTimer" reported: Invalid timer handle 4d190350 (error 3)
    L 12/12/2012 - 10:01:45: [SM] Displaying call stack trace for plugin "ata_rollthedice.smx":
    L 12/12/2012 - 10:01:45: [SM]   [0]  Line 455, ata_rollthedice.sp::EventPlayerSpawn()
    L 12/12/2012 - 10:02:44: [SM] Native "KillTimer" reported: Invalid timer handle 4d190350 (error 3)
    L 12/12/2012 - 10:02:44: [SM] Displaying call stack trace for plugin "ata_rollthedice.smx":
    L 12/12/2012 - 10:02:44: [SM]   [0]  Line 675, ata_rollthedice.sp::EventPlayerDeath()
    L 12/12/2012 - 10:02:49: [SM] Native "KillTimer" reported: Invalid timer handle 4d190350 (error 3)
    L 12/12/2012 - 10:02:49: [SM] Displaying call stack trace for plugin "ata_rollthedice.smx":
    L 12/12/2012 - 10:02:49: [SM]   [0]  Line 455, ata_rollthedice.sp::EventPlayerSpawn()
    L 12/12/2012 - 10:03:57: [SM] Native "KillTimer" reported: Invalid timer handle 4d190350 (error 3)
    L 12/12/2012 - 10:03:57: [SM] Displaying call stack trace for plugin "ata_rollthedice.smx":
    L 12/12/2012 - 10:03:57: [SM]   [0]  Line 675, ata_rollthedice.sp::EventPlayerDeath()
    L 12/12/2012 - 10:04:18: [SM] Native "KillTimer" reported: Invalid timer handle 4d190350 (error 3)
    L 12/12/2012 - 10:04:18: [SM] Displaying call stack trace for plugin "ata_rollthedice.smx":
    L 12/12/2012 - 10:04:18: [SM]   [0]  Line 455, ata_rollthedice.sp::EventPlayerSpawn()
    L 12/12/2012 - 10:05:42: [SM] Native "KillTimer" reported: Invalid timer handle 4d190350 (error 1)
    L 12/12/2012 - 10:05:42: [SM] Displaying call stack trace for plugin "ata_rollthedice.smx":
    L 12/12/2012 - 10:05:42: [SM]   [0]  Line 675, ata_rollthedice.sp::EventPlayerDeath()
    L 12/12/2012 - 10:05:53: [SM] Native "KillTimer" reported: Invalid timer handle 4d190350 (error 1)
    L 12/12/2012 - 10:05:53: [SM] Displaying call stack trace for plugin "ata_rollthedice.smx":
    L 12/12/2012 - 10:05:53: [SM]   [0]  Line 455, ata_rollthedice.sp::EventPlayerSpawn()
    L 12/12/2012 - 10:07:06: [SM] Native "KillTimer" reported: Invalid timer handle 4d190350 (error 3)
    L 12/12/2012 - 10:07:06: [SM] Displaying call stack trace for plugin "ata_rollthedice.smx":
    L 12/12/2012 - 10:07:06: [SM]   [0]  Line 455, ata_rollthedice.sp::EventPlayerSpawn()
    L 12/12/2012 - 10:08:21: [SM] Native "KillTimer" reported: Invalid timer handle 4d190350 (error 1)
    L 12/12/2012 - 10:08:21: [SM] Displaying call stack trace for plugin "ata_rollthedice.smx":
    L 12/12/2012 - 10:08:21: [SM]   [0]  Line 675, ata_rollthedice.sp::EventPlayerDeath()
    L 12/12/2012 - 10:08:30: [SM] Native "KillTimer" reported: Invalid timer handle 4d190350 (error 1)
    L 12/12/2012 - 10:08:30: [SM] Displaying call stack trace for plugin "ata_rollthedice.smx":
    L 12/12/2012 - 10:08:30: [SM]   [0]  Line 455, ata_rollthedice.sp::EventPlayerSpawn()
    L 12/12/2012 - 10:09:34: [SM] Native "KillTimer" reported: Invalid timer handle 4d190350 (error 1)
    L 12/12/2012 - 10:09:34: [SM] Displaying call stack trace for plugin "ata_rollthedice.smx":
    L 12/12/2012 - 10:09:34: [SM]   [0]  Line 675, ata_rollthedice.sp::EventPlayerDeath()
    L 12/12/2012 - 10:10:17: [SM] Native "KillTimer" reported: Invalid timer handle 4d190350 (error 1)
    L 12/12/2012 - 10:10:17: [SM] Displaying call stack trace for plugin "ata_rollthedice.smx":
    L 12/12/2012 - 10:10:17: [SM]   [0]  Line 455, ata_rollthedice.sp::EventPlayerSpawn()
    L 12/12/2012 - 10:10:40: [SM] Native "KillTimer" reported: Invalid timer handle 4d190350 (error 1)
    L 12/12/2012 - 10:10:40: [SM] Displaying call stack trace for plugin "ata_rollthedice.smx":
    L 12/12/2012 - 10:10:40: [SM]   [0]  Line 675, ata_rollthedice.sp::EventPlayerDeath()
    L 12/12/2012 - 10:11:41: [SM] Native "KillTimer" reported: Invalid timer handle 4d190350 (error 1)
    L 12/12/2012 - 10:11:41: [SM] Displaying call stack trace for plugin "ata_rollthedice.smx":
    L 12/12/2012 - 10:11:41: [SM]   [0]  Line 455, ata_rollthedice.sp::EventPlayerSpawn()
    L 12/12/2012 - 10:12:03: [SM] Native "KillTimer" reported: Invalid timer handle 4d190350 (error 1)
    L 12/12/2012 - 10:12:03: [SM] Displaying call stack trace for plugin "ata_rollthedice.smx":
    L 12/12/2012 - 10:12:03: [SM]   [0]  Line 675, ata_rollthedice.sp::EventPlayerDeath()
    L 12/12/2012 - 10:13:23: [SM] Native "KillTimer" reported: Invalid timer handle 4d190350 (error 1)
    L 12/12/2012 - 10:13:23: [SM] Displaying call stack trace for plugin "ata_rollthedice.smx":
    L 12/12/2012 - 10:13:23: [SM]   [0]  Line 455, ata_rollthedice.sp::EventPlayerSpawn()
    L 12/12/2012 - 10:14:28: [SM] Native "KillTimer" reported: Invalid timer handle 4d190350 (error 1)
    L 12/12/2012 - 10:14:28: [SM] Displaying call stack trace for plugin "ata_rollthedice.smx":
    L 12/12/2012 - 10:14:28: [SM]   [0]  Line 675, ata_rollthedice.sp::EventPlayerDeath()
    L 12/12/2012 - 10:15:07: [SM] Native "KillTimer" reported: Invalid timer handle 4d190350 (error 1)
    L 12/12/2012 - 10:15:07: [SM] Displaying call stack trace for plugin "ata_rollthedice.smx":
    L 12/12/2012 - 10:15:07: [SM]   [0]  Line 455, ata_rollthedice.sp::EventPlayerSpawn()
    L 12/12/2012 - 10:16:43: [SM] Native "KillTimer" reported: Invalid timer handle 4d190350 (error 1)
    L 12/12/2012 - 10:16:43: [SM] Displaying call stack trace for plugin "ata_rollthedice.smx":
    L 12/12/2012 - 10:16:43: [SM]   [0]  Line 455, ata_rollthedice.sp::EventPlayerSpawn()
    L 12/12/2012 - 10:17:33: [SM] Native "KillTimer" reported: Invalid timer handle 4d190350 (error 3)
    L 12/12/2012 - 10:17:33: [SM] Displaying call stack trace for plugin "ata_rollthedice.smx":
    L 12/12/2012 - 10:17:33: [SM]   [0]  Line 675, ata_rollthedice.sp::EventPlayerDeath()
    L 12/12/2012 - 10:17:56: [SM] Native "KillTimer" reported: Invalid timer handle 4d190350 (error 3)
    L 12/12/2012 - 10:17:56: [SM] Displaying call stack trace for plugin "ata_rollthedice.smx":
    L 12/12/2012 - 10:17:56: [SM]   [0]  Line 455, ata_rollthedice.sp::EventPlayerSpawn()
    L 12/12/2012 - 10:19:08: [SM] Native "KillTimer" reported: Invalid timer handle 4d190350 (error 1)
    L 12/12/2012 - 10:19:08: [SM] Displaying call stack trace for plugin "ata_rollthedice.smx":
    L 12/12/2012 - 10:19:08: [SM]   [0]  Line 675, ata_rollthedice.sp::EventPlayerDeath()
    L 12/12/2012 - 10:19:24: [SM] Native "KillTimer" reported: Invalid timer handle 4d190350 (error 1)
    L 12/12/2012 - 10:19:24: [SM] Displaying call stack trace for plugin "ata_rollthedice.smx":
    L 12/12/2012 - 10:19:24: [SM]   [0]  Line 455, ata_rollthedice.sp::EventPlayerSpawn()
    L 12/12/2012 - 10:19:33: [SM] Native "KillTimer" reported: Invalid timer handle 4d190350 (error 1)
    L 12/12/2012 - 10:19:33: [SM] Displaying call stack trace for plugin "ata_rollthedice.smx":
    L 12/12/2012 - 10:19:33: [SM]   [0]  Line 455, ata_rollthedice.sp::EventPlayerSpawn()
    L 12/12/2012 - 10:20:43: [SM] Native "KillTimer" reported: Invalid timer handle 4d190350 (error 1)
    L 12/12/2012 - 10:20:43: [SM] Displaying call stack trace for plugin "ata_rollthedice.smx":
    L 12/12/2012 - 10:20:43: [SM]   [0]  Line 675, ata_rollthedice.sp::EventPlayerDeath()
    L 12/12/2012 - 10:20:58: [SM] Native "KillTimer" reported: Invalid timer handle 4d190350 (error 3)
    L 12/12/2012 - 10:20:58: [SM] Displaying call stack trace for plugin "ata_rollthedice.smx":
    L 12/12/2012 - 10:20:58: [SM]   [0]  Line 400, ata_rollthedice.sp::OnMapEnd()
    L 12/12/2012 - 10:20:58: Error log file session closed.

    Искал... так и не нашел...
    Решение от schmidt снизу(кому надо).
     
    Последнее редактирование: 13 дек 2012
  2. FrozDark

    FrozDark Команда сайта HLMod Модератор

    Сообщения:
    1.761
    Симпатии:
    1.914
    Re: Не закрывается таймер или ошибка Native "KillTimer" reported: Invalid timer handle

    timer уже уничтожен... вот поэтому такие ошибки
     
  3. The End Is Near...

    The End Is Near... Russian Roulette

    Сообщения:
    893
    Симпатии:
    659
    Re: Не закрывается таймер или ошибка Native "KillTimer" reported: Invalid timer handle

    PHP:
    // wS

    public OnPluginStart()
    {
        new 
    Handle:tr CreateTrie();
        
    CloseHandle(tr);
        
    CloseHandle(tr); // ошибка
    }
     
    schmidt нравится это.
  4. legend1998

    legend1998

    Сообщения:
    292
    Симпатии:
    178
    Re: Не закрывается таймер или ошибка Native "KillTimer" reported: Invalid timer handle

    Искал. Нет второго закрытия Handle таймера.

    Но стоит оператор if:
    PHP:
    if(TimerEx[client] != INVALID_HANDLE)
    Разве это не поможет исправить эту ошибку?
     
  5. schmidt

    schmidt wS (skype: ws.css)

    Сообщения:
    188
    Симпатии:
    347
    Re: Не закрывается таймер или ошибка Native "KillTimer" reported: Invalid timer handle

    Ты не понял смысл ошибки. Она не из-за того, что закрывают Handle сразу несколько раз подряд, а из-за того, что закрывают недействительное Handle.

    Вот ты это Handle сохранил:

    PHP:
    g_phTimerClientBeacons[nClient] = CreateTimer(2.0TimerBeaconnClientTIMER_REPEAT);
    А в 'public Action:TimerBeacon' у тебя:

    PHP:
    KillTimer(timer);
    return 
    Plugin_Stop;
    Т.е. ты убил таймер, но не очистил его тут g_phTimerClientBeacons[nClient], и когда игрок рождается, ты делаешь:

    PHP:
    if (g_phTimerClientBeacons[nClient] != INVALID_HANDLE)
    {
        
    KillTimer(g_phTimerClientBeacons[nClient]);
        
    g_phTimerClientBeacons[nClient] = INVALID_HANDLE;
    }
    Вот и ошибка, таймер то уже не существует, а ты его снова Kill хочешь.
    Если убил таймер, то очищай все переменные, в которых его хранил, в твоем случае это:

    PHP:
    g_phTimerClientBeacons[nClient] = INVALID_HANDLE;
    И если у тебя таймер повторяющийся, то чтобы убить его, достаточно сделать return Plugin_Stop;
    KillTimer в этом случ не нужно использовать.

    [​IMG]
     
    legend1998 нравится это.
  6. legend1998

    legend1998

    Сообщения:
    292
    Симпатии:
    178
    Re: Уничтожение таймера или ошибка Native "KillTimer" reported: Invalid timer handle

    schmidt, спасибо =)
     
    Последнее редактирование: 13 дек 2012