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

Discard a player on a hit in CS:S


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Drimacus
Member
Join Date: Jun 2011
Old 03-18-2024 , 01:54   Discard a player on a hit in CS:S
Reply With Quote #1

This is how I discard players when hit in the body or close to it, such as under the feet.
PHP Code:
#include <sdktools>

new Handle:cvarRadius;
new 
Handle:cvarMagnitude;

int g_sprite 0;

...

public 
OnPluginStart()
{
    
cvarRadius CreateConVar("sm_rocketguns_radius""150""Radius of the explosions."0true150.0false_);
    
cvarMagnitude CreateConVar("sm_rocketguns_magnitude""300""Magnitude of the explosions."0true300.0false_);
    
AutoExecConfig(true"rocket_guns");

    
HookEvent("bullet_impact"Event_BulletImpactEventHookMode_Pre);    
}

public 
OnMapStart()
{
    
g_sprite PrecacheGeneric("sprites/zerogxplode.spr"true);
}

public 
Action Event_BulletImpact(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    if (!
IsClientInGame(client))
        return;

    new 
Float:origin[3];
    
origin[0] = GetEventFloat(event"x");
    
origin[1] = GetEventFloat(event"y");
    
origin[2] = GetEventFloat(event"z");

    new 
Float:ClientOrigin[3];
    
GetClientAbsOrigin(clientClientOrigin);

    
char weapon[32];
    
GetClientWeapon(clientweaponsizeof(weapon));

    if (
StrContains("weapon_deagle"weapon) != -1)
    {
        new 
radius GetConVarInt(cvarRadius);
        new 
magnitude GetConVarInt(cvarMagnitude);

        
char s_radius[32];
        
char s_magnitude[32];
        
IntToString(radiuss_radiussizeof(s_radius));
        
IntToString(magnitudes_magnitudesizeof(s_magnitude));

        new 
entity CreateEntityByName("env_explosion");
        
DispatchKeyValueVector(entity"origin"origin);
        
DispatchKeyValue(entity"imagnitude"s_magnitude);
        
DispatchKeyValue(entity"iradiusoverride"s_radius);
        
DispatchKeyValue(entity"spawnflags""0");
        
SetEntPropEnt(entityProp_Send"m_hOwnerEntity"client);

        
DispatchSpawn(entity);
        
AcceptEntityInput(entity"Explode");

        
TE_SetupExplosion(origing_sprite1.010TE_EXPLFLAG_NONEradiusmagnitude);
        
TE_SendToAll();
    }

Here with these parameters

sm_rocketguns_magnitude "300"
sm_rocketguns_radius "150"

or

sm_rocketguns_magnitude "1300"
sm_rocketguns_radius "1150."


Players are very weakly repelled, but their bodies after death fly away at breakneck speed.

Is there any other method to repel players when they are hit?

Last edited by Drimacus; 03-18-2024 at 01:55.
Drimacus 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 11:17.


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