Bubble Trails

A Config Script for Counter-Strike 1.6

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

Join the community!

Sign up

Already a Bananite? Login

162 lines | 4 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
/*      Formatright © 2010, ConnorMcLeod

        Bubble Trails is free software;
        you can redistribute it and/or modify it under the terms of the
        GNU General Public License as published by the Free Software Foundation.

        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.

        You should have received a copy of the GNU General Public License
        along with Bubble Trails; if not, write to the
        Free Software Foundation, Inc., 59 Temple Place - Suite 330,
        Boston, MA 02111-1307, USA.
*/


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

#define VERSION "0.0.1"

#define IsPlayer(%1)    ( 1 <= %1 <= g_iMaxPlayers )
#define write_coord_f(%1)       engfunc(EngFunc_WriteCoord,%1)

const DONT_CHECK_WEAPONS_BITSUM = (1<<CSW_XM1014)|(1<<CSW_M3)|(1<<CSW_KNIFE)

new g_iMaxPlayers
new Trie:g_tClassNames

new g_sModelIndexBubbles

public plugin_precache()
{
        g_tClassNames = TrieCreate()

        RegisterHam(Ham_TraceAttack, "worldspawn", "TraceAttack", 1)
        TrieSetCell(g_tClassNames, "worldspawn", 1)
        RegisterHam(Ham_TraceAttack, "player", "TraceAttack", 1)
        TrieSetCell(g_tClassNames, "player", 1)

        register_forward(FM_Spawn, "Spawn", 1)

        g_sModelIndexBubbles = precache_model("sprites/bubble.spr")
}

public Spawn( iEnt )
{
        if( pev_valid(iEnt) )
        {
                static szClassName[32]
                pev(iEnt, pev_classname, szClassName, charsmax(szClassName))
                if( !TrieKeyExists(g_tClassNames, szClassName) )
                {
                        RegisterHam(Ham_TraceAttack, szClassName, "TraceAttack", 1)
                        TrieSetCell(g_tClassNames, szClassName, 1)
                }
        }
}

public plugin_init()
{
        register_plugin("Bubble Trails", VERSION, "ConnorMcLeod")

        g_iMaxPlayers = get_maxplayers()
}

public plugin_end()
{
        TrieDestroy(g_tClassNames)
}

public TraceAttack(iEnt, iAttacker, Float:flDamage, Float:fDir[3], ptr, iDamageType)
{
        if( !IsPlayer(iAttacker) || !is_user_alive(iAttacker) || DONT_CHECK_WEAPONS_BITSUM & (1<<get_user_weapon(iAttacker)) )
        {
                return
        }

        new Float:vecOrigin[3], Float:vecEnd[3]

        pev(iAttacker, pev_origin, vecOrigin)
        vecOrigin[2] += ((pev(iAttacker, pev_flags) & FL_DUCKING) ? 12.0 : 18.0)
        get_tr2(ptr, TR_vecEndPos, vecEnd)

        new Float:vecTemp[3]
        vecTemp[0] = vecEnd[0] - vecOrigin[0]
        vecTemp[1] = vecEnd[1] - vecOrigin[1]
        vecTemp[2] = vecEnd[2] - vecOrigin[2]

        UTIL_BubbleTrail(vecOrigin, vecEnd, floatround(vector_length(vecTemp) / 64.0) )
}

