AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   [CS:GO] Thunder/Lighting Bolt Headshot Kill Effect (https://forums.alliedmods.net/showthread.php?t=341487)

valluri 01-25-2023 11:19

[CS:GO] Thunder/Lighting Bolt Headshot Kill Effect
 
I have seen videos of people playing on CS:GO servers, And when they get a headshot, Lightning Bolts come out of the head and a short blue flash appears.
I have tried looking for hours, But I couldn't find it anywhere.

Heres a screenshot of it. (Sorry for low quality.)
https://imgur.com/EbRsWbX.png

Bacardi 01-25-2023 20:37

Re: [CS:GO] Thunder/Lighting Bolt Headshot Kill Effect
 
point_tesla entity perhaps ?
https://developer.valvesoftware.com/wiki/Point_tesla

Maybe can fiddle with one same entity when round start, teleport or set source entity to tesla and execute:
DoSpark

*edit
PHP Code:


/*
Server event "player_death", Tick 11930:
- "userid" = "4"
- "attacker" = "2"
- "assister" = "0"
- "assistedflash" = "0"
- "weapon" = "usp_silencer"
- "weapon_itemid" = "0"
- "weapon_fauxitemid" = "17293822569102704701"
- "weapon_originalowner_xuid" = "76561197988592905"
- "headshot" = "1"
- "dominated" = "0"
- "revenge" = "0"
- "wipe" = "0"
- "penetrated" = "0"
- "noreplay" = "1"
- "noscope" = "0"
- "thrusmoke" = "0"
- "attackerblind" = "0"
- "distance" = "10.64"
*/

#include <sdktools>

int point_tesla_ref = -1;
int env_fade_ref = -1;

public 
void OnPluginStart()
{
    
HookEvent("player_death"player_death);
    
HookEvent("round_freeze_end"round_freeze_end);
}

public 
void OnConfigsExecuted()
{
    
PrecacheGeneric("sprites/physbeam.vmt");
}

public 
void round_freeze_end(Event event, const char[] namebool dontBroadcast)
{
    if(
EntRefToEntIndex(point_tesla_ref) == -1)
    {

        
int entity CreateEntityByName("point_tesla");
        
        if(
entity == -1)
            return;

        
point_tesla_ref entity;

        if(
IsValidEntity(entity) && IsValidEdict(entity))
            
point_tesla_ref EntIndexToEntRef(entity);


        
DispatchKeyValue(entity"beamcount_max""8");
        
DispatchKeyValue(entity"beamcount_min""6");
        
DispatchKeyValue(entity"interval_max""2");
        
DispatchKeyValue(entity"interval_min""0.5");
        
DispatchKeyValue(entity"lifetime_max""0.3");
        
DispatchKeyValue(entity"lifetime_min""0.3");
        
DispatchKeyValue(entity"m_Color""255 255 255");
        
DispatchKeyValue(entity"m_flRadius""200");
        
DispatchKeyValue(entity"m_SoundName""DoSpark");
        
DispatchKeyValue(entity"texture""sprites/physbeam.vmt");
        
DispatchKeyValue(entity"thick_max""5");
        
DispatchKeyValue(entity"thick_min""4");
        
DispatchSpawn(entity);
    }

    if(
EntRefToEntIndex(env_fade_ref) == -1)
    {

        
int entity CreateEntityByName("env_fade");
        
        if(
entity == -1)
            return;

        
env_fade_ref  entity;

        if(
IsValidEntity(entity) && IsValidEdict(entity))
            
env_fade_ref  EntIndexToEntRef(entity);


        
DispatchKeyValue(entity"duration""0.3");
        
DispatchKeyValue(entity"renderamt""255");
        
DispatchKeyValue(entity"rendercolor""29 211 222");
        
DispatchKeyValue(entity"ReverseFadeDuration""0.3");
        
DispatchKeyValue(entity"spawnflags""5");
        
DispatchSpawn(entity);


    }
}

public 
void player_death(Event event, const char[] namebool dontBroadcast)
{
    if(!
event.GetBool("headshot"))
        return;

    
int victim GetClientOfUserId(event.GetInt("userid"));

    
float pos[3];
    
GetClientEyePosition(victimpos);

    
TeleportEntity(point_tesla_refposNULL_VECTORNULL_VECTOR);
    
AcceptEntityInput(point_tesla_ref"DoSpark");

    
int attacker GetClientOfUserId(event.GetInt("attacker"));

    if(
attacker == || !IsClientInGame(attacker) || IsFakeClient(attacker))
        return;

    
AcceptEntityInput(env_fade_ref"Fade"attacker);
}

/*
entity
{
    "id" "1251"
    "classname" "env_fade"
    "duration" "2"
    "renderamt" "255"
    "rendercolor" "29 211 222"
    "ReverseFadeDuration" "2"
    "spawnflags" "5"
    "targetname" "fade"
    "origin" "496 720 96"
    editor
    {
        "color" "220 30 220"
        "visgroupshown" "1"
        "visgroupautoshown" "1"
        "logicalpos" "[0 0]"
    }
}

entity
{
    "id" "1240"
    "classname" "point_tesla"
    "beamcount_max" "8"
    "beamcount_min" "6"
    "interval_max" "2"
    "interval_min" "0.5"
    "lifetime_max" "0.3"
    "lifetime_min" "0.3"
    "m_Color" "255 255 255"
    "m_flRadius" "200"
    "m_SoundName" "DoSpark"
    "targetname" "tesla"
    "texture" "sprites/physbeam.vmt"
    "thick_max" "5"
    "thick_min" "4"
    "origin" "464 720 64"
    editor
    {
        "color" "220 30 220"
        "visgroupshown" "1"
        "visgroupautoshown" "1"
        "logicalpos" "[0 0]"
    }
*/ 


Danielej1 01-26-2023 15:09

Re: [CS:GO] Thunder/Lighting Bolt Headshot Kill Effect
 
Can you do this for Vip? Flag "o" ? and that it can be turned off and on?

Bacardi 02-01-2023 00:31

Re: [CS:GO] Thunder/Lighting Bolt Headshot Kill Effect
 
1 Attachment(s)
In this version, I have made some edit or fixes as well, to avoid errors.


This plugin use cookies (aka SM plugin "Client Preferences")
- Means, player can save plugin setting from sm_settings (or using sm_cookies headshot_tesla 1 or 0)
- This data is saved into ...addons/sourcemod/data/sqlite/clientprefs-sqlite.sq3
- After player have made save first time, setting will remain in that state until player change it next time.
- To clarify, player need himself go to !settings and set plugin feature to be always On or Off.
- Another command is: sm_thunder
-- If player not make a save for first time (this will happen on 90% of players), plugin feature would appear how next cvar is set.




Plugin have Console Variable
Code:

//"sm_headshotthundersetting_default" = "0" min. 0.000000 max. 1.000000
//- For new player, is plugin feature enabled by default ? 1 = on, 0 = off

By default, plugin effect is disabled for new players, who haven't save plugin setting at all.
- Changing cvar value on fly:
sm_cvar sm_headshotthundersetting_default 1 or 0
You can enable and disable plugin effect on those players who have not make a settings save.





Admin system.
- You can disable plugin effect from non-admins.
By default, plugin effect is enabled for everyone.
To override plugin effect to admins only, use word "sm_thunder"
...addons/sourcemod/configs/admin_overrides.cfg
PHP Code:


Overrides
{
    
/**
     * By default, commands are registered with three pieces of information:
     * 1)Command Name         (for example, "csdm_enable")
     * 2)Command Group Name    (for example, "CSDM")
     * 3)Command Level        (for example, "changemap")
     *
     * You can override the default flags assigned to individual commands or command groups in this way.
     * To override a group, use the "@" character before the name.  Example:
     * Examples:
     *        "@CSDM"            "b"                // Override the CSDM group to 'b' flag
     *         "csdm_enable"    "bgi"            // Override the csdm_enable command to 'bgi' flags
     *
     * Note that for overrides, order is important.  In the above example, csdm_enable overwrites
     * any setting that csdm_enable previously had.
     *
     * You can make a command completely public by using an empty flag string.
     */

    
"sm_thunder"    "a" // key value "" remove flags


And when you want use admin override to one of admin groups (example "Default")
...addons/sourcemod/configs/admin_groups.cfg
PHP Code:


Groups
{
    
/**
     * Allowed properties for a group:
     *
     *   "flags"           - Flag string.
     *   "immunity"        - Immunity level number, or a group name.
     *                         If the group name is a number, prepend it with an 
     *                         '@' symbol similar to admins_simple.ini.  Users 
     *                         will only inherit the level number if it's higher 
     *                         than their current value.
     */
    
"Default"
    
{
         
Overrides
         
{
            
"sm_thunder"    "allow" // or "deny" to block access
         
}
        
"immunity"        "1"
    
}
    
    
"Full Admins"
    
{
        
/**
         * You can override commands and command groups here.
         * Specify a command name or group and either "allow" or "deny"
         * Examples:
         *         ":CSDM"            "allow"
         *        "csdm_enable"    "deny"
         */
         
Overrides
         
{
         }
        
"flags"            "abcdefghiz"

        
/* Largish number for lots of in-between values. */
        
"immunity"        "99"
    
}







Rant:
If this plugin still need some edit or fix, I look it next time in year 2024

Danielej1 02-02-2023 15:48

Re: [CS:GO] Thunder/Lighting Bolt Headshot Kill Effect
 
Hi, I get errors on your plugin

Code:

L 02/02/2023 - 05:10:10: SourceMod error session started
L 02/02/2023 - 05:10:10: Info (map "de_mirage") (file "/clients/s85832/csgo/addons/sourcemod/logs/errors_20230202.log")
L 02/02/2023 - 05:10:10: [SM] Exception reported: Cannot create new entity when no map is running
L 02/02/2023 - 05:10:10: [SM] Blaming: csgo_effect_thunder_headshot.smx
L 02/02/2023 - 05:10:10: [SM] Call stack trace:
L 02/02/2023 - 05:10:10: [SM]  [0] CreateEntityByName
L 02/02/2023 - 05:10:10: [SM]  [1] Line 250, C:\Users\diese\OneDrive\Pulpit\compiler\csgo_effect_thunder_headshot.sp::round_freeze_end
L 02/02/2023 - 05:10:10: [SM]  [2] Line 77, C:\Users\diese\OneDrive\Pulpit\compiler\csgo_effect_thunder_headshot.sp::OnPluginStart
L 02/02/2023 - 05:10:10: [SM] Unable to load plugin "csgo_effect_thunder_headshot.smx": Error detected in plugin startup (see error logs)
L 02/02/2023 - 08:19:14: [SM] Exception reported: Script execution timed out
L 02/02/2023 - 08:19:15: Error log file session closed.
L 02/02/2023 - 08:20:15: SourceMod error session started


Bacardi 02-02-2023 18:42

Re: [CS:GO] Thunder/Lighting Bolt Headshot Kill Effect
 
in line 77, disable this with double slas // and recompile.
PHP Code:

    //round_freeze_end(null, "", false); // find or create plugin entities when plugin reloaded 

Quote:

Originally Posted by Danielej1 (Post 2798493)
Hi, I get errors on your plugin

Code:

L 02/02/2023 - 05:10:10: SourceMod error session started
L 02/02/2023 - 05:10:10: Info (map "de_mirage") (file "/clients/s85832/csgo/addons/sourcemod/logs/errors_20230202.log")
L 02/02/2023 - 05:10:10: [SM] Exception reported: Cannot create new entity when no map is running
L 02/02/2023 - 05:10:10: [SM] Blaming: csgo_effect_thunder_headshot.smx
L 02/02/2023 - 05:10:10: [SM] Call stack trace:
L 02/02/2023 - 05:10:10: [SM]  [0] CreateEntityByName
L 02/02/2023 - 05:10:10: [SM]  [1] Line 250, C:\Users\diese\OneDrive\Pulpit\compiler\csgo_effect_thunder_headshot.sp::round_freeze_end
L 02/02/2023 - 05:10:10: [SM]  [2] Line 77, C:\Users\diese\OneDrive\Pulpit\compiler\csgo_effect_thunder_headshot.sp::OnPluginStart
L 02/02/2023 - 05:10:10: [SM] Unable to load plugin "csgo_effect_thunder_headshot.smx": Error detected in plugin startup (see error logs)
L 02/02/2023 - 08:19:14: [SM] Exception reported: Script execution timed out
L 02/02/2023 - 08:19:15: Error log file session closed.
L 02/02/2023 - 08:20:15: SourceMod error session started



trzmielu 02-06-2023 17:05

Re: [CS:GO] Thunder/Lighting Bolt Headshot Kill Effect
 
How can I make "fade" more transparent from the beginning? Tried changing renderamt, spawnflags but nothing worked.
Rn color fully covers the screen for a sec and players are getting distracted

Bacardi 02-06-2023 20:37

Re: [CS:GO] Thunder/Lighting Bolt Headshot Kill Effect
 
Try
"renderamt", "55"


*edit
*Nope, this command not have transparent value
You can test with cheats on witn console command:
Code:

fadein 0.3 29 211 222 55


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

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