[ZP] Crear arma explosiva
#1
Hola, quisiera saber como poder hacer una arma explosiva osea que al disparar al piso cause X Cantidad de daño al rededor de un radio.

con la deagle por ejemplo

Ejemplo Radio tal 400
Ejemplo Daño tal 450

saludos. Rainbow
Responder
#2
Sección equivocada chamaco perro.

Lea las reglas por amor a cristo: https://amxmodx-es.com/showthread.php?tid=3
Luego lea un tutorial si cree que es pan de jalea hacer eso.
Y luego cuando lo intente hacer lo postea acá para ayudarle con los bugs, de resto, puede ir a Pedido de Plugins y/o Compra, y formular este post nuevamente, quizá alguno le pueda ayudar mejor.

[Imagen: 76561198099584158.png]
Java, Mysql, PHP, Python and more.
Responder
#3
(15/06/2017, 04:59 PM)Dieguito escribió: Sección equivocada chamaco perro.

Lea las reglas por amor a cristo: https://amxmodx-es.com/showthread.php?tid=3
Luego lea un tutorial si cree que es pan de jalea hacer eso.
Y luego cuando lo intente hacer lo postea acá para ayudarle con los bugs, de resto, puede ir a Pedido de Plugins y/o Compra, y formular este post nuevamente, quizá alguno le pueda ayudar mejor.

Está bien donde posteó, si lees el thr dice "quisiera saber como hacer" no, "quiero que me hagan"..

EDIT: Es buena idea, veré si lo hago y luego la aporto..

Responder
#4
(15/06/2017, 05:19 PM)Skylar escribió:
(15/06/2017, 04:59 PM)Dieguito escribió: Sección equivocada chamaco perro.

Lea las reglas por amor a cristo: https://amxmodx-es.com/showthread.php?tid=3
Luego lea un tutorial si cree que es pan de jalea hacer eso.
Y luego cuando lo intente hacer lo postea acá para ayudarle con los bugs, de resto, puede ir a Pedido de Plugins y/o Compra, y formular este post nuevamente, quizá alguno le pueda ayudar mejor.

Está bien donde posteó, si lees el thr dice "quisiera saber como hacer" no, "quiero que me hagan"..

EDIT: Es buena idea, veré si lo hago y luego la aporto..

Entre pedir y que te expliquen como hacer, hay una pequeña diferencia... que este tiene 1 mensaje recién pacman.

[Imagen: 76561198099584158.png]
Java, Mysql, PHP, Python and more.
Responder
#5
(15/06/2017, 05:49 PM)Dieguito escribió:
(15/06/2017, 05:19 PM)Skylar escribió:
(15/06/2017, 04:59 PM)Dieguito escribió: Sección equivocada chamaco perro.

Lea las reglas por amor a cristo: https://amxmodx-es.com/showthread.php?tid=3
Luego lea un tutorial si cree que es pan de jalea hacer eso.
Y luego cuando lo intente hacer lo postea acá para ayudarle con los bugs, de resto, puede ir a Pedido de Plugins y/o Compra, y formular este post nuevamente, quizá alguno le pueda ayudar mejor.

Está bien donde posteó, si lees el thr dice "quisiera saber como hacer" no, "quiero que me hagan"..

EDIT: Es buena idea, veré si lo hago y luego la aporto..

Entre pedir y que te expliquen como hacer, hay una pequeña diferencia... que este tiene 1 mensaje recién pacman.

Really?

Puede ser un usuario con conocimientos en pawn, pero tal vez no puede hacer este plugin, es un tanto difícil hacerlo.

Responder
#6
Buenas probando y tal toqueteando y pensando buscando etc e podido conseguir esto
Código:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <cstrike>
#include <engine>
#include <fun>

#define PLUGIN ""
#define VERSION "1.0"
#define AUTHOR ""
new g_explode_sprite

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    
    RegisterHam( Ham_Weapon_PrimaryAttack, "weapon_deagle", "F_HAM_PRIMARYATTACK_DEAGLE", true );
}

public plugin_precache( )
{
    g_explode_sprite = precache_model( "sprites/fire.spr" );
}

public F_HAM_PRIMARYATTACK_DEAGLE( weapon )
{
    new index; index = get_pdata_cbase( weapon, 46, 4 );
    if(cs_get_weapon_ammo( weapon ) <= 0 ) return;
    
    F_CREATE_EXPLOSION( index, 1 );
    client_cmd( index, "-attack" );
}

public F_CREATE_EXPLOSION( index, type )
{
    new t_iOrigin[3], Float:t_fOrigin[3];get_user_origin( index, t_iOrigin, 3 );IVecFVec( t_iOrigin, t_fOrigin );

    new t_entity = create_entity( "info_target" );
    t_fOrigin[ 2 ] += 5.0
    entity_set_vector( t_entity, EV_VEC_origin, t_fOrigin );
    entity_set_size( t_entity, Float:{ -5.0, -5.0, -5.0 }, Float:{ 5.0, 5.0, 5.0 } );
    entity_set_int( t_entity, EV_INT_solid, SOLID_TRIGGER );
    entity_set_int( t_entity, EV_INT_movetype, MOVETYPE_FLY );
    
    if ( type == 1 )
    {
        static Float:vel_a[3], Float:vel_n[3], i
        VelocityByAim(index, -400, vel_n);
        entity_get_vector(index, EV_VEC_velocity, vel_a);
        
        for (i = 0; i < 3; i++)
         vel_n[i] += vel_a[i];
        
        entity_set_vector(index, EV_VEC_velocity, vel_n)
    }
    
    new iEnt = -1
    while( iEnt = find_ent_in_sphere(iEnt, t_fOrigin, 100.0) )
    {
        if ( is_user_alive( iEnt ) )
        {
            if ( get_user_health( iEnt ) <= 0 )
            {
                user_silentkill( iEnt )
                set_user_frags( iEnt, get_user_frags( iEnt ) + 1 );
                set_user_frags( index, get_user_frags( index ) + 1 );
            }else{
                if ( iEnt != index ) set_user_health( iEnt, get_user_health( iEnt ) - 50 );        
            }
        }
        
    }
    
    message_begin(MSG_PVS, SVC_TEMPENTITY, t_iOrigin, 0);
    write_byte(TE_EXPLOSION);
    write_coord(t_iOrigin[0]); // X
    write_coord(t_iOrigin[1]); // Y
    write_coord(t_iOrigin[2]); // Z
    write_short(g_explode_sprite); // sprite
    switch( type )
    {
        case 1: write_byte( 40 );
        case 2: write_byte( 20 );
    }
    write_byte(10); // framerate
    write_byte(0); // flags
    message_end();

    remove_entity( t_entity );
}
[
Pero esta linea me da error :

while( iEnt = find_ent_in_sphere(iEnt, t_fOrigin, 100.0) )
Warning: Possibly unintended assignment on line 59

y añadir las 2 cvar de Radio y Damage

Gracias por vuestra ayuda
Responder
#7
Ayuda porfa no doy con el fallo
Responder
#8
Código PHP:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <cstrike>
#include <engine>
#include <fun>

#define PLUGIN ""
#define VERSION "1.0"
#define AUTHOR ""
new g_explode_sprite

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
RegisterHamHam_Weapon_PrimaryAttack"weapon_deagle""F_HAM_PRIMARYATTACK_DEAGLE"true );
}

public 
plugin_precache( )
{
    
g_explode_sprite precache_model"sprites/fire.spr" );
}

public 
F_HAM_PRIMARYATTACK_DEAGLEweapon )
{
    new 
indexindex get_pdata_cbaseweapon46);
    if(
cs_get_weapon_ammoweapon ) <= ) return;
    
    
F_CREATE_EXPLOSIONindex);
    
client_cmdindex"-attack" );
}

