[Script] Weapon-dependant gravity

#1
Numele Script-ului: Weapon-dependant gravity
Versiune: -
Descriere: Gravitatea dependenta de arme
Download:

Cod: Selectaţi tot

#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 }
*/
Autor: Rj
Sursa (Link-ul oficial):
GameBanana
Demo sau Imagini: -
Propria parere: Enjoy!

Înapoi la “Script-uri”

Cine este conectat

Utilizatori răsfoind acest forum: Niciun utilizator înregistrat și 4 vizitatori