Raised This Month: $ Target: $400
 0% 

how to stop a function?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Owyn
Veteran Member
Join Date: Nov 2007
Old 04-09-2009 , 08:45   how to stop a function?
Reply With Quote #1

edit: thx, i made an addition check not to allow 2nd execution of function in short-time, should work now i hope



PHP Code:
public plugin_init() {
register_clcmd("say""function");
}

public function(
id)
{
    new 
said[192]
    new 
ij
    
new cheatername[32]
    
get_user_name(idcheatername32)
    
read_args(said192)
    
    for(
sizeof (CheatReports) ; i++)
    {
         if(
containi(saidCheatReports[i][j]) != -1)
        {
            
set_task(3.3,"nodb");
            if(
cheater_1 == 0)
            {
                
action1(id)
                return 
PLUGIN_HANDLED
            
}
        }

    }
    
    for(
sizeof (CheatReports2) ; i++)
    {
        if(
containi(saidCheatReports2[i][j]) != -1)
        {
            
set_task(3.3,"nodc");
            if(
cheater_2 == 0)
            {
                
action2(id)
                return 
PLUGIN_HANDLED
            
}
        }
    }
    
    return 
PLUGIN_CONTINUE
    

hi, i want to stop function() when action1() is executed and not to let action2() to execute, i thought return PLUGIN_HANDLED should do that but it doesn't, action2() is still executed after action1() if they both met conditions
__________________
☜ Free Mozy ☂backup\҉sync user
Quote:
Американский форум - Задаёшь вопрос, потом тебе отвечают.
Израильский форум - Задаёшь вопрос, потом тебе задают вопрос.
Русский форум - Задаёшь вопрос, потом тебе долго рассказывают, какой ты мудак.

Last edited by Owyn; 04-09-2009 at 10:35.
Owyn is offline
Send a message via ICQ to Owyn
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 04-09-2009 , 08:53   Re: how to stop a function?
Reply With Quote #2

Are you certain it isn't just doing action2() 3 seconds later?

return'ing out of the function will absolutely certainly stop anything after the "return" from happening
purple_pixie is offline
Owyn
Veteran Member
Join Date: Nov 2007
Old 04-09-2009 , 08:54   Re: how to stop a function?
Reply With Quote #3

no, i have logging, action1() and action2() were executed in the same second
__________________
☜ Free Mozy ☂backup\҉sync user
Quote:
Американский форум - Задаёшь вопрос, потом тебе отвечают.
Израильский форум - Задаёшь вопрос, потом тебе задают вопрос.
Русский форум - Задаёшь вопрос, потом тебе долго рассказывают, какой ты мудак.
Owyn is offline
Send a message via ICQ to Owyn
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 04-09-2009 , 08:56   Re: how to stop a function?
Reply With Quote #4

And function() is only called once?
purple_pixie is offline
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 02:18.


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