Bullet Pogo

A Config Script for Counter-Strike 1.6

Yo, buddy. 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

Interested?

Sign up

Already a Bananite? Login

164 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
163
164
#include <amxmodx>
#include <fakemeta>
#include <engine>
#include <hamsandwich>
#include <xs>

new const Version[] = "0.1";

new const g_GunEvents[][] =
{
        "events/awp.sc",
        "events/g3sg1.sc",
        "events/ak47.sc",
        "events/scout.sc",
        "events/m249.sc",
        "events/m4a1.sc",
        "events/sg552.sc",
        "events/aug.sc",
        "events/sg550.sc",
        "events/m3.sc",
        "events/xm1014.sc",
        "events/usp.sc",
        "events/mac10.sc",
        "events/ump45.sc",
        "events/fiveseven.sc",
        "events/p90.sc",
        "events/deagle.sc",
        "events/p228.sc",
        "events/glock18.sc",
        "events/mp5n.sc",
        "events/tmp.sc",
        "events/elite_left.sc",
        "events/elite_right.sc",
        "events/galil.sc",
        "events/famas.sc"
};

new g_GunEventBits;
new g_FMPrecacheEvent;
new g_iMaxPlayers;

new g_pStrength;
new g_pFallDamage;
new g_pPogoPlayer;

new g_TouchGroundEnt;
new g_bIsPogo;

#define IsPlayer(%1)    (1<=%1<=g_iMaxPlayers)
#define IsPogo(%1)      (g_bIsPogo & (1<<(%1 & 31)))
#define SetPogo(%1)     (g_bIsPogo |= (1<<(%1 & 31)))
#define RemovePogo(%1)  (g_bIsPogo &= ~(1<<(%1 & 31)))

public plugin_init()
{
        register_plugin( "Bullet Pogo" , Version , "bugsy" );

        g_pStrength = register_cvar( "bp_strength" , "375.0" );
        g_pFallDamage = register_cvar( "bp_falldamage" , "0" );
        g_pPogoPlayer = register_cvar( "bp_pogoplayer" , "0" );
       
        register_forward( FM_CmdStart , "fw_FMCmdStart" , 1 );
        unregister_forward( FM_PrecacheEvent , g_FMPrecacheEvent , 1 );
        register_forward( FM_PlaybackEvent , "fw_FMPlaybackEvent" );
       
        RegisterHam( Ham_TakeDamage , "player" , "fw_HamTakeDamage" );
         
        g_TouchGroundEnt = create_entity( "info_target" );
        entity_set_string( g_TouchGroundEnt , EV_SZ_classname , "touchground_entity" );
        register_think( "touchground_entity" , "fw_Think" );
       
        g_iMaxPlayers = get_maxplayers();
}

public plugin_precache()
{
        g_FMPrecacheEvent = register_forward( FM_PrecacheEvent , "fw_FMPrecacheEvent" , 1 );
}

public fw_FMPrecacheEvent( Type , const szName[] )
{
        for ( new i = 0 ; i < sizeof( g_GunEvents ) ; ++i )
        {
                if ( equal( g_GunEvents[ i ] , szName ) )
                {
                        g_GunEventBits |= ( 1 << get_orig_retval() );
                        return FMRES_HANDLED;
                }
        }

        return FMRES_IGNORED;
}

public fw_FMPlaybackEvent( Flags , Invoker , EventID )
{
        if ( !( g_GunEventBits & ( 1 << EventID ) ) || !IsPlayer( Invoker ) )
                return FMRES_IGNORED;

        static Float:fVelocity[ 3 ];
        static iOrigin[ 3 ] , Float:fOrigin[ 3 ];
        static iAimOrigin[ 3 ] , Float:fAimOrigin[ 3 ];
        static idAiming , iBody;
       
        if ( !get_pcvar_num( g_pPogoPlayer ) )
        {
                get_user_aiming( Invoker , idAiming , iBody );
               
                if ( IsPlayer( idAiming ) )
                        return FMRES_IGNORED;
        }
       
        get_user_origin( Invoker , iOrigin );
        get_user_origin( Invoker , iAimOrigin , 3 );

        IVecFVec( iOrigin , fOrigin );
        IVecFVec( iAimOrigin , fAimOrigin );
       
        if ( -80.0 >= GetAngleOrigins( fOrigin , fAimOrigin ) >= -90.0 )
        {
                pev( Invoker , pev_velocity , fVelocity );
                fVelocity[ 2 ] = get_pcvar_float( g_pStrength );
                set_pev( Invoker , pev_velocity , fVelocity );
               
                SetPogo( Invoker );
               
                entity_set_float( g_TouchGroundEnt , EV_FL_nextthink , get_gametime() + 0.25 );

                return FMRES_IGNORED;
        }
       
        return FMRES_HANDLED;
}

public fw_HamTakeDamage( Victim , Inflictor , Attacker , Float:fDamage , BitDamage )
{
        return ( IsPogo( Victim ) && ( BitDamage & DMG_FALL ) && !get_pcvar_num( g_pFallDamage ) ) ? HAM_SUPERCEDE : HAM_IGNORED;
}

public fw_Think( Entity )
{
        if( Entity != g_TouchGroundEnt )
                return FMRES_IGNORED;
       
        static id;
       
        for ( id = 1 ; id <= g_iMaxPlayers ; id++ )
                if ( IsPogo( id ) && ( ( pev( id , pev_flags ) & FL_ONGROUND ) || !is_user_alive( id ) ) )
                        RemovePogo( id );
                       
        if ( g_bIsPogo )
                entity_set_float( g_TouchGroundEnt , EV_FL_nextthink , get_gametime() + 0.25 );
               
        return FMRES_IGNORED;
}

Float: GetAngleOrigins( const Float:fOrigin1[ 3 ] , const Float:fOrigin2[ 3 ] )
{
        new Float:fVector[ 3 ] , Float:fAngle[ 3 ];
       
        xs_vec_sub( fOrigin2 , fOrigin1 , fVector );
        vector_to_angle( fVector , fAngle );
       
        return ( ( fAngle[ 0 ] > 90.0 ) ? -( 360.0 - fAngle[ 0 ] ) : fAngle[ 0 ] );
}
Bullet Pogo v0.1
.: by Bugsy


Description
This plugin allows players to use their guns as a pogo stick. To use the pogo, aim down at the ground (must be straight down) and shoot your weapon and you will be lifted into the air. There are cvars to control the functionality (see below).

CVars
  • bp_strength <Values: Any float> - (Default: 375.0) 
    Strength of pogo. This sets the upward velocity applied with each pogo.

  • bp_falldamage <Values: 0/1 > - (Default: 0; No fall damage) 
    Enable\Disable fall damage. If a player falls from an elevated position during a pogo this cvar controls whether he will be hurt when landing. The player will still receive damage if he falls from an elevated location while not in a pogo.

  • bp_pogoplayer <Values: 0/1 > - (Default: 0; Cannot pogo off of a player) 
    Enable\Disable allowing a player to pogo off of another player. Example, if you are standing over a player and shoot him, this controls whether it will be just a normal attack or it will be an attack as well as make the player pogo.

Credits
  • VEN - Hooking weapon fire accurately.

Please report any issues and I am open for suggestions\requests.

Posts

Share

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

More embeddable images

Bookmark and Share

Credits

Original Authors
Bugsy
AMXX Script/Codes
VEN
Hooking weapon fire accurately.

Submitter

rj. avatar
rj. PAUSE
Member Joined 1y
307 points Ranked 12924th
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
2
Views
770
Date Added
5mo
bcp.crwdcntrl.net tracking pixel