Ads keep us online. Without them, we wouldn't exist. We don't have paywalls or sell mods - we never will. But every month we have large bills and running ads is our only way to cover them. Please consider unblocking us. Thank you from GameBanana <3

[AMXX] Bullet Damage for TS 3.0

A Config Script for The Specialists

No ads for members. Membership is 100% free. Sign up!
84 2 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
/* AMX Mod X Plugin
*
* Bullet Damage for The Specialists 3.0
* Version: 2.0
*
* (c) Copyright 2020, SNMetamorph
* This file is provided as is (no warranties).
*
*/


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

new g_syncHudMessage;

public plugin_init()
{
        register_plugin("Bullet Damage", "2.0", "SNMetamorph");
        g_syncHudMessage = CreateHudSyncObj();
        RegisterHam(Ham_TakeDamage, "player", "OnTakeDamage");
}

public bool:IsMonsterAlive(id)
{
        return (pev(id, pev_deadflag) == 0);
}

public HSVtoRGB(Float:h, Float:s, Float:v, &Float:r, &Float:g, &Float:b)
{
        if (h > 360.0) h -= 360.0
        else if (h < 0.0) h += 360.0
        if (s == 0) {
                r = v;  g = v;  b = v;
        } else {
                new Float:fHue, Float:fValue, Float:fSaturation;
                new i;  new Float:f;  new Float:p,Float:q,Float:t;
                if (h == 360.0) h = 0.0;
                fHue = h / 60.0;
                i = floatround(fHue, floatround_floor);
                f = fHue - i;
                fValue = v;
                fSaturation = s;
                p = fValue * (1.0 - fSaturation);
                q = fValue * (1.0 - (fSaturation * f));
                t = fValue * (1.0 - (fSaturation * (1.0 - f)));
                switch (i) {
                        case 0: {r = fValue; g = t; b = p;}
                        case 1: {r = q; g = fValue; b = p; }
                        case 2: {r = p; g = fValue; b = t;}
                        case 3: {r = p; g = q; b = fValue;}
                        case 4: {r = t; g = p; b = fValue;}
                        case 5: {r = fValue; g = p; b = q; }
                }
        }
}

public OnTakeDamage(idVictim, idWeapon, idAttacker, Float:fDamage, iDamageType)
{
        new Float:fHueAngle;
        new iRed, iGreen, iBlue;
        new Float:fRed, Float:fGreen, Float:fBlue;

        if (fDamage < 1.0)
                return HAM_IGNORED;
        if (is_user_hltv(idAttacker) || !is_user_connected(idAttacker))
                return HAM_IGNORED;
        if (!IsMonsterAlive(idVictim))
                return HAM_IGNORED;

        fHueAngle = 120.0 - (fDamage / 100.0 * 120.0);
        if (fHueAngle < 0.0)
                fHueAngle = 0.0;

        HSVtoRGB(fHueAngle, 1.0, 1.0, fRed, fGreen, fBlue);
        iRed   = floatround(fRed * 255.0, floatround_floor);
        iGreen = floatround(fGreen * 255.0, floatround_floor);
        iBlue  = floatround(fBlue * 255.0, floatround_floor);
               
        set_hudmessage(iRed, iGreen, iBlue, 0.45, -1.0, 2, 0.1, 3.0, 0.02, 0.02, -1);
        ShowSyncHudMsg(idAttacker, g_syncHudMessage, "%3d", floatround(fDamage));
        return HAM_HANDLED;
}
Analog of same named AMXX plugin for Counter-Strike 1.6.
Works true with players, but not react to bots.
Color of text depends on damage value (smooth varying from green to red in range of damage from 1 to 100 HP)
Sign up to access this!

No comments yet

Embed

Share banner
Image URL
HTML embed code
BB embed code
Markdown embed code

Credits

Authors of original Bullet Damage plugin
f117bomb
Kingpin

Submitter

SNMetamorph avatar
SNMetamorph Joined 2y ago
Offline
SNMetamorph
Creator
Sign up to access this!
Sign up to access this!
Sign up to access this!

Game

Sign up to access this!

Category

License

Share

  • Share on Reddit
  • Share on Twitter
  • Share on Facebook
  • 0
  • 287
  • 19d
  • 7d