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