Raised This Month: $32 Target: $400
 8% 

Solved How to kill a timer after a certain time?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 12-11-2017 , 00:02   How to kill a timer after a certain time?
Reply With Quote #1

Hey guys, I need help with this:

PHP Code:
public Action Command_Chase(int clientint args)
{
     
//Insert code here
     
CreateTimer(0.1TimerUpdatePlayer0TIMER_REPEAT);
     
CreateTimer(30.0StopPunish);
}

public 
Action TimerUpdatePlayer(Handle timerany data)
{
     
//Insert code here
}

public 
Action StopPunish(Handle timer)
{
     
KillTimer(TimerUpdatePlayer);

I want to make it to where the player enters a command to trigger TimerUpdatePlayer and have that timer repeat for only 30 seconds before killing itself.
__________________

Last edited by Psyk0tik; 12-11-2017 at 02:17. Reason: Marked as [Solved]
Psyk0tik is offline
Lux
Veteran Member
Join Date: Jan 2015
Location: Cat
Old 12-11-2017 , 00:13   Re: How to kill a timer after a certain time?
Reply With Quote #2

PHP Code:
public Action Command_Chase(int clientint args)
{
    
//Insert code here
    
CreateTimer(0.1TimerUpdatePlayerGetEngineTime() + 30.0TIMER_REPEAT);// i don't know if 0 was used for anything.
    
}

public 
Action TimerUpdatePlayer(Handle timerany data)
{
    
//Insert code here
    
    
if(data GetEngineTime())
        return 
Plugin_Stop;// return Plugin_Stop = Stop timer
    
    
return Plugin_Continue;//continue the reapeat timer the return needs to be here it you will get compiler warning about should returning a value

__________________
Connect
My Plugins: KlickME
[My GitHub]

Commission me for L4D
Lux is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 12-11-2017 , 02:16   Re: How to kill a timer after a certain time?
Reply With Quote #3

Quote:
Originally Posted by Lux View Post
PHP Code:
public Action Command_Chase(int clientint args)
{
    
//Insert code here
    
CreateTimer(0.1TimerUpdatePlayerGetEngineTime() + 30.0TIMER_REPEAT);// i don't know if 0 was used for anything.
    
}

public 
Action TimerUpdatePlayer(Handle timerany data)
{
    
//Insert code here
    
    
if(data GetEngineTime())
        return 
Plugin_Stop;// return Plugin_Stop = Stop timer
    
    
return Plugin_Continue;//continue the reapeat timer the return needs to be here it you will get compiler warning about should returning a value

That worked. Thanks!
__________________
Psyk0tik is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:09.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode