Raised This Month: $ Target: $400
 0% 

Admin explode problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SaraAki
Member
Join Date: Nov 2022
Old 06-14-2024 , 11:45   Admin explode problem
Reply With Quote #1

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

#include < engine >
#include < cstrike >
#include < fun >

#pragma semicolon 1

new gCvarEnabled;
new 
gCvarRadius;
new 
gCvarDamage;
new 
gCvarFragBonus;
new 
gCvarMoneyBonus;

new 
gCylinderSprite;
new 
gMaxPlayers;
new 
gMessageDeathMsg;

new 
Trie:gTrieHandleInflictorToIgnore;

new const 
InflictorToIgnore[ ][ ] =
{
    
"world",
        
"worldspawn",
        
"trigger_hurt",
        
"door_rotating",
        
"door",
        
"rotating",
        
"env_explosion"
};

new const 
gExplodeSound[ ] = "weapons/rocketfire1.wav";

public 
plugin_init( )
{
    
register_plugin"Admin Explode""1.0.1""tuty" );
    
    
register_event"DeathMsg""Hook_DeathMessage""a" );
    
    
gCvarEnabled register_cvar"ae_enabled""1" );
    
gCvarRadius register_cvar"ae_radius""500" );
    
gCvarDamage register_cvar"ae_damage""1000.0" );
    
gCvarFragBonus register_cvar"ae_frags""1" );
    
gCvarMoneyBonus register_cvar"ae_money""100" );
    
    
gMaxPlayers get_maxplayers();
    
gMessageDeathMsg get_user_msgid"DeathMsg" );

    
gTrieHandleInflictorToIgnore TrieCreate( );

    for( new 
0sizeof InflictorToIgnorei++ )
    {
            
TrieSetCellgTrieHandleInflictorToIgnoreInflictorToIgnore], );
    }
}

public 
plugin_precache( )
{
    
gCylinderSprite precache_model"sprites/shockwave.spr" );
    
    
precache_soundgExplodeSound );
}

public 
Hook_DeathMessage( )
{
    if( 
get_pcvar_numgCvarEnabled ) != )
    {
        return 
PLUGIN_CONTINUE;
    }

    new 
iKiller read_data);
    new 
iVictim read_data);
    
    new 
szWeapon30 ];
    
read_data4szWeaponcharsmaxszWeapon ) );
    
    if( 
iVictim == iKiller )
    {
        return 
PLUGIN_CONTINUE;
    }
    
    if( 
TrieKeyExistsgTrieHandleInflictorToIgnoreszWeapon ) )
    {
           return 
PLUGIN_CONTINUE;
    }

    if( 
is_user_connectediVictim ) )
    {
        new 
iOrigin];
        
get_user_originiVictimiOrigin );
        
        new 
iRadius get_pcvar_numgCvarRadius );
    
        
UTIL_CreateBeamCylinderiOrigin120gCylinderSprite006160random255 ), random255 ), random255 ), 255);
        
UTIL_CreateBeamCylinderiOrigin320gCylinderSprite006160random255 ), random255 ), random255 ), 255);
        
UTIL_CreateBeamCylinderiOriginiRadiusgCylinderSprite006160random255 ), random255 ), random255 ), 255);
        
        
UTIL_Blast_ExplodeDamageiVictimget_pcvar_floatgCvarDamage ), floatiRadius ) );
        
        
emit_soundiVictimCHAN_BODYgExplodeSoundVOL_NORMATTN_NORM0PITCH_NORM );
    }

    return 
PLUGIN_CONTINUE;
}

stock UTIL_Blast_ExplodeDamageentidFloat:damageFloat:range 
{
    new 
Float:flOrigin1];
    
entity_get_vectorentidEV_VEC_originflOrigin1 );

    new 
Float:flDistance;
    new 
Float:flTmpDmg;
    new 
Float:flOrigin2];

    for( new 
1<= gMaxPlayersi++ ) 
    {
        if( 
is_user_alive) && get_user_teamentid ) != get_user_team) )
        {
            
entity_get_vectoriEV_VEC_originflOrigin2 );
            
flDistance get_distance_fflOrigin1flOrigin2 );
            
            static const 
szWeaponName[] = "Admin Blast Explosion";
        
            if( 
flDistance <= range 
            {
                
flTmpDmg damage - ( damage range ) * flDistance;
                
fakedamageiszWeaponNameflTmpDmgDMG_BLAST );
            
                
message_beginMSG_BROADCASTgMessageDeathMsg );
                
write_byteentid );
                
write_byte);
                
write_byte);
                
write_stringszWeaponName );
                
message_end();
            }
        }
    }

    
set_user_fragsentidget_user_fragsentid ) + get_pcvar_numgCvarFragBonus ) );
    
cs_set_user_moneyentidcs_get_user_moneyentid ) + get_pcvar_numgCvarMoneyBonus ) );
}

stock UTIL_CreateBeamCylinderorigin], addradspritestartfrateframeratelifewidthamplituderedgreenbluebrightnessspeed )
{
    
message_beginMSG_PVSSVC_TEMPENTITYorigin ); 
    
write_byteTE_BEAMCYLINDER );
    
write_coordorigin] );
    
write_coordorigin] );
    
write_coordorigin] );
    
write_coordorigin] );
    
write_coordorigin] );
    
write_coordorigin] + addrad );
    
write_shortsprite );
    
write_bytestartfrate );
    
write_byteframerate );
    
write_byte(life );
    
write_bytewidth );
    
write_byteamplitude );
    
write_bytered );
    
write_bytegreen );
    
write_byteblue );
    
write_bytebrightness );
    
write_bytespeed );
    
message_end();

I set cvar ae_damage 10.0
Problem is that this plugin always add frags to death player although his explosion did not kill anybody.How to set it up to give frags only if that explosion kills somebody?
SaraAki is offline
v120kaaimcfg
Member
Join Date: Apr 2024
Old 06-14-2024 , 13:10   Re: Admin explode problem
Reply With Quote #2

Quote:
Originally Posted by SaraAki View Post
I set cvar ae_damage 10.0
Problem is that this plugin always add frags to death player although his explosion did not kill anybody.How to set it up to give frags only if that explosion kills somebody?
After
PHP Code:
fakedamageiszWeaponNameflTmpDmgDMG_BLAST ); 
check if target's hp < 1 and if so send the kill message and give frags/money to entid
v120kaaimcfg is offline
Reply



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 07:35.


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