Raised This Month: $ Target: $400
 0% 

[ES] Bomb Cvar! [SOLUCIONADO]


  
 
 
Thread Tools Display Modes
shinoda
Spanish Moderator
Join Date: Nov 2009
Location: ag_crossfire
Old 05-20-2010 , 10:53   Re: [ES] Bomb Cvar!
#11

No esto seguro, pero guiate de aca :B

https://forums.alliedmods.net/showthread.php?p=143399
__________________
Oh hell no this shit is awesome !!!
shinoda is offline
Send a message via MSN to shinoda Send a message via Skype™ to shinoda
Helloween
BANNED
Join Date: May 2010
Location: 23 de enero
Old 05-20-2010 , 11:07   Re: [ES] Bomb Cvar!
#12

ya veo! mmm... pero acabo de probar el codigo y ok el vuelve a activar el bomb target pero yo quiero hacerlo mediante cvar :S ese codigo esta un poco confuso :S
Helloween is offline
Helloween
BANNED
Join Date: May 2010
Location: 23 de enero
Old 05-22-2010 , 22:24   Re: [ES] Bomb Cvar!
#13

nadie sabe como lograr esto?
Helloween is offline
LittleBody
BANNED
Join Date: Apr 2010
Old 05-22-2010 , 22:27   Re: [ES] Bomb Cvar!
#14

Para activar de nuevo la c4 tenes que cambiar el mapa de nuevo.

Ejemplo si la tenes en 0 y la ponés en 1, para que haga efecto cambia de mapa.
LittleBody is offline
Helloween
BANNED
Join Date: May 2010
Location: 23 de enero
Old 05-22-2010 , 22:32   Re: [ES] Bomb Cvar!
#15

claro pero eso es exactamente lo que no puedo hacer porq yo quiero activar y desactivar el c4 en instantes del juego pero en el mismo mapa como podria?

aqui tengo este codigo pero nose como ponerlo a funcionar como yo quiero:

PHP Code:
#include <amxmodx>
#include <amxmisc>  
#include <engine>

new bool:can_plant
new planterold_bombtarget
new Float:bomb_origin[3]