public 
F_CREATE_EXPLOSIONindextype )
{
    new 
t_iOrigin[3], Float:t_fOrigin[3];get_user_originindext_iOrigin);IVecFVect_iOrigint_fOrigin );

    new 
t_entity create_entity"info_target" );
    
t_fOrigin] += 5.0
    entity_set_vector
t_entityEV_VEC_origint_fOrigin );
    
entity_set_sizet_entityFloat:{ -5.0, -5.0, -5.0 }, Float:{ 5.05.05.0 } );
    
entity_set_intt_entityEV_INT_solidSOLID_TRIGGER );
    
entity_set_intt_entityEV_INT_movetypeMOVETYPE_FLY );
    
    if ( 
type == )
    {
        static 
Float:vel_a[3], Float:vel_n[3], i
        VelocityByAim
(index, -400vel_n);
        
entity_get_vector(indexEV_VEC_velocityvel_a);
        
        for (
03i++)
         
vel_n[i] += vel_a[i];
        
        
entity_set_vector(indexEV_VEC_velocityvel_n)
    }
    
    new 
iEnt = -1
    
while( iEnt find_ent_in_sphere(iEntt_fOrigin100.0) )
    {
        if ( 
is_user_aliveiEnt ) )
        {
            if ( 
get_user_healthiEnt ) <= )
            {
                
user_silentkilliEnt )
                
set_user_fragsiEntget_user_fragsiEnt ) + );
                
set_user_fragsindexget_user_fragsindex ) + );
            }else{
                if ( 
iEnt != index set_user_healthiEntget_user_healthiEnt ) - 50 );        
            }
        }
        
    }
    
    
message_begin(MSG_PVSSVC_TEMPENTITYt_iOrigin0);
    
write_byte(TE_EXPLOSION);
    
write_coord(t_iOrigin[0]); // X
    
write_coord(t_iOrigin[1]); // Y
    
write_coord(t_iOrigin[2]); // Z
    
write_short(g_explode_sprite); // sprite
    
switch( type )
    {
        case 
1write_byte40 );
        case 
2write_byte20 );
    }
    
write_byte(10); // framerate
    
write_byte(0); // flags
    
message_end();

    
remove_entityt_entity );

Trolleyes
Responder
#9
Gracias Franco pero no funciona sigo testeando esta dificil xD

Warning: Possibly unintended assignment on line 59

Sigue dando warning yo diria que no funciona por eso xD

while( iEnt = find_ent_in_sphere(iEnt, t_fOrigin, 100.0) )
Responder
#10
Código PHP:
while( iEnt find_ent_in_sphere(iEntt_fOrigin100.0) ) 

>>>>>>>>>>

Código PHP:
while( (iEnt find_ent_in_sphere(iEntt_fOrigin100.0)) ) 
Responder
#11
Nada sigue sin funcionar no da ningun warning pero tampoco hace daño en area xD
Responder
#12
Solo vi lo referente a ese error, no revise el resto del codigo Whatever.

Sin embargo, aquí te dejo una forma sencilla y rápida de realizar daño, ya que no se que sentido tiene la forma anterior que crea una entidad.

Código PHP:
//
const DMG_EXPLOSION = (1<<24)

//.....
static Float:AF_Origin[3];

//obtener coordenadas....

RadiusDamageToEnemies(AF_OriginRadiusInflictorAttackerDamage, (DMG_ALWASYGIB|DMG_EXPLOSION))

//...

RadiusDamageToEnemies(const Float:AF_Origin[3], const Float:F_Radius, const I_Inflictor, const I_Attacker, const Float:F_TotalDamage, const I_DamageBits)
{
    new 
I_Victim = -1;
    
    while ((
I_Victim find_ent_in_sphere(I_VictimAF_OriginF_Radius)))
    {
        if (!
is_user_alive(I_Victim))
            continue;

            
ExecuteHamB(Ham_TakeDamageI_VictimI_InflictorI_AttackerF_TotalDamageI_DamageBits)
    }


Trata de adaptarlo por ti mismo...
Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)