AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Request for Damage Glow change (https://forums.alliedmods.net/showthread.php?t=346759)

bakugan 03-15-2024 17:56

Request for Damage Glow change
 
Can this code be changed so that the color of nemesis is removed and instead a color of this type is displayed? CT should shine blue, and the Terrorist group should shine red.



Code:

/*
 Glow Damage v1.10.1
 
* Details : Makes players glow when damage.

* Cvars:
glowdamage_type 1/2
1= Random Colors
2= Colors in function by user team : Terro Team and CT Team and if Damage > 15 have some colors,
else if damage > 40 have another colors, etc

* Tests:
- Tested on CS 1.6 with AMXMODX 1.10.1

* Required Modules
- Fun & Cstrike

* Credits:
- Doombringer for an fixed on CS Teams
- MaximusBrood for if conditions fixes

Have a nice day now
*/

#include <amxmodx>
#include <fun>
#include <cstrike>
 
new const PLUGIN[] = "Glow Damage"
new const VERSION[] = "1.10.1"
new const AUTHOR[] = "Test"
 
new pcvartype;
 
public plugin_init()
{
        register_plugin(PLUGIN, VERSION, AUTHOR)
        pcvartype = register_cvar("glowdamage_type","1")
        register_event("Damage","glow_event","b","2!0","3=0","4!0")
       
}
 

 
public glow_event()
{
        new r,g,b
 
        new Victim = read_data(0)
        new Damage = get_user_health(Victim)
 
        new CsTeams:playert = cs_get_user_team(Victim)
 
        switch (get_pcvar_num(pcvartype))
        {
                case 1:
                {
                        // random num for r,g,b colors
                        r = random_num(0,255)
                        g = random_num(0,255)
                        b = random_num(0,255)
                }
       
                case 2:
                {
                        // if is user from Terro team
                        if(playert == CS_TEAM_T)
                        {
                            if (Damage < 15)
                            {
                                r = 255
                                g = 80
                                b = 0
                            } else if(Damage > 40)
                            {
                                r = 255
                                g = 0
                                b = 0
                            } else
                            {
                                r = 200
                                g = 70
                                b = 0
                            }
                        } else
                        {
                            if(Damage <= 15)
                            {
                                r = 23
                                g = 243
                                b = 0
                            } else if(Damage >= 40)
                            {
                                r = 0
                                g = 255
                                b = 0
                            } else
                            {
                                r = 0
                                g = 65
                                b = 12
                            }
                        }
                }
        }
       
        playerglow(Victim,r,g,b)
 
        return PLUGIN_HANDLED
}

public playerglow(player,r,g,b)
{
    new Params[1]
    Params[0] = player   
    set_user_rendering(player,kRenderFxGlowShell,r,g,b,kRenderNormal,25)
    set_task(1.0,"stopglow",0,Params,1);
                     
}

public stopglow(Params[])
{
    if( !is_user_connected(Params[0]) )
        return PLUGIN_HANDLED;
   
    set_user_rendering(Params[0],kRenderFxGlowShell,0,0,0,kRenderNormal,25)
    return PLUGIN_CONTINUE;
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/

When someone shoots towards the enemy, I want it to light up entirely in red for (T) and blue for (CT). Here's a slight improvement on the picture; you can see what it's almost about.

https://i.imgur.com/ZJG13SB.jpeg

Here is the translation:

"This is exactly how I want it to look when players from the teams shoot at each other. In the picture, as you can see, there are arrows drawn on the ground and on the wall.

Tote 03-16-2024 11:40

Re: Request for Damage Glow change
 
https://www.rapidtables.com/web/color/RGB_Color.html

get the colors yourself here

bakugan 03-16-2024 14:32

Re: Request for Damage Glow change
 
Quote:

Originally Posted by Tote (Post 2819588)

EE0B0B

Tote 03-17-2024 19:14

Re: Request for Damage Glow change
 
Quote:

Originally Posted by bakugan (Post 2819593)
EE0B0B

i gave u for rgb colors you can use them in glow to change its color

bakugan 03-29-2024 17:48

Re: Request for Damage Glow change
 
I want it to be like Nemesis to light up but when someone shoots in their CT teams and T teams

Code:

/*

Description:

With this plugin you can know who is getting attacked.
The victim will get a glow (red for terrorists, blue for cts)

Cvars:

dg_enable_glow (0|1)  Default 1
dg_glow_type (1 - Glow color based on health 2- Glow color based on team )  Default 1

Modules:

Fakemeta

Changelog:
v1.4: Added glow modes 1 - Glow color based on health 2- Glow color based on team
v1.3: Added glow color with user health
v1.2: Fix some code tips, thanks Connor ;)
v1.1: Simplified code
v1.0: First Release

enjoy it!

*/

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

#define PLUGIN "Damage Glow"
#define VERSION "v3.4"
#define AUTHOR "HarveyWNvm LLC."

new pcvar_enabled,pcvar_type

new Float:MaxHealth[33]
new Float:CTRenderColor[3] = { 0.0,0.0,200.0 }
new Float:TTRenderColor[3] = { 200.0,0.0,0.0 }

public plugin_init(){
       
        register_plugin(PLUGIN, VERSION, AUTHOR)
        register_cvar("dg_version",VERSION,FCVAR_SERVER|FCVAR_SPONLY)
        pcvar_enabled = register_cvar("dg_enable_glow","1")
        pcvar_type = register_cvar("dg_glow_mode","1")// 1 - Glow color based on health 2- Glow color based on team
        register_event("Damage", "Glow_Event", "b", "2!0", "3=0", "4!0")
        RegisterHam( Ham_Spawn, "player", "PlayerSpawn", 1 )
}

public PlayerSpawn(id)
{
        if ( is_user_alive(id))
        {
                pev(id, pev_health, MaxHealth[id]);
                SetRendering (id)
        }
}

public Glow_Event(id){
       
        if(get_pcvar_num(pcvar_enabled)){
                switch(get_pcvar_num(pcvar_type)){
                        case 1:{
                                static Float:RenderColor[ 3 ];
                                static Float:CurrentHealth;
                                static Float:r;
                                static Float:g;
                                static Float:GlowHealth;
                               
                                pev(id,pev_health, CurrentHealth)
                                GlowHealth = MaxHealth[id] * 0.5
                               
                                if(CurrentHealth == GlowHealth)
                                {
                                        r = 255.0
                                        g = 255.0
                                }
                                else if(CurrentHealth < GlowHealth)
                                {
                                        r = 255.0
                                        g = 5.1 * CurrentHealth
                                }
                                else if(CurrentHealth > GlowHealth && CurrentHealth != MaxHealth[id])
                                {
                                        r = 255.0 - 5.1 * ( CurrentHealth - 50 )
                                        g = 255.0
                                }
                               
                                RenderColor[0] = r
                                RenderColor[1] = g
                               
                                SetRendering(id, kRenderFxGlowShell, RenderColor, kRenderNormal, 16.0 )
                               
                                set_task(1.0,"remove_glow",id)
                        }
                        case 2: {
                                switch(get_user_team(id)){
                                        case 1:
                                                SetRendering(id, kRenderFxGlowShell, TTRenderColor, kRenderNormal, 16.0 )
                                       
                                        case 2:
                                                SetRendering(id, kRenderFxGlowShell,CTRenderColor, kRenderNormal, 16.0 )
                                       
                                }
                                set_task(1.0,"remove_glow",id)
                        }
                }
        }
       
}

public remove_glow(id)
        SetRendering (id)


SetRendering(iEnt, iRenderFx=kRenderFxNone, Float:flRenderColor[3]={255.0,255.0,255.0}, iRender=kRenderNormal, Float:flAmount=16.0){
       
        set_pev(iEnt, pev_renderfx, iRenderFx)
        set_pev(iEnt, pev_rendercolor, flRenderColor)
        set_pev(iEnt, pev_rendermode, iRender)
        set_pev(iEnt, pev_renderamt, flAmount)
}


georgik57 03-30-2024 13:14

Re: Request for Damage Glow change
 
What you want is DLIGHT which has a very high impact on player fps. I would not recommend doing this at all.

bakugan 03-30-2024 18:21

Re: Request for Damage Glow change
 
Quote:

Originally Posted by georgik57 (Post 2820330)
What you want is DLIGHT which has a very high impact on player fps. I would not recommend doing this at all.


I saw in some Serbians there were blue and red lights. However, when I wrote this plugin, it is not the same as I want it to be. I just want to speak up to change the plugin.

team ( T ) glows red when they take their damage
team ( CT ) They glow blue when counter terrorists attack towards them and they glow blue.


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

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