Raised This Month: $ Target: $400
 0% 

Boolean delay (wait 2 seconds before false in case it gets true again)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fatal_nl
Member
Join Date: Apr 2017
Old 08-08-2018 , 17:24   Re: Boolean delay (wait 2 seconds before false in case it gets true again)
Reply With Quote #1

I was able to solve it with set_task:

PHP Code:
public AdminVoiceOn(id)
{
    if( !
g_bAdmin[id] || is_user_alive(id) )
    {
        return 
PLUGIN_CONTINUE
    
}
    
    
g_bAdminVoice[id] = true
    
    
return PLUGIN_CONTINUE
}

public 
AdminVoiceOff(id)
{
    if(!
g_bAdminVoice[id])
        return 
PLUGIN_CONTINUE

    
    
if(!task_exists(id))
    {
        
set_task(2.0"AdminVoiceOffDelay"id)
    }
    else
    {    
        
remove_task(id)
        
set_task(2.0"AdminVoiceOffDelay"id)
    }
    
    return 
PLUGIN_CONTINUE
}

public 
AdminVoiceOffDelay(id)
{
    
g_bAdminVoice[id] = false
    remove_task
(id)
}

public 
client_disconnect(id)

    if(
task_exists(id))
    { 
        
remove_task(id)
    } 


Last edited by fatal_nl; 08-08-2018 at 18:21.
fatal_nl 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 12:44.


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