Raised This Month: $ Target: $400
 0% 

Mana System


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
vitorrossi
Senior Member
Join Date: Apr 2012
Location: NY, USA
Old 09-01-2012 , 02:59   Mana System
Reply With Quote #1

Hey guys, I'm trying to build a plugin that gives Ts a certain amount of Mana which they can use by sending the command impulse 100. I am having a problem with set_task and remove_task

This is a function that I have to be activated every new round:

Code:
    public fwHamPlayerSpawnPost( iPlayer )
    {
        if (is_user_alive(iPlayer))
        {    
            if( cs_get_user_team( iPlayer ) == CS_TEAM_T )
            {         
                iMana[ iPlayer ] = get_pcvar_num( iManaMax );
                
                set_task( get_pcvar_float( TimeIncreaseMana ),"Mana", iPlayer, "", 0, "a", RoundTime )
                
                set_task( 1.0, "sMana", iPlayer, "", 0, "a", RoundTime );
            }
        }
        
        else
        {            
            return PLUGIN_HANDLED;
        }
    }
Then with these two commands I am trying to call another function to remove these tasks if the player dies or if the round is restarted

Code:
        register_event("DeathMsg", "removetask", "a")
        
        register_event("HLTV", "removetask", "a", "1=0", "2=0")
Code:
    public removetask( id )
    {            
        remove_task( id );
    }
This is not working though, so everytime round restarts or player dies the task starts being played over the other, making it twice as fast. How can I fix this? Thank you to anyone that helps
vitorrossi is offline
 



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 08:21.


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