Raised This Month: $32 Target: $400
 8% 

(CSGO) C4 Explosion Damage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ark_Procession
Senior Member
Join Date: Jun 2020
Location: Argentina
Old 10-20-2021 , 23:01   (CSGO) C4 Explosion Damage
Reply With Quote #1

Hello! Is there any way to change c4 explosion damage? any plugin out there?
Ark_Procession is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 10-21-2021 , 11:59   Re: (CSGO) C4 Explosion Damage
Reply With Quote #2

For csgo, remove cheat flags from commands:
map_setbombradius
map_showbombradius



This will change (or create) entity info_map_parameters bombradius value.
Default radius is 500
Maximum radius is 2048
- Output message: Bomb Damage is 2048, Radius is 7168

PHP Code:

public void OnPluginStart()
{
    if(
CommandExists("map_setbombradius"))
    {
        
SetCommandFlags("map_setbombradius"FCVAR_NONE);
    }
    if(
CommandExists("map_showbombradius"))
    {
        
SetCommandFlags("map_showbombradius"FCVAR_NONE);
    }


However in CS:S, above code works but it would spam lot of errors in server console x 104 times:
UTIL_GetListenServerHost() called from a dedicated server or single-player game.

So here is some kind "replica"

PHP Code:
#include <sdktools>

public void OnPluginStart()
{
    
RegAdminCmd("sm_map_setbombradius"map_setbombradiusADMFLAG_CHEATS);
    
RegAdminCmd("sm_map_showbombradius"map_showbombradiusADMFLAG_CHEATS);
}

int info_map_parameters = -1;
float radius 500.0;

public 
void OnMapStart()
{
    
info_map_parameters FindEntityByClassname(-1"info_map_parameters");
    
radius 500.0// I can't get real value m_flBombRadius from entity info_map_parameters. I set default 500.0
}


public 
Action map_setbombradius(int clientint args)
{
    if(
args 1)
    {
        
map_showbombradius(client0);

        return 
Plugin_Handled;
    }

    
char arg[10];
    
GetCmdArg(1argsizeof(arg));
    
radius StringToFloat(arg);

    
// Find entity "info_map_parameters"
    
info_map_parameters FindEntityByClassname(-1"info_map_parameters");


    if(
info_map_parameters == -1)
    {
        
// Try create entity "info_map_parameters"
        
info_map_parameters CreateEntityByName("info_map_parameters");

        if(
info_map_parameters == -1)
        {
            
LogError("Couldn't create entity \"info_map_parameters\"");
            return 
Plugin_Handled;
        }
    }

    
DispatchKeyValueFloat(info_map_parameters"bombradius"radius);

    
map_showbombradius(client0);

    return 
Plugin_Handled;
}

public 
Action map_showbombradius(int clientint args)
{
    
float bombdamage 500.0;

    if(
info_map_parameters != -1)
    {
        
bombdamage radius;
    }

    
float bombradius bombdamage 3.5;

    
PrintToConsole(client"Bomb Damage is %.0f, Radius is %.0f\n"bombdamagebombradius );
    

    return 
Plugin_Handled;

__________________
Do not Private Message @me

Last edited by Bacardi; 10-21-2021 at 12:00.
Bacardi is offline
Ark_Procession
Senior Member
Join Date: Jun 2020
Location: Argentina
Old 10-21-2021 , 16:57   Re: (CSGO) C4 Explosion Damage
Reply With Quote #3

Thanks Bacardi!, i have sv_cheats 1 in my server, so , should this cvars simply work without that code?
or should i compile that tiny amount of code and put the smx in plugins?
Ark_Procession is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 10-21-2021 , 18:06   Re: (CSGO) C4 Explosion Damage
Reply With Quote #4

try it
__________________
Do not Private Message @me
Bacardi is offline
Ark_Procession
Senior Member
Join Date: Jun 2020
Location: Argentina
Old 10-22-2021 , 10:03   Re: (CSGO) C4 Explosion Damage
Reply With Quote #5

Quote:
Originally Posted by Bacardi View Post
try it

i did! and it worked.

its a shame that the radius cant be kept low. but damage high.
Ark_Procession is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 10-22-2021 , 11:05   Re: (CSGO) C4 Explosion Damage
Reply With Quote #6

Ok, that was in-game explosion radius.

Here is for C4 explosion damage scale.
bombdamagescale 1.0 = 100%
bombdamagescale 0.5 = 50%
bombdamagescale 5.0 = 500%


PHP Code:
#include <sdkhooks>

ConVar bombdamagescale;
ConVar bombexplosiondistance;

public 
void OnPluginStart()
{

    
bombdamagescale CreateConVar("bombdamagescale""1.0""C4 explosion damage multiplier, 1.2 = 120\% 0.5 = 50\%"_true0.0);
    
bombexplosiondistance CreateConVar("bombexplosiondistance""200.0""C4 explosion distance"_true1.0);

    for(
int i 1<= MaxClientsi++)
    {
        if(
IsClientInGame(i)) OnClientPutInServer(i);
    }
}

public 
void OnClientPutInServer(int client)
{
    if(
IsClientSourceTV(client) || IsClientReplay(client))
        return;

    
SDKHook(clientSDKHook_OnTakeDamageAliveOnTakeDamageAlive);
}

public 
Action OnTakeDamageAlive(int victimint &attackerint &inflictorfloat &damageint &damagetype)
{

    if(
damagetype DMG_BLAST && attacker MaxClients && HasEntProp(attackerProp_Send"m_flC4Blow"))
    {
        
float pos1[3], pos2[3];

        
GetEntPropVector(attackerProp_Data"m_vecOrigin"pos1);
        
GetEntPropVector(victimProp_Data"m_vecOrigin"pos2);
        
        
//PrintToServer("GetVectorDistance %f", GetVectorDistance(pos1, pos2));

        
if(GetVectorDistance(pos1pos2) <= bombexplosiondistance.FloatValue)
        {
            
damage *= bombdamagescale.FloatValue;
            return 
Plugin_Changed;
        }
        
        
// No damage outside of bombexplosiondistance
        
return Plugin_Handled;
    }


    return 
Plugin_Continue;

__________________
Do not Private Message @me

Last edited by Bacardi; 10-25-2021 at 15:25. Reason: removed max limits
Bacardi is offline
Ark_Procession
Senior Member
Join Date: Jun 2020
Location: Argentina
Old 10-23-2021 , 22:39   Re: (CSGO) C4 Explosion Damage
Reply With Quote #7

Quote:
Originally Posted by Bacardi View Post
Ok, that was in-game explosion radius.

Here is for C4 explosion damage scale.
bombdamagescale 1.0 = 100%
bombdamagescale 0.5 = 50%
bombdamagescale 5.0 = 500%


PHP Code:
#include <sdkhooks>

ConVar bombdamagescale;

public 
void OnPluginStart()
{

    
bombdamagescale CreateConVar("bombdamagescale""1.0""C4 explosion damage multiplier, 1.2 = 120\% 5.0 = 50\%"_true0.0true5.0);

    for(
int i 1<= MaxClientsi++)
    {
        if(
IsClientInGame(i)) OnClientPutInServer(i);
    }
}

public 
void OnClientPutInServer(int client)
{
    if(
IsClientSourceTV(client) || IsClientReplay(client))
        return;

    
SDKHook(clientSDKHook_OnTakeDamageAliveOnTakeDamageAlive);
}

public 
Action OnTakeDamageAlive(int victimint &attackerint &inflictorfloat &damageint &damagetype)
{

    if(
damagetype DMG_BLAST && attacker MaxClients && HasEntProp(attackerProp_Send"m_flC4Blow"))
    {
        
damage *= bombdamagescale.FloatValue;
        return 
Plugin_Changed;
    }


    return 
Plugin_Continue;

It works perfectly. Any chance to add a distance cvar too?

Thanks so much Bacardi, i am glad you took the time to make this for me. it is deeply appreciated.

You rock

Last edited by Ark_Procession; 10-23-2021 at 22:42.
Ark_Procession is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 10-24-2021 , 01:49   Re: (CSGO) C4 Explosion Damage
Reply With Quote #8

Quote:
Originally Posted by Ark_Procession View Post
It works perfectly. Any chance to add a distance cvar too?

Thanks so much Bacardi, i am glad you took the time to make this for me. it is deeply appreciated.

You rock
Could you tell what you mean by distance ?
Bacardi is offline
Ark_Procession
Senior Member
Join Date: Jun 2020
Location: Argentina
Old 10-24-2021 , 03:22   Re: (CSGO) C4 Explosion Damage
Reply With Quote #9

Quote:
Originally Posted by Bacardi View Post
Could you tell what you mean by distance ?
i meant Change the radius of explosion but have it be independt from the damage set.
(otherwkse game default cvar should be enough) but its not the case.


eg: bombexplosiondistance 200. and the radius of the c4 explosion would be shorter.

i think the real reason why i ask for thia is because c4 damage go through walls and it feels a little bit
unrealistic.
Ark_Procession is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 10-24-2021 , 04:07   Re: (CSGO) C4 Explosion Damage
Reply With Quote #10

Updated post #6
__________________
Do not Private Message @me
Bacardi 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 16:46.


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