Raised This Month: $ Target: $400
 0% 

remove_task doesn't remove task


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
m0skVi4a
Senior Member
Join Date: May 2011
Location: Rousse, Bulgaria
Old 08-04-2011 , 05:00   remove_task doesn't remove task
Reply With Quote #1

Hello.
Today i have started to make a plugin (timer) and i am now at the stop part
It has continues to count.
Here is my code
PHP Code:
#include <amxmodx> 

new Timer[33
new 
g_ong_max 

public plugin_init()  

    
register_plugin("Timer""1.0""m0skVi4a"
     
    
g_on register_cvar("timer_on""1"
    
g_max register_cvar("timer_max""86400"
     
    
register_clcmd("say /timermenu""ShowMenu"
    
register_clcmd("say_team /timermenu""ShowMenu"


public 
ShowMenu(id)  
{    
    if(
is_user_alive(id) || is_user_connected(id) || get_pcvar_num(g_on)) 
    {  
        new 
timer_menu menu_create("Timer Menu""ShowTimerMenu");  
      
        
menu_additem(timer_menu,"Star/Reset Timer","1",0)   
        
menu_additem(timer_menu,"Stop Timer","2",0)   
        
menu_setprop(timer_menuMPROP_EXITMEXIT_ALL); 
        
menu_display(idtimer_menu0)   
    }  
}  

public 
ShowTimerMenu(idtimer_menuitem)  
{  
    if(
item == MENU_EXIT)  
    {  
        
menu_destroy(timer_menu)  
        return 
PLUGIN_HANDLED_MAIN  
    
}  
     
    new 
data[6], iName[64], accesscallback  
     
    menu_item_getinfo
(timer_menuitemaccessdata,5iName63callback)  
     
    new 
key str_to_num(data)  
     
    switch(
key)  
    {  
        case 
1:  
        {  
            
StartTimer(id
        }  
        case 
2:  
        {  
            
StopTimer(id
        }  
    } 
    
menu_destroy(timer_menu)     
    return 
PLUGIN_HANDLED_MAIN 

         
public 
StartTimer(id

    
Timer[id] = 
    set_task
(0.1,"TimerMain"
    
set_task(0.1,"TimerHud"


public 
TimerMain(id

    if(
Timer[id] < get_pcvar_num(g_max))  
    {  
        
Timer[id] += 1  
        set_task
(1.0"TimerMain"id)  
    }   


public 
TimerHud(id

    
set_hudmessage(0255 00.470.8500.020.8,_,_,-1
    
show_hudmessage(id"Timer: %d second%s"Timer[id], Timer[id] > "s" "")
    
set_task(0.2,"TimerHud"


public 
StopTimer(id

    
remove_task(id

Why does the remove task doesn't work?

Last edited by m0skVi4a; 08-04-2011 at 05:03.
m0skVi4a is offline
Send a message via Skype™ to m0skVi4a
 



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 01:30.


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