Raised This Month: $ Target: $400
 0% 

Using remove_task() without check with task_exists()


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Flipper_SPb
Senior Member
Join Date: Jun 2009
Location: Worldspawn
Old 10-04-2011 , 09:14   Using remove_task() without check with task_exists()
Reply With Quote #1

Is it correct? (task may be missing.)
__________________
Полный похуизм.
Flipper_SPb is offline
Send a message via ICQ to Flipper_SPb
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-04-2011 , 09:21   Re: Using remove_task() without check with task_exists()
Reply With Quote #2

No, it's fine. No need to check, you can remove directly.
__________________
Arkshine is offline
Flipper_SPb
Senior Member
Join Date: Jun 2009
Location: Worldspawn
Old 10-04-2011 , 10:19   Re: Using remove_task() without check with task_exists()
Reply With Quote #3

Thank you.
__________________
Полный похуизм.
Flipper_SPb is offline
Send a message via ICQ to Flipper_SPb
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 10-04-2011 , 18:05   Re: Using remove_task() without check with task_exists()
Reply With Quote #4

Only check if you need to check if task is run
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 10-05-2011 , 11:31   Re: Using remove_task() without check with task_exists()
Reply With Quote #5

Quote:
Originally Posted by ^SmileY View Post
Only check if you need to check if task is run
There is no reason why you should check if the task exists and then removing it. Removing it straight away (even though it doesn't necessarily exist) is more efficient.
__________________
Achievements API - a simple way for you to create your OWN custom achievements!
Xellath is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-05-2011 , 12:01   Re: Using remove_task() without check with task_exists()
Reply With Quote #6

Quote:
Originally Posted by Xellath View Post
There is no reason why you should check if the task exists and then removing it. Removing it straight away (even though it doesn't necessarily exist) is more efficient.
You may want to know if a task is running ;)
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 10-05-2011 , 13:35   Re: Using remove_task() without check with task_exists()
Reply With Quote #7

Quote:
Originally Posted by ConnorMcLeod View Post
You may want to know if a task is running ;)
Yes, of course. But there is no reason to check whether it exists or not IF you're going to remove it.
__________________
Achievements API - a simple way for you to create your OWN custom achievements!
Xellath is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-05-2011 , 13:37   Re: Using remove_task() without check with task_exists()
Reply With Quote #8

You know he has been already answered 2 times. You simply did not understand ^SmileY's post. He was talking about checking only.
__________________
Arkshine is offline
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 10-05-2011 , 13:58   Re: Using remove_task() without check with task_exists()
Reply With Quote #9

I must have misread, his statement is correct. My bad.
__________________
Achievements API - a simple way for you to create your OWN custom achievements!
Xellath is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 10-05-2011 , 13:59   Re: Using remove_task() without check with task_exists()
Reply With Quote #10

Quote:
Originally Posted by Arkshine View Post
You know he has been already answered 2 times. You simply did not understand ^SmileY's post. He was talking about checking only.
PHP Code:
public func(Client)
{
    if(
task_exists(Client))
    {
        
client_print(Client,3,"Your Task is running!!");

        
remove_task(Client);
        return 
PLUGIN_HANDLED;
    }
    else
    {
        
client_print(Client,3,"Your Task is  not running!!");
        return 
PLUGIN_HANDLED;
    }
     return 
PLUGIN_HANDLED;

Only for display a message for example, if you try to remove without any message or check, only remove

PHP Code:
public remove(Clientremove_task(Client); 
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
Reply



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 00:34.


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