Raised This Month: $ Target: $400
 0% 

[Request] Personal Gravity


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 12-15-2009 , 21:25   Re: [Request] Personal Gravity
Reply With Quote #19

Let me know if this is what you wanted or if it needs adjustments. It is designed to give a special gravity level to a player who possesses *only one* admin flag. If he has more than one, he will not get a special gravity level. There are flags that can be ignored if you choose. This may be useful if, for example, you decide to dedicate only LEVEL_A-LEVEL_H flags for gravity and set all other flags on ignore. This will allow your admins to possess admin power (with multiple flags) and still be able to have a special gravity level. If needed, this can be made entirely configurable by cvar. The gravity levels are in percentages of normal gravity of 800; ie, 0.5 gravity would result in 400 etc. Gravity level adjusments can be made in the g_fGravityLevel[] array. It is ok to adjust the percentage values in the array but do not add\remove items from the array.
PHP Code:
#include <amxmodx>
#include <fakemeta>

new const Floatg_fNormalGravity 1.0;
new const 
Floatg_fGravityLevel23 ] =
{
    
0.10,    //IMMUNITY      "a"
    
0.15,    //RESERVATION   "b"
    
0.25,    //KICK          "c"
    
0.25,    //BAN           "d"
    
0.25,    //SLAY          "e"
    
0.5,     //MAP           "f"
    
1.0,     //CVAR          "g"
    
1.0,     //CFG           "h"
    
0.75,    //CHAT          "i"
    
0.75,    //VOTE          "j"
    
1.0,     //PASSWORD      "k"
    
1.0,     //RCON          "l" 
    
0.25,    //LEVEL A       "m"
    
0.25,    //LEVEL B       "n"
    
0.25,    //LEVEL C       "o"
    
0.25,    //LEVEL D       "p"
    
0.5,     //LEVEL E       "q"
    
0.5,     //LEVEL F       "r"
    
0.5,     //LEVEL G       "s"
    
0.75,    //LEVEL H       "t"
    
0.75,    //LEVEL MENU    "u"
    
0.75,    //LEVEL ADMIN   "y"
    
0.75     //LEVEL USER    "z"
};

/*These are flags that will not be considered as flags when determining 
  gravity. This means a user can have any or all of these ignore flags 
  AND *one* of the above gravity level flags and still be able to get a 
  special gravity level. If a user has more than one gravity level flags 
  he will not get a special gravity level. If you want all flags to be 
  considered then set this to 0. */
const g_IgnoreFlags ADMIN_CVAR ADMIN_CFG ADMIN_PASSWORD ADMIN_RCON ADMIN_MENU ADMIN_ADMIN ADMIN_USER;

public 
plugin_init() 
{
    
register_plugin"Gravity Based on Flags" "0.1" "bugsy" );
}

public 
client_putinserverid )
{
    
set_task7.0 "SetGravity" id );
}

public 
SetGravityid )
{
    new 
FloatfGravity GetGravityLevelid );
    
    if ( 
fGravity != g_fNormalGravity )
    {
        
set_pevid pev_gravity fGravity );
        
client_printid print_chat "* Your gravity has been set to %.2f" GetGravityLevelid ) * 800.0 );
    }
}

public 
FloatGetGravityLevelid )
{
    new 
iFlags get_user_flagsid ) & ~g_IgnoreFlags;
    
    for ( new 
<= 19 i++ )
        if ( ( 
iFlags & ( << ) ) && !( iFlags & ~( << ) ) )
            return 
g_fGravityLevel];
            
    return 
g_fNormalGravity;

__________________

Last edited by Bugsy; 12-16-2009 at 09:20.
Bugsy is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:23.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode