KillTimer not work
#1

PHP код:
    TextDrawShowForPlayer(playeridTimeBank[playerid]);
        
Time[playerid] = 10;
    
SetTimerEx("CountDown"10001"i",playerid);
forward CountDown(playerid);
public 
CountDown(playerid)
{
    new 
string[30];
    if(
Time[playerid] == 0)
    {
        
ResetRobbery(playerid1);
        
TextDrawHideForPlayer(playeridTimeBank[playerid]);
        
KillTimer(TimerCount[playerid]);
        
TimerCount[playerid] = -1;
        
SendClientMessage(playerid0xFFFFFFFF"0");
        return;
    }
    
Time[playerid] --;
    
format(stringsizeof string"%s",ConvertToMinutes(Time[playerid]));
    
TextDrawSetString(TimeBank[playerid], string);

chatlog.txt
PHP код:
[14:12:220
[14:12:230
[14:12:240
[14:12:250
[14:12:260
[14:12:270
[14:12:280
[14:12:29
Why not work?
Reply
#2

Change
Код:
SetTimerEx("CountDown", 1000, 1, "i",playerid);
to
Код:
TimerCount[playerid] = SetTimerEx("CountDown", 1000, 1, "i",playerid);
Reply
#3

Quote:
Originally Posted by GoldenLion
Посмотреть сообщение
Change
Код:
SetTimerEx("CountDown", 1000, 1, "i",playerid);
to
Код:
TimerCount[playerid] = SetTimerEx("CountDown", 1000, 1, "i",playerid);
Thanks.i forget TimerCount[playerid]
Reply
#4

Why this timer not kill?
PHP код:
    if(UseCmd[playerid] == 5)
    {
        
TimerCMD[playerid] = SetTimerEx("EnableUse"12000true"d"playerid);
        return 
1;
    } 
PHP код:

forward EnableUse
(playerid);
public 
EnableUse(playerid)
{
    if(
UseCmd[playerid] == 0)
    {
        
KillTimer(TimerCMD[playerid]);
        
TimerCMD[playerid] = -1;
        
SendClientMessage(playerid,COLOR_ERROR,"0");
        return 
1;
    }
    
UseCmd[playerid] --;
    return 
1;

chatlog
PHP код:
[14:46:060
[14:46:110
[14:46:140
[14:46:200
[14:46:240
[14:46:27
Reply
#5

Maybe you start the timer more than one time?
Reply
#6

try this

PHP код:
forward EnableUse(playerid);
public 
EnableUse(playerid)
{
    if(
UseCmd[playerid] != 0)
    {
        
UseCmd[playerid] --;
        if(
UseCmd[playerid] == 0)
        {
            
KillTimer(TimerCMD[playerid]);
            
TimerCMD[playerid] = -1;
            
SendClientMessage(playerid,COLOR_ERROR,"0");
        }
    }
    return 
1;

Reply
#7

Quote:
Originally Posted by Kaliber
Посмотреть сообщение
Maybe you start the timer more than one time?
Yes,When UseCmd for player is 5 and again use cmd,Timer create again.
PHP код:
    if(UseCmd[playerid] == 5
    { 
        
TimerCMD[playerid] = SetTimerEx("EnableUse"12000true"d"playerid); 
        return 
1
    } 
How to check timer is valid?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)