Raised This Month: $ Target: $400
 0% 

[STOCK] Clear a timer


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
shavit
AlliedModders Donor
Join Date: Dec 2011
Location: Israel
Old 10-06-2012 , 00:29   [STOCK] Clear a timer
Reply With Quote #1

I'm making a BIG plugin for CS:S Jailbreak and it uses some timers, so I made this but in a native (the plugin will include an API with this native):
PHP Code:
stock ClearTimer(&Handle:Timer)
{
    if(
Timer != INVALID_HANDLE)
    {
        
CloseHandle(Timer);
        
Timer INVALID_HANDLE;
    }

Paste it in the bottom of your plugin and use it like in this example:
PHP Code:
new coolInt;

public 
Action:hellobuddy(clientargs)
{
          new 
Handle:MyTimer CreateTimer(30.0blabla_TIMER_FLAG_NOMAPCHANGE);
          
          switch(
coolInt)
          {
                    case 
3:
                    {
                              
ClearTimer(MyTimer);
                              
coolInt 0;
                    }
                    
                    
                    default:
                    {
                              
coolInt++;
                              
PrintToServer("hey homie the coolInt is now %i."coolInt);
                    }
          }

__________________
retired

Last edited by shavit; 10-06-2012 at 04:22.
shavit is offline
mcpan313
Senior Member
Join Date: Mar 2010
Old 10-06-2012 , 03:38   Re: [STOCK] Clear a timer
Reply With Quote #2

miss &
Code:
stock ClearTimer(&Handle:Timer)
{
    if(Timer != INVALID_HANDLE)
    {
        CloseHandle(Timer);
        Timer = INVALID_HANDLE;
    }
}
__________________
sorry, for my poor english.
mcpan313 is offline
Send a message via MSN to mcpan313
shavit
AlliedModders Donor
Join Date: Dec 2011
Location: Israel
Old 10-06-2012 , 04:23   Re: [STOCK] Clear a timer
Reply With Quote #3

Quote:
Originally Posted by mcpan313 View Post
miss &
Code:
stock ClearTimer(&Handle:Timer)
{
    if(Timer != INVALID_HANDLE)
    {
        CloseHandle(Timer);
        Timer = INVALID_HANDLE;
    }
}
whoops
__________________
retired
shavit is offline
ReFlexPoison
☠☠☠
Join Date: Jul 2011
Location: ☠☠☠
Old 10-06-2012 , 15:25   Re: [STOCK] Clear a timer
Reply With Quote #4

And you are the one who made this ... ?
ReFlexPoison is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 10-06-2012 , 15:40   Re: [STOCK] Clear a timer
Reply With Quote #5

Quote:
Originally Posted by ReFlexPoison View Post
And you are the one who made this ... ?
seeing as it is incredibly simple. im sure its been made like a million times lolz.
Doc-Holiday is offline
shavit
AlliedModders Donor
Join Date: Dec 2011
Location: Israel
Old 10-06-2012 , 16:09   Re: [STOCK] Clear a timer
Reply With Quote #6

Quote:
Originally Posted by ReFlexPoison View Post
And you are the one who made this ... ?
This one yes.

I think that they have to add a native like this to SourceMod.
__________________
retired
shavit is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 10-06-2012 , 16:12   Re: [STOCK] Clear a timer
Reply With Quote #7

Quote:
Originally Posted by shavit View Post
This one yes.

I think that they have to add a native like this to SourceMod.
its pretty easy and inexpensive to run this type of stock on your own in each plugin. its not really that big of a deal.


BUT INCREDIBLY USEFUL hahaha

Last edited by Doc-Holiday; 10-06-2012 at 16:13.
Doc-Holiday is offline
ReFlexPoison
☠☠☠
Join Date: Jul 2011
Location: ☠☠☠
Old 10-06-2012 , 16:22   Re: [STOCK] Clear a timer
Reply With Quote #8

Quote:
Originally Posted by shavit View Post
This one yes.

I think that they have to add a native like this to SourceMod.
Well I can tell you this post is really unnecessary as:
  • This stock has already been posted on the forum several times.
  • They probably wont be adding it as a native to core Sourcemod as simply just killing a timer and stating it as INVALID_HANDLE is all this stock does. (Read from older thread(s))
  • This has probably been used in several includes already.

Last edited by ReFlexPoison; 10-06-2012 at 16:38.
ReFlexPoison is offline
thetwistedpanda
Good Little Panda
Join Date: Sep 2008
Old 10-06-2012 , 19:26   Re: [STOCK] Clear a timer
Reply With Quote #9

This stock goes back a few years, just about every coder has one or uses one lol... (in b4 trash)
__________________

Last edited by thetwistedpanda; 10-06-2012 at 19:27.
thetwistedpanda is offline
shavit
AlliedModders Donor
Join Date: Dec 2011
Location: Israel
Old 10-06-2012 , 20:55   Re: [STOCK] Clear a timer
Reply With Quote #10

Quote:
Originally Posted by thetwistedpanda View Post
in b4 trash
meh
__________________
retired
shavit 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 18:28.


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