AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Removing Things (https://forums.alliedmods.net/showthread.php?t=57444)

flyeni6 07-04-2007 19:05

Removing Things
 
how do i remove a hudmessage that never disapears.
i've tried this but it wont work,
PHP Code:

#include <amxmodx>
#include <amxmisc>
 
#define TASKID_JUGGHUD 1023
 
public repeated_task()
{
       if(
get_pcvar_num(juggernautmodecvar) && is_user_alive(juggernaut))
       {
            
set_cvar_num("sv_autoteambalance",0)
            
set_cvar_num("mp_limitteams",0)
            
set_cvar_num("mp_freezetime",0)
            new 
players[32], num
            get_players
(players,num)
 
            for(new 
i=0;i<num;i++)
            {
             
set_player_model(players[i])
                  if(
cs_get_user_team(players[i])==CS_TEAM_T)
                  {
                        if(
players[i]!=juggernaut
                         
cs_set_user_team(players[i],CS_TEAM_CT)
                        else
                        {
                         if(
health3)
                         {
                          
set_user_health(juggernaut,health3)
                          
health3 0
                         
}
                         else
                         {
                          new 
health2 get_user_health(juggernaut)
                          if(
health2==100set_user_health(juggernaut,health)
                          else if(
health2health health2
                     
}
              }
        }
  }
  
cs_set_user_team(juggernaut,CS_TEAM_T)
  
cs_set_user_plant(juggernaut,0,0)
  
set_task(0.1,"jugghud",TASKID_JUGGHUD)
 }
}
public 
jugghud()
{
      new 
name[32]
      
get_user_name(juggernautname31)
      
set_hudmessage(02550, -1.00.0306.00.1)
      
show_hudmessage(0"Current Juggernaut: %s^nJuggernaut Health: %d",name,health)
}
 
public 
after_win()
{
      if(
get_pcvar_num(hm_showscores))
       
//show the score board
           
client_cmd(0,"+showscores")
      if(
task_exists(TASKID_JUGGHUD))
            
remove_task(TASKID_JUGGHUD)
      
client_cmd(0,"mp3 play %s",WINSOUND)
      new 
playercountPlayers[32]
      
get_players(Playersplayercount,"a")
 
      for (new 
i=0playercount; ++i)
      {
            
//stop the player from moving, godmode and strip weapons
            
set_user_maxspeed(Players[i],0.1)
            
set_user_godmode(Players[i],1);
            
strip_user_weapons(Players[i]);
            
kills[i] = 0
            deaths
[i] = 0
       
}



stupok 07-04-2007 20:43

Re: Removing Things
 
I don't know what to tell you, exactly.

Generally, you can use a set_task() to display a hudmessage and then whenever you want you can remove_task() to stop displaying the hudmessage.

flyeni6 07-04-2007 21:33

Re: Removing Things
 
yea i tried that. it didn't work. i don't know why though :(

_Master_ 07-05-2007 04:32

Re: Removing Things
 
Your "jugghud()" task is set inside "repeated_task()" which I guess is a... repeated task.

Rolnaaba 07-05-2007 14:46

Re: Removing Things
 
eactly what master said, you removed the jughud task, but if yourt repeated_task() function is a reapeated task, then as soon as you stop it, the task starts a new one. You will have to remove the repeated task. Or have a global var and set it to false. and everythime you are about to make a hud check that var and only start the hud task if it is true. that way you can control the flow of the hudmessage via varriable.

i mean:
Code:
new bool:var = true; //... if(var) {      set_task(0.1,"jugghud",TASKID_JUGGHUD); } //... if(task_exists(TASKID_JUGGHUD))             remove_task(TASKID_JUGGHUD) var = false;
see what I mean, that kinda deal-eo.

flyeni6 07-05-2007 16:56

Re: Removing Things
 
thank u it worked :)

Rolnaaba 07-05-2007 17:17

Re: Removing Things
 
np


All times are GMT -4. The time now is 21:28.

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