AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Discard a player on a hit in CS:S (https://forums.alliedmods.net/showthread.php?t=346801)

Drimacus 03-18-2024 01:54

Discard a player on a hit in CS:S
 
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?


All times are GMT -4. The time now is 09:09.

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