SA-MP Forums Archive
KillTimer not work - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: KillTimer not work (/showthread.php?tid=620186)



KillTimer not work - MRM - 27.10.2016

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?


Re: KillTimer not work - GoldenLion - 27.10.2016

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



Re: KillTimer not work - MRM - 27.10.2016

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]


Re: KillTimer not work - MRM - 27.10.2016

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



Re: KillTimer not work - Kaliber - 27.10.2016

Maybe you start the timer more than one time?


Re: KillTimer not work - IceBilizard - 27.10.2016

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;




Re: KillTimer not work - MRM - 27.10.2016

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?