Counter-Strike 1.6 Icon CS1.6 Script

Weapon-dependant gravity

Attention Gamer! 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

Resistance is futile...

Sign up

Already a Bananite? Login

104 lines | 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#include < amxmodx >
#include < fakemeta >
#include < HamSandwich >
#include < cstrike >

//#define DEBUG
new const Float: gravitation = 9.81

new g_CurrentGrav

new const Float: g_WeaponWeight[] =
{
        0.0,                    //CSW ID starts with 1 for CSW_P228, so we want that to work
        0.825,                  //CSW_P228
        0.0,                    //no idea
        3.300,                  //CSW_SCOUT
        0.180,                  //CSW_HEGRENADE
        4.000,                  //CSW_XM1014
        0.250,                  //CSW_C4
        2.840,                  //CSW_MAC10
        3.600,                  //CSW_AUG
        0.150,                  //CSW_SMOKEGRENADE
        1.150,                  //CSW_ELITE
        0.744,                  //CSW_FIVESEVEN
        2.850,                  //CSW_UMP45
        4.100,                  //CSW_SG550
        4.350,                  //CSW_GALIL
        3.610,                  //CSW_FAMAS
        0.789,                  //CSW_USP
        0.660,                  //CSW_GLOCK18
        7.180,                  //CSW_AWP
        2.850,                  //CSW_MP5NAVY
        9.900,                  //CSW_M249
        3.500,                  //CSW_M3
        3.100,                  //CSW_M4A1
        1.400,                  //CSW_TMP
        5.540,                  //CSW_G3SG1
        0.150,                  //CSW_FLASHBANG
        2.250,                  //CSW_DEAGLE
        3.300,                  //CSW_SG552
        5.210,                  //CSW_AK47
        0.390,                  //CSW_KNIFE
        3.050                   //CSW_P90
}
       
       

public plugin_init()
{
        register_plugin( "Weapon-dependant gravity", "0.1", "Idiotstrike" )
        //register_event( "CurWeapon", "_e_SetGravity", "be", "1=1" )
       
        RegisterHam( Ham_AddPlayerItem, "player", "_e_SetGravity", 1 )
        RegisterHam( Ham_RemovePlayerItem, "player", "_e_SetGravity", 1 )
       
        g_CurrentGrav = get_cvar_pointer( "sv_gravity" )
       
}

public grenade_throw( id, grenade, def )
        if( def == CSW_FLASHBANG && is_user_alive( id ) && pev_valid( grenade ) )
                set_task( 0.1, "Recount", id ) // has to be done as the weapon list is not updated yet 
       
       
public _e_SetGravity( id, item )
        if( is_user_alive( id ) && pev_valid( item ) )
                Recount( id )
       

public Recount( id )
{
       
        static weapons[ 32 ], numWeapons, Float: grav, cache
        get_user_weapons( id, weapons, numWeapons )
       
        cache = cs_get_user_bpammo( id, CSW_FLASHBANG )
       
        if( cache )
                grav = g_WeaponWeight[ CSW_FLASHBANG ] * cache
       
       
        for( new i; i < numWeapons; i++ )
        {
               
                cache = weapons[ i ]
               
                if( cache == CSW_FLASHBANG )
                        continue
                       
                grav += g_WeaponWeight[ cache ]
        }
               
               
       
        set_pev( id, pev_gravity, 1.0 + ( grav * gravitation ) / get_pcvar_float( g_CurrentGrav )  )

        #if defined DEBUG
                client_print( id, print_chat, "wpnum: %d, modifier: %.5f", numWeapons,  grav )
        #endif
}

/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1029\\ f0\\ fs16 \n\\ par }
*/
Weapon-dependant gravity

This is probably the shortest and the most "codeless" plugin ever made. I didn't think it would be THIS easy when I got this idea, but well... it was. It's up to the approvers whether they'll approve these few lines of code or not.

Description
This plugin changes users gravity according to all the weapons they currently hold. The weight of weapons should be realistic, found the values on wikipedia . For example, if the user holds a M249, their gravity would be increased to somewhere around 120%. However, if they hold both Desert Eagle and M249, it will be 130% (just a guess). Tested, works well.

Cvars
None. If you got an idea for a cvar, drop it in this topic.

Changelog

0.1
  • Now counts all weapons in user's inventory
  • More optimized
  • Uses HamSandwich hooks instead of CurWeapon
  • Changed to work with flashbangs as well; other grenades are still counted as 1 though

Counter-Strike only

Posts

None found

Share

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

More embeddable images

Bookmark and Share

Credits

Original Authors
idiotstrike (Backstabnoob)
AMXX Script/Codes

Submitter

Rj. avatar
Rj. Dreamin'
Member Joined 11mo
352 points Ranked 11234th
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

Stats

Posts
0
Views
276
Date Added
1mo