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 Float: g_fNormalGravity = 1.0;
new const Float: g_fGravityLevel[ 23 ] =
{
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_putinserver( id )
{
set_task( 7.0 , "SetGravity" , id );
}
public SetGravity( id )
{
new Float: fGravity = GetGravityLevel( id );
if ( fGravity != g_fNormalGravity )
{
set_pev( id , pev_gravity , fGravity );
client_print( id , print_chat , "* Your gravity has been set to %.2f" , GetGravityLevel( id ) * 800.0 );
}
}
public Float: GetGravityLevel( id )
{
new iFlags = get_user_flags( id ) & ~g_IgnoreFlags;
for ( new i = 0 ; i <= 19 ; i++ )
if ( ( iFlags & ( 1 << i ) ) && !( iFlags & ~( 1 << i ) ) )
return g_fGravityLevel[ i ];
return g_fNormalGravity;
}
__________________