Raised This Month: $51 Target: $400
 12% 

Player Radius


Post New Thread Reply   
 
Thread Tools Display Modes
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-11-2023 , 15:47   Re: Player Radius
Reply With Quote #11

Not thoroughly tested. No friendly fire checking but that can be added

4 cvars
  • rd_damageradius - radius from infected person that will cause damage
  • rd_damageamount - amount of damage. this is not loss in hp, this is the amount of damage issued that may get offset by player armor
  • rd_damageinterval - interval of issuance of damage in seconds. so if you are within radius, you get damage every X seconds
  • rd_friendlyfire - enable/disable friendly fire damage

PHP Code:

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

new const Version[] = "0.2";

const 
InfectionTask 0b101110110101010101111;

new 
g_iMaxPlayers g_pDamageRadius g_pDamageAmount g_pDamageInterval g_pFriendlyFire;

public 
plugin_init() 
{
    
register_plugin"Radius Damage" Version "bugsy" );

    
register_clcmd"say /infect" "StartInfection" );
    
register_clcmd"say /uninfect" "EndInfection" );
    
    
g_pDamageRadius register_cvar"rd_damageradius" "250" );
    
g_pDamageAmount register_cvar"rd_damageamount" "15" );
    
g_pDamageInterval register_cvar"rd_damageinterval" "1" );
    
g_pFriendlyFire register_cvar"rd_friendlyfire" "0" );
    
    
g_iMaxPlayers get_maxplayers();
}

public 
StartInfectionid )
{
    if ( !
task_existsInfectionTask id ) )
    {
        
set_taskget_pcvar_floatg_pDamageInterval ) , "CheckForEnemies" InfectionTask id , .flags="b" );
        
client_printid print_chat "* Infection enabled" );
    }
    else
    {
        
client_printid print_chat "* Infection is already enabled" );
    }

    return 
PLUGIN_HANDLED;
}

public 
EndInfectionid )
{
    if ( 
task_existsInfectionTask id ) )
    {
        
remove_taskInfectionTask id );
        
client_printid print_chat "* Infection disabled" );
    }
    else
    {
        
client_printid print_chat "* Infection not currently enabled" );
    }
    
    return 
PLUGIN_HANDLED;
}

public 
CheckForEnemiesTaskID )
{
    new 
id TaskID InfectionTask;
    new 
iEntity = -DamageBits Float:fOrigin] , Float:fRadius Float:fDamage bool:bFriendlyFire;
    
    
entity_get_vectorid EV_VEC_origin fOrigin );
    
fRadius get_pcvar_floatg_pDamageRadius );
    
fDamage get_pcvar_floatg_pDamageAmount );
    
bFriendlyFire bool:!!get_pcvar_numg_pFriendlyFire );
    
    while ( (
iEntity find_ent_in_sphereiEntity fOrigin fRadius ) ) ) 
    {
        if ( ( 
<= iEntity <= g_iMaxPlayers ) && ( iEntity != id ) && ( bFriendlyFire || ( !bFriendlyFire & ( cs_get_user_teamid ) != cs_get_user_teamiEntity ) ) ) ) )
        {
            
ExecuteHamBHam_TakeDamage iEntity id fDamage DamageBits );
        }
    }

__________________

Last edited by Bugsy; 05-12-2023 at 12:02.
Bugsy is offline
QuickDroLLL
Senior Member
Join Date: Dec 2021
Location: AMX Mod X Land
Old 05-11-2023 , 16:14   Re: Player Radius
Reply With Quote #12

its working perefctly just what i want thank you very much but one last thing can you add frindly fire cvar like rd_frindlyfire "1" = the damage radius can be alowed on team rd_frindlyfire "0" the damage radius cannot be allowed on team hope you understand me and take your time again if you can't make it its ok

Last edited by QuickDroLLL; 05-11-2023 at 16:25.
QuickDroLLL is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-12-2023 , 12:02   Re: Player Radius
Reply With Quote #13

Above code is updated
__________________
Bugsy is offline
QuickDroLLL
Senior Member
Join Date: Dec 2021
Location: AMX Mod X Land
Old 05-12-2023 , 15:18   Re: Player Radius
Reply With Quote #14

Quote:
Originally Posted by Bugsy View Post
Above code is updated
thank you very much its will be cool in my server
QuickDroLLL 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 02:17.


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