UTIL_BubbleTrail(Float:vecSource[3], Float:vecTo[3], iCount )
{
        new Float:flHeight = UTIL_WaterLevel(vecSource, vecSource[2], vecSource[2] + 256.0 )
        flHeight = flHeight - vecSource[2]

        if(flHeight < 8.0)
        {
                flHeight = UTIL_WaterLevel( vecTo,  vecTo[2], vecTo[2] + 256.0 )
                flHeight = flHeight - vecTo[2]
                if(flHeight < 8.0)
                        return

                flHeight = flHeight + vecTo[2] - vecSource[2]
        }

        if(iCount > 255)
        {
                iCount = 255
        }

        message_begin( MSG_BROADCAST, SVC_TEMPENTITY )
        {
                write_byte( TE_BUBBLETRAIL )
                write_coord_f( vecSource[0] )   // mins
                write_coord_f( vecSource[1] )
                write_coord_f( vecSource[2] )
                write_coord_f( vecTo[0] )       // maxz
                write_coord_f( vecTo[1] )
                write_coord_f( vecTo[2] )
                write_coord_f( flHeight )                       // height
                write_short( g_sModelIndexBubbles )
                write_byte( iCount ) // count
                write_coord( 8 ) // speed
        }
        message_end()
}

Float:UTIL_WaterLevel( Float:position[3], Float:minz, Float:maxz )
{
        new Float:midUp[3]
        midUp[0] = position[0]
        midUp[1] = position[1]
        midUp[2] = minz

        if (engfunc(EngFunc_PointContents, midUp) != CONTENTS_WATER)
                return minz

        midUp[2] = maxz
        if (engfunc(EngFunc_PointContents, midUp) == CONTENTS_WATER)
                return maxz

        new Float:diff = maxz - minz
        while(diff > 1.0)
        {
                midUp[2] = minz + diff/2.0
                if (engfunc(EngFunc_PointContents, midUp) == CONTENTS_WATER)
                {
                        minz = midUp[2]
                }
                else
                {
                        maxz = midUp[2]
                }
                diff = maxz - minz
        }

        return midUp[2]
}
.: Description :.

Enables bubble trails when you shot at or from water.
This is already enabled in cs for shotguns
.: Suggestions :.

Use per maps plugins.ini files so you can enable this plugin only on maps where there is some water.


.: Notes :.

For water such as de_aztec water, effect will never show, or rarely, because of the water size that is too small.

Posts

  • 8mo
    C A T avatar
    C A T avatar Offline
    Member Joined 2y


    image
    Poop
  • 8mo
    rj. avatar
    rj. PAUSE
    Member Joined 1y
    397 points Ranked 10613rd
    38 medals 4 legendary 10 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
    Posted by C A T

    Fix your images please
    Sorry, I'm just a redistributor of this script. The only way to fix the screenshot is to delete em'. Screenshots actually not required (unneccesary) for scripts submissions, your flag is nonsense. By the way thanks for reporting.
  • 8mo
    Clener74 avatar
    Clener74 avatar Turned off.
    Pyro-Zone Flag Affiliation: Pyro-Zone
    Member Joined 5y
    55,394 points Ranked 65th
    28 medals 6 rare
    • 50 posts awarded Exemplary Feedback Medal icon
    • 100 posts awarded Exemplary Feedback Medal icon
    • 200 posts awarded Exemplary Feedback Medal icon
    • Returned 1000 times Medal icon
    • Reached 50 subscribers Medal icon
    • 8-14 Entries! GameBanana’s Christmas Giveaway 2016 Medal icon
    Clener74 avatar
    Clener74
    Pyro-Zone Flag
    Pyro-Zone
    Bug Journalist
    Posted by C A T

    Fix your images please
    Scripts don't *require* screenshots. As such, it's not a flaggable offense...or an offense in the first place. In this case it just counts as a badly formatted submission which isn't flaggable either.
    • Thanks x 1
    • Correct x 1
    • Informative x 1
    Borderlands 1 for BanExc, pls! avatar
    Mantra
    Borderlands 1 for BanExc, pls!

Share

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

More embeddable images

Bookmark and Share

Credits

Original Authors
ConnorMcLeod
AMXX Codes/Script

Submitter

rj. avatar
rj. PAUSE
Member Joined 1y
397 points Ranked 10613rd
38 medals 4 legendary 10 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
Sign up to access this!
Sign up to access this!
Sign up to access this!
Sign up to access this!

Category

Stats

Posts
3
Views
530
Date Added
8mo
Date Modified
8mo
bcp.crwdcntrl.net tracking pixel