public 
plugin_init()
{
    
register_plugin("Plant Anywhere""0.2""KRoTaL")
    
register_cvar("sv_c4plant""60")
    
register_event("TextMsg""game_restart""a""1=4""2&#Game_C""2&#Game_w")
    
register_event("SendAudio""round_end""a""2=%!MRAD_terwin""2=%!MRAD_ctwin""2=%!MRAD_rounddraw")
    
register_logevent("new_round"2"0=World triggered""1=Round_Start")
    
register_event("StatusIcon""gotbomb""be""1=1""1=2""2=c4")
    
old_bombtarget find_ent_by_class(-1"func_bomb_target")
    if(
old_bombtarget 0entity_get_vector(old_bombtargetEV_VEC_originbomb_origin)
}

public 
gotbomb(id)
{
    
planter id
    
return PLUGIN_CONTINUE
}

public 
round_end()
{
    
set_task(4.0"disable_planting"78645135)
}

public 
game_restart()
{
    
set_task(0.5"disable_planting"71586461)
}

public 
remove_all_entity(classname[])
{
    new 
ent
    
while((ent find_ent_by_class(ent,classname)) != 0) {
        
remove_entity(ent)
    }
}

public 
disable_planting()
{
    if(
task_exists(97564673)) remove_task(97564673)
    
planter 0
    can_plant 
false
    remove_all_entity
("func_bomb_target")
    
remove_all_entity("info_bomb_target")
    new 
bombtarget create_entity("func_bomb_target")
    if(
bombtarget 0)
    {
        
DispatchKeyValue(bombtarget"classname""func_bomb_target")
        
DispatchSpawn(bombtarget)
        
entity_set_string(bombtargetEV_SZ_classname"func_bomb_target")
    }
    
bombtarget create_entity("info_bomb_target")
    if(
bombtarget 0)
    {
        
DispatchKeyValue(bombtarget"classname""info_bomb_target")
        
DispatchSpawn(bombtarget)
        
entity_set_string(bombtargetEV_SZ_classname"info_bomb_target")
    }
}

public 
new_round()
{
    
remove_all_entity("func_bomb_target")
    
remove_all_entity("info_bomb_target")
    
set_task(get_cvar_float("sv_c4plant"), "enable_planting"97564673)
}

public 
enable_planting()
{
    
can_plant true
    create_bombtarget
()
}

public 
create_bombtarget()
{
    if(
old_bombtarget 0)
    {
        new 
bombtarget create_entity("func_bomb_target")
        if(
bombtarget 0)
        {
            
DispatchKeyValue(bombtarget"classname""func_bomb_target")
            
DispatchSpawn(bombtarget)
            
entity_set_size(bombtargetFloat:{-1000000.0,-1000000.0,-1000000.0}, Float:{1000000.0,1000000.0,1000000.0})
            
entity_set_string(bombtargetEV_SZ_classname"func_bomb_target")
            
entity_set_origin(bombtargetbomb_origin)
        }
        
bombtarget create_entity("info_bomb_target")
        if(
bombtarget 0)
        {
            
DispatchKeyValue(bombtarget"classname""info_bomb_target")
            
DispatchSpawn(bombtarget)
            
entity_set_size(bombtargetFloat:{-1000000.0,-1000000.0,-1000000.0}, Float:{1000000.0,1000000.0,1000000.0})
            
entity_set_string(bombtargetEV_SZ_classname"info_bomb_target")
            
entity_set_origin(bombtargetbomb_origin)
        }
    }
}

public 
client_PreThink(id)
{
    if(
id == planter && !can_plant)
    {
        new 
clipammoweapon get_user_weapon(idclipammo)
        if(
weapon == CSW_C4)
        {
            
entity_set_int(idEV_INT_buttonentity_get_int(idEV_INT_button) & ~IN_ATTACK)
        }
    }

Helloween is offline
LittleBody
BANNED
Join Date: Apr 2010
Old 05-22-2010 , 22:53   Re: [ES] Bomb Cvar!
#16

Fijate ahora, lo que hace es cuando la cvar amx_remove_bomb está en 1, no podes plantar en cualquier lado, y si está en 0, podes plantar en cualquier lado...

PHP Code:
#include < amxmodx >
#include < amxmisc >  
#include < engine >
 
new bool:can_plant
new planterold_bombtarget
new Float:bomb_origin[3]
 
new 
MiCvar;
 
public 
plugin_init()
{
 
register_plugin("Plant Anywhere""0.2""KRoTaL")
 
 
register_cvar("sv_c4plant""60")
 
register_event("TextMsg""game_restart""a""1=4""2&#Game_C""2&#Game_w")
 
register_event("SendAudio""round_end""a""2=%!MRAD_terwin""2=%!MRAD_ctwin""2=%!MRAD_rounddraw")
 
register_logevent("new_round"2"0=World triggered""1=Round_Start")
 
register_event("StatusIcon""gotbomb""be""1=1""1=2""2=c4")
 
 
MiCvar register_cvar("amx_remove_bomb""1")
 
 
old_bombtarget find_ent_by_class(-1"func_bomb_target")
 
 if(
old_bombtarget 0entity_get_vector(old_bombtargetEV_VEC_originbomb_origin)
 
 
set_task(0.1"CheckCreate"___"b")
}
public 
CheckCreate()
{
 if(
get_pcvar_num(MiCvar) != 1)
  
enable_planting()
 else
  
disable_planting()
}
public 
gotbomb(id)
{
 
planter id
 
return PLUGIN_CONTINUE;
}
public 
round_end()
{
 
set_task(4.0"disable_planting"78645135)
}
public 
game_restart()
{
 
set_task(0.5"disable_planting"71586461)
}
public 
remove_all_entity(classname[])
{
 new 
ent
 
while((ent find_ent_by_class(ent,classname)) != 0)
 {
  
remove_entity(ent)
 }
}
public 
disable_planting()
{
 if(
task_exists(97564673)) remove_task(97564673)
 
planter 0
 can_plant 
false
 remove_all_entity
("func_bomb_target")
 
remove_all_entity("info_bomb_target")
 new 
bombtarget create_entity("func_bomb_target")
 if(
bombtarget 0)
 {
  
DispatchKeyValue(bombtarget"classname""func_bomb_target")
  
DispatchSpawn(bombtarget)
  
entity_set_string(bombtargetEV_SZ_classname"func_bomb_target")
 }
 
bombtarget create_entity("info_bomb_target")
 if(
bombtarget 0)
 {
  
DispatchKeyValue(bombtarget"classname""info_bomb_target")
  
DispatchSpawn(bombtarget)
  
entity_set_string(bombtargetEV_SZ_classname"info_bomb_target")
 }
}
public 
new_round()
{
 
remove_all_entity("func_bomb_target")
 
remove_all_entity("info_bomb_target")
 
set_task(get_cvar_float("sv_c4plant"), "enable_planting"97564673)
}
public 
enable_planting()
{
 
can_plant true
 create_bombtarget
()
}
public 
create_bombtarget()
{
 if(
old_bombtarget 0)
 {
  new 
bombtarget create_entity("func_bomb_target")
  if(
bombtarget 0)
  {
   
DispatchKeyValue(bombtarget"classname""func_bomb_target")
   
DispatchSpawn(bombtarget)
   
entity_set_size(bombtargetFloat:{-1000000.0,-1000000.0,-1000000.0}, Float:{1000000.0,1000000.0,1000000.0})
   
entity_set_string(bombtargetEV_SZ_classname"func_bomb_target")
   
entity_set_origin(bombtargetbomb_origin)
  }
  
bombtarget create_entity("info_bomb_target")
  if(
bombtarget 0)
  {
   
DispatchKeyValue(bombtarget"classname""info_bomb_target")
   
DispatchSpawn(bombtarget)
   
entity_set_size(bombtargetFloat:{-1000000.0,-1000000.0,-1000000.0}, Float:{1000000.0,1000000.0,1000000.0})
   
entity_set_string(bombtargetEV_SZ_classname"info_bomb_target")
   
entity_set_origin(bombtargetbomb_origin)
  }
 }
}
public 
client_PreThink(id)
{
 if(
id == planter && !can_plant)
 {
  new 
clipammoweapon get_user_weapon(idclipammo)
  if(
weapon == CSW_C4)
  {
   
entity_set_int(idEV_INT_buttonentity_get_int(idEV_INT_button) & ~IN_ATTACK)
  }
 }


Last edited by LittleBody; 05-22-2010 at 22:59.
LittleBody is offline
Helloween
BANNED
Join Date: May 2010
Location: 23 de enero
Old 05-22-2010 , 22:56   Re: [ES] Bomb Cvar!
#17

ahhh eso es lo q hace? lol
Helloween is offline
LittleBody
BANNED
Join Date: Apr 2010
Old 05-22-2010 , 23:00   Re: [ES] Bomb Cvar!
#18

Sí, el mismo nombre del plugin te lo dice.

"Plant anywhere", vos que querés que haga, que puedas plantar la bomba en debido tiempo?, osea cuando vos quieras?
LittleBody is offline
Helloween
BANNED
Join Date: May 2010
Location: 23 de enero
Old 05-22-2010 , 23:01   Re: [ES] Bomb Cvar!
#19

no! yo solo quiero activar y desactivar el c4 via cvar con cualquiera de los 2 codigos que puse en el post 1!
Helloween is offline
LittleBody
BANNED
Join Date: Apr 2010
Old 05-22-2010 , 23:22   Re: [ES] Bomb Cvar!
#20

El problema es que cuando eliminas las classname las tenes que volver a crear en el lugar de cada mapa, y no sé cuál es cada posición, además de que tendrías que hacerlo con cada mapa ( creo ), yo pensaba que con un simple PLUGIN_CONTINUE bastaba, lo único que pude hacer es activarla/desactivarla, pero al activarla la podes plantar en cualquier lugar por los origins, si te sabés el origin de cada lugar del mapa para plantar la c4 cambiaselo, pero yo ni idea :p.

PHP Code:
#include <amxmodx>
#include <engine>
 
new old_bombtarget;
new 
Float:bomb_origin[3];
 
new const 
Classname[][] =
{
     
"func_bomb_target",
     
"info_bomb_target"
}
new 
RemoveClassname;
 
public 
plugin_init()
{
     
register_plugin("PLUGIN""VERSION""AUTHOR")
 
     
RemoveClassname register_cvar("amx_remove_classname""1")
 
     
old_bombtarget find_ent_by_class(-1"func_bomb_target")
 
     
set_task(0.1"CheckCanPlant"_,_,_"b")
}
public 
CheckCanPlant()
{
      if(
get_pcvar_num(RemoveClassname) != 1)
      {
             if(
old_bombtarget 0)
            {
                  new 
bombtarget create_entity("func_bomb_target")
                  if(
bombtarget 0)
                  {
                        
DispatchKeyValue(bombtarget"classname""func_bomb_target")
                        
DispatchSpawn(bombtarget)
                        
entity_set_size(bombtargetFloat:{-1000000.0,-1000000.0,-1000000.0}, Float:{1000000.0,1000000.0,1000000.0})
                        
entity_set_string(bombtargetEV_SZ_classname"func_bomb_target")
                        
entity_set_origin(bombtargetbomb_origin)
                  }
                  
bombtarget create_entity("info_bomb_target")
                  if(
bombtarget 0)
                  {
                        
DispatchKeyValue(bombtarget"classname""info_bomb_target")
                        
DispatchSpawn(bombtarget)
                        
entity_set_size(bombtargetFloat:{-1000000.0,-1000000.0,-1000000.0}, Float:{1000000.0,1000000.0,1000000.0})
                        
entity_set_string(bombtargetEV_SZ_classname"info_bomb_target")
                  
entity_set_origin(bombtargetbomb_origin)
                  }
            }
      }
      else
      {
            for(new 
i=0i<sizeof Classnamei++)
                  
remove_entity_name(Classname[i])
      }
 
     return 
PLUGIN_HANDLED_MAIN;


Last edited by LittleBody; 05-22-2010 at 23:30.
LittleBody 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 20:40.


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