Counter-Strike 1.6 Icon CS1.6 Script

[AMXX] [ALL] Glowing Color By Speed

Greetings! We are one of the oldest mod sites on the Interwebs. Sign up and maximize your browsing experience.

  • Subscribe: Get notified of new submissions like this.
  • Say Thanks: Show your appreciation by sending Rj. points.
  • Post: Give Rj. your thoughts on this Script.
  • Vote: Help Rj. win the Monthly Awards.
  • Rate: Give this Script a rating out of 10.
  • Flag: Alert moderators and warn members of a problem with this Script.
  • Watch: Get notified when this Script is updated.
Mascot

Stop Lurking!

Become a Bananite

Already a Bananite? Login

Works with any AMXModX supported modification/games - HideN'Seek Mod - Player - Glow

145 lines | 3 kb | Raw Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#include <amxmodx>
#include <fakemeta>
#include <fun>

#define PLUGIN "Glowing Color By Speed"
#define VERSION "1.0"
#define AUTHOR "Garey"

// Comment below if you do not want /glow showing up on chat
#define ECHOCMD

#define FREQ 0.1

new bool:plrGlow[33] = { true, ... };

new TaskEnt,g_showglow,g_glowamount,g_minspeed,g_maxspeed, maxplayers

public plugin_init() {
        register_plugin(PLUGIN, VERSION, AUTHOR)
        register_cvar("Garey", "Glowing Color By Speed", FCVAR_SERVER)
        register_forward(FM_Think, "Think")
       
        TaskEnt = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))      
        set_pev(TaskEnt, pev_classname, "speedometer_think")
        set_pev(TaskEnt, pev_nextthink, get_gametime() + 1.01)
       
        register_clcmd("say /glow", "toogleGlow")
       
        g_showglow = register_cvar("gbs_start", "0")
        g_glowamount=register_cvar("gbs_amount", "25")
        g_minspeed=register_cvar("gbs_glow_min_speed", "250")
        g_maxspeed=register_cvar("gbs_glow_max_speed", "300")
       
        maxplayers = get_maxplayers()
}

public Think(ent)
{
        if(ent == TaskEnt)
        {
                SpeedTask()
                set_pev(ent, pev_nextthink,  get_gametime() + FREQ)
        }
}

public client_putinserver(id)
{
        plrGlow[id] = (get_pcvar_num(g_showglow)) > 0 ? true : false
}

public toogleGlow(id)
{
        if( plrGlow[id] )
        {
                client_print(id, print_chat, "[AMXX] Glowing is disabled for you.");
                set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderNormal,0)
                plrGlow[id] = false;
        }
        else
        {
                client_print(id, print_chat, "[AMXX] Glowing is enabled for you.");
                plrGlow[id] = true;
        }
       
        #if defined ECHOCMD
        return PLUGIN_CONTINUE;
        #else
        return PLUGIN_HANDLED;
        #endif
}

stock dynamicColor(min,max,Float:value,&red,&green,&blue)
{ //Don`t launch with max ~= min
        #define MaxC 255
        #define MinC 0
        #define DtC 255
       
        if (value>=max)
        {
                red=MaxC;
                green=MinC;
                blue=MinC;
                return;
        }
        else if (value<=min)
        {
                red=MinC;
                green=MinC;
                blue=MaxC;
                return;
        }
       
        new Float:step = (max-min)/4.0;
        new Float:dt = value-min;
       
        if (dt <= step)
        {
                red   = MinC;
                green = floatround(dt*(DtC/step));
                blue  = MaxC;
        }
        else if (dt-=step, dt <= step)
        {
                red   = MinC;
                green = MaxC;
                blue  = floatround((step-dt)*(DtC/step));
        }
        else if (dt-=step, dt <= step)
        {
                red   = floatround(dt*(DtC/step));
                green = MaxC;
                blue  = MinC;
        }
        else
        {
                dt-=step;
                red   = MaxC;
                green = floatround((step-dt)*(DtC/step));
                blue  = MinC;
        }
        return;
}


SpeedTask()
{
static i, target
static Float:velocity[3]
static Float:speedh

for(i=1; i<=maxplayers; i++)
{
        if(!is_user_connected(i)) continue
        if(!plrGlow[i]) continue
       
        target = pev(i, pev_iuser1) == 4 ? pev(i, pev_iuser2) : i
        pev(target, pev_velocity, velocity)
       
        speedh = floatsqroot(floatpower(velocity[0], 2.0) + floatpower(velocity[1], 2.0))
       
        static r, g, b
        dynamicColor(get_pcvar_num(g_minspeed),get_pcvar_num(g_maxspeed),speedh,r,g,b)
        set_user_rendering(i,kRenderFxGlowShell,r,g,b,kRenderNormal,get_pcvar_num(g_glowamount))       
}
}
Here's simply plugin, it's switch the color of glow by player speed, very fun for hidenseek.

Cvars:

gbs_start (1-0) - Is the players have glow on startmap?
gbs_amount (0-255) - Amount of Glow
gbs_glow_min_speed - Minimum speed plugin start switch colors
gbs_glow_max_speed - Maximum speed plugin stop switch colors

Posts

  • 3mo
    Bloody Death Skull avatar
    Bloody Death Skull avatar In The Shadows
    Member Joined 2y
    i have compile some of your scripts for cs 1.6
    and are really good buddie

    10/10

    • Have my babies x 1
    • You rock x 1
    • Correct x 1
    Mapper,Texturer,Skinner... avatar
    Mantra
    Mapper,Texturer,Skinner...

Share

Shareable Image:
Share banner
HTML embed code:
BB embed code:
Markdown embed code:

More embeddable images

Bookmark and Share

Credits

Original Authors
Garey
AMXX Script/Codes
Special Thanks
AcidoX
Speedometer
Lt.RAT
Dynamic Color Codes

Submitter

Rj. avatar
Rj. Dreamin'
Member Joined 12mo
35 medals 4 legendary 9 rare
  • Submitted 15 Tools Medal icon
  • Submitted 50 Gamefiles Medal icon
  • 15+ Entries! GameBanana’s Christmas Giveaway 2016 Medal icon
  • Thanked 500 submitters Medal icon
  • 2nd Place - Game Poetry Contest Medal icon
  • Submitted 5 Tools Medal icon

Rj.
Redistributor
Are you the owner? Request Ownership
Send a Private Message to the submitter

Category

Attributes

Language
Pawn (AMXMODX)

Stats

Posts
1
Views
594
Date Added
3mo