Raised This Month: $ Target: $400
 0% 

Jailbreak Gangs


Post New Thread Reply   
 
Thread Tools Display Modes
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 07-03-2014 , 12:28   Re: Jailbreak Gangs
Reply With Quote #11

Yep, that's the one, provided by skatzfz. Didn't notice it's in other language. Post your code, I'll add the feature.
__________________

Last edited by Flick3rR; 07-03-2014 at 12:35.
Flick3rR is offline
Send a message via Skype™ to Flick3rR
terminator18
Member
Join Date: Feb 2013
Location: Athens,Greece
Old 07-03-2014 , 12:33   Re: Jailbreak Gangs
Reply With Quote #12

I will post it as soon as I get home.Thanks for the assistance by the way.
terminator18 is offline
oxygen935
Veteran Member
Join Date: Jun 2012
Location: Athens, Greece
Old 07-03-2014 , 15:44   Re: Jailbreak Gangs
Reply With Quote #13

As u hold gang info on aData array, then just check if the player is joined on a gang. If yes, then get the name info from the array, and make it a prefix. If no, then display [No-Gang] or nothing.
__________________
Quote:
Originally Posted by quark View Post
You're a genius
Stopped any pawn work cause of university for computer science
oxygen935 is offline
Send a message via Skype™ to oxygen935
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 07-03-2014 , 15:49   Re: Jailbreak Gangs
Reply With Quote #14

Тhat's exactly what I did. But atleast this is the Requests section, so the guy probably doesn't know what to do. So I'm currently waiting for him to update the code, so I can add it.
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
terminator18
Member
Join Date: Feb 2013
Location: Athens,Greece
Old 07-03-2014 , 16:30   Re: Jailbreak Gangs
Reply With Quote #15

Here it is.


PHP Code:
    /*
            Jailbreak Gang System
            H3avY Ra1n
    
            Description
            -----------
            This plugin allows prisoners to create gangs and upgrade specific skills that apply to everybody in the gang.
    
    
            Gang Menu
            ---------
            Create a Gang         - Allows a user to create a gang by paying money.
            Invite to Gang         - Only the leader of the gang can invite people to the gang.
            Skills                 - Opens the skills menu, where any member of the gang can pay money to upgrade their skills.
            Top-10                 - Shows a MOTD with the top10 gangs, SORTED BY KILLS. (If you have a good way to sort it, please post it below)
            Leave Gang             - Allows a player to leave the gang. The leader cannot leave the gang until he transfers leadership to somebody else (explained later).
            Gang Leader Menu     - Shows a menu with options to disband the gang, kick a player from the gang, or transfer leadership to somebody else in the gang.
            Online Members         - Shows a list of gang members that are currently in the server.
    
    
            Skills
            ------
            HP - Increased health
            Stealing - Increased money earnings.
            Gravity - Lower Gravity
            Damage - Increased damage
            Stamina - Gives higher speed to players.
            Weapon Drop - Chance of making the guard drop the weapon when you knife them. (%1 chance increase per level)
    
    
            CVARS
            -----
            jb_gang_cost         - The cost to create a gang.
            jb_health_cost         - The cost to upgrade gang health.
            jb_stealing_cost     - The cost to upgrade gang money earning.
            jb_gravity_cost     - The cost to upgrade gang gravity.
            jb_damage_cost         - The cost to upgrade gang damage.
            jb_stamina_cost     - The cost to upgrade gang stamina (speed).
            jb_weapondrop_cost     - The cost to upgrade gang weapon drop percentage.
    
            Additionally there are CVars for the max level for each type of upgrade, so replace _cost above with _max.
            Also there are CVars for the amount per level, so replace _cost above with _per.
            
            jb_points_per_kill    - The amount of points you get for a kill
            jb_headshot_bonus    - The amount of points you get for a headshot
            
            jb_max_members        - The max amount of members a gang can hold
            jb_admin_create        - Whether or not an admin can create gangs without using points
    
            Credits
            -------
            F0RCE     - Original Plugin Idea
            Exolent    - SQLVault Include
            Drekes     - Freezetime Fix (I was too lazy) :)
    
    
            Changelog
            ---------
            September 26, 2011    - v1.0 -     Initial Release
            September 27, 2011    - v1.01 -     Added more cvars, fixed a few bugs.
            September 28, 2011    - v1.1 -     Added gang admins, jb points instead of money, and a few other things I can't remember :)
            January 21, 2011    - v1.1.1 -    Added a cvar for whether an admin can create a gang without using points.
            January 23, 2011    - v1.1.2 -     Fixed freezetime problem
    
    
            http://forums.alliedmods.net/showthread.php?p=1563919
    */

    /* Includes */
        
        #include < amxmodx >
        #include < amxmisc >
        #include < sqlvault_ex >
        #include < cstrike >
        #include < colorchat >
        #include < hamsandwich >
        #include < fun >

    /* Defines */
    
        #define ADMIN_CREATE    ADMIN_LEVEL_B

    /* Constants */
    
        
new const g_szVersion[ ] = "1.1.2";

        
enum _:GangInfo
        
{
            
Trie:GangMembers,
            
GangName64 ],
            
GangHP,
            
GangStealing,
            
GangGravity,
            
GangDamage,
            
GangStamina,
            
GangWeaponDrop,
            
GangKills,
            
NumMembers
        
};
            
        
enum
        
{
            
VALUE_HP,
            
VALUE_STEALING,
            
VALUE_GRAVITY,
            
VALUE_DAMAGE,
            
VALUE_STAMINA,
            
VALUE_WEAPONDROP,
            
VALUE_KILLS
        
}

        
enum
        
{
            
STATUS_NONE,
            
STATUS_MEMBER,
            
STATUS_ADMIN,
            
STATUS_LEADER
        
};

        new const 
g_szGangValues[ ][ ] = 
        {
            
"HP",
            
"Stealing",
            
"Gravity",
            
"Damage",
            
"Stamina",
            
"WeaponDrop",
            
"Kills"
        
};

        new const 
g_szPrefix[ ] = "^04[Acropolis-Gaming]^01";

    
/* Tries */
    
        
new Trie:g_tGangNames;
        new 
Trie:g_tGangValues;

    
/* Vault */
    
        
new SQLVault:g_hVault;
        new 
SQLVault:g_hPointsVault;

    
/* Arrays */
    
        
new Array:g_aGangs;

    
/* Pcvars */
    
        
new g_pCreateCost;

        new 
g_pHealthCost;
        new 
g_pStealingCost;
        new 
g_pGravityCost;
        new 
g_pDamageCost;
        new 
g_pStaminaCost;
        new 
g_pWeaponDropCost;

        new 
g_pHealthMax;
        new 
g_pStealingMax;
        new 
g_pGravityMax;
        new 
g_pDamageMax;
        new 
g_pStaminaMax;
        new 
g_pWeaponDropMax;

        new 
g_pHealthPerLevel;
        new 
g_pStealingPerLevel;
        new 
g_pGravityPerLevel;
        new 
g_pDamagePerLevel;
        new 
g_pStaminaPerLevel;
        new 
g_pWeaponDropPerLevel;

        new 
g_pPointsPerKill;
        new 
g_pHeadshotBonus;

        new 
g_pMaxMembers;
        new 
g_pAdminCreate;

    
/* Integers */
    
        
new g_iGang33 ];
        new 
g_iPoints33 ];
        

    public 
plugin_init()
    {
        
register_plugin"Jailbreak Gang System"g_szVersion"H3avY Ra1n" );
        
        
g_aGangs                 ArrayCreateGangInfo );

        
g_tGangValues             TrieCreate();
        
g_tGangNames             TrieCreate();
        
        
g_hVault                 sqlv_open_local"jb_gangs"false );
        
sqlv_init_exg_hVault );

        
g_hPointsVault            sqlv_open_local"jb_points"true );
        
        
g_pCreateCost            register_cvar"jb_gang_cost",         "50" );
        
g_pHealthCost            register_cvar"jb_health_cost",         "40" );
        
g_pStealingCost         register_cvar"jb_stealing_cost",     "30" );
        
g_pGravityCost            register_cvar"jb_gravity_cost",     "50" );
        
g_pDamageCost            register_cvar"jb_damage_cost",         "50" );
        
g_pStaminaCost            register_cvar"jb_stamina_cost",     "50" );
        
g_pWeaponDropCost        register_cvar"jb_weapondrop_cost",     "50" );

        
g_pHealthMax            register_cvar"jb_health_max",         "5" );
        
g_pStealingMax            register_cvar"jb_stealing_max",     "5" );
        
g_pGravityMax            register_cvar"jb_gravity_max",         "5" ); // Max * Gravity Per Level must be LESS than 800
        
g_pDamageMax            register_cvar"jb_damage_max",         "10" );
        
g_pStaminaMax            register_cvar"jb_stamina_max",         "10" );
        
g_pWeaponDropMax        register_cvar"jb_weapondrop_max",     "10" );

        
g_pHealthPerLevel        register_cvar"jb_health_per",         "10"     );
        
g_pStealingPerLevel        register_cvar"jb_stealing_per",     "0.05"     );
        
g_pGravityPerLevel        register_cvar"jb_gravity_per",         "10"     );
        
g_pDamagePerLevel        register_cvar"jb_damage_per",         "3"     );
        
g_pStaminaPerLevel        register_cvar"jb_stamina_per",         "3"     );
        
g_pWeaponDropPerLevel     register_cvar"jb_weapondrop_per",     "1"     );

        
g_pPointsPerKill        register_cvar"jb_points_per_kill",    "3" );
        
g_pHeadshotBonus        register_cvar"jb_headshot_bonus",    "3" );
        
        
g_pMaxMembers            register_cvar"jb_max_members",        "10" );
        
g_pAdminCreate            register_cvar"jb_admin_create",     "1" ); // Admins can create gangs without points
        
        
register_cvar"jb_gang_version"g_szVersionFCVAR_SPONLY FCVAR_SERVER );
        
        
register_menu"Gang Menu"1023"GangMenu_Handler" );
        
register_menu"Skills Menu"1023"SkillsMenu_Handler" );
        
        for( new 
0sizeof g_szGangValuesi++ )
        {
            
TrieSetCellg_tGangValuesg_szGangValues], );
        }

        
RegisterHamHam_Spawn"player""Ham_PlayerSpawn_Post");
        
RegisterHamHam_TakeDamage"player""Ham_TakeDamage_Pre");
        
RegisterHamHam_TakeDamage"player""Ham_TakeDamage_Post");
        
RegisterHamHam_Item_PreFrame"player""Ham_PlayerResetSpeedPost"1);
        
        
register_event"DeathMsg""Event_DeathMsg""a" );
                
        
register_clcmd"say /gang""Cmd_Gang" );
        
register_clcmd"gang_name""Cmd_CreateGang" );
        
        
LoadGangs();
    }

    public 
client_disconnectid )
    {
        
g_iGangid ] = -1;
        
        new 
szAuthID35 ];
        
get_user_authididszAuthIDcharsmaxszAuthID ) );
        
        
sqlv_set_numg_hPointsVaultszAuthIDg_iPointsid ] );
    }

    public 
client_putinserverid )
    {
        
g_iGangid ] = get_user_gangid );
        new 
szAuthID35 ];
        
get_user_authididszAuthIDcharsmaxszAuthID ) );
        
        
g_iPointsid ] = sqlv_get_numg_hPointsVaultszAuthID );
    }

    public 
plugin_end()
    {
        
SaveGangs();
        
sqlv_closeg_hVault );
    }

    public 
Ham_PlayerSpawn_Postid )
    {
        if( !
is_user_aliveid ) || cs_get_user_teamid ) != CS_TEAM_T )
            return 
HAM_IGNORED;
            
        if( 
g_iGangid ] == -)
        {
            return 
HAM_IGNORED;
        }
            
        new 
aDataGangInfo ];
        
ArrayGetArrayg_aGangsg_iGangid ], aData );
        
        new 
iHealth 100 aDataGangHP ] * get_pcvar_numg_pHealthPerLevel );
        
set_user_healthidiHealth );
        
        new 
iGravity 800 - ( get_pcvar_numg_pGravityPerLevel ) * aDataGangGravity ] );
        
set_user_gravityidfloatiGravity ) / 800.0 );
            
        return 
HAM_IGNORED;
    }

    public 
Ham_TakeDamage_PreiVictimiInflictoriAttackerFloat:flDamageiBits )
    {
        if( !
is_user_aliveiAttacker ) || cs_get_user_teamiAttacker ) != CS_TEAM_T )
            return 
HAM_IGNORED;
            
        if( 
g_iGangiAttacker ] == -)
            return 
HAM_IGNORED;
        
        new 
aDataGangInfo ];
        
ArrayGetArrayg_aGangsg_iGangiAttacker ], aData );
        
        
SetHamParamFloat4flDamage + ( get_pcvar_numg_pDamagePerLevel ) * ( aDataGangDamage ] ) ) );
        
        return 
HAM_IGNORED;
    }

    public 
Ham_TakeDamage_PostiVictimiInflictoriAttackerFloat:flDamageiBits )
    {
        if( !
is_user_aliveiAttacker ) || g_iGangiAttacker ] == -|| get_user_weaponiAttacker ) != CSW_KNIFE || cs_get_user_teamiAttacker ) != CS_TEAM_T  )
        {
            return 
HAM_IGNORED;
        }
        
        new 
aDataGangInfo ];
        
ArrayGetArrayg_aGangsg_iGangiAttacker ], aData );
        
        new 
iChance aDataGangWeaponDrop ] * get_pcvar_numg_pWeaponDropPerLevel );
        
        if( 
iChance == )
            return 
HAM_IGNORED;
        
        new 
bool:bDrop = ( random_num1100 ) <= iChance );
        
        if( 
bDrop )
            
client_cmdiVictim"drop" );
        
        return 
HAM_IGNORED;
    }

    public 
Ham_PlayerResetSpeedPostid )
    {
        if( 
g_iGangid ] == -|| !is_user_aliveid ) || cs_get_user_teamid ) != CS_TEAM_T )
        {
            return 
HAM_IGNORED;
        }
        
        new 
aDataGangInfo ];
        
ArrayGetArrayg_aGangsg_iGangid ], aData );
        
        if( 
aDataGangStamina ] > && get_user_maxspeedid ) > 1.0 )
            
set_user_maxspeedid250.0 + ( aDataGangStamina ] * get_pcvar_numg_pStaminaPerLevel ) ) );
            
        return 
HAM_IGNORED;
    }

    public 
Event_DeathMsg()
    {
        new 
iKiller read_data);
        new 
iVictim read_data);
        
        if( !
is_user_aliveiKiller ) || cs_get_user_teamiVictim ) != CS_TEAM_CT || cs_get_user_teamiKiller ) != CS_TEAM_T )
            return 
PLUGIN_CONTINUE;
        
        new 
iTotal get_pcvar_numg_pPointsPerKill ) + ( bool:read_data) ? get_pcvar_numg_pHeadshotBonus ) : );
        
        if( 
g_iGangiKiller ] > -)
        {
            new 
aDataGangInfo ];
            
ArrayGetArrayg_aGangsg_iGangiKiller ], aData );
            
aDataGangKills ]++;
            
ArraySetArrayg_aGangsg_iGangiKiller ], aData );
            
            
iTotal += iTotal * ( aDataGangStealing ] * get_pcvar_numg_pStealingPerLevel ) );
        }
        
        
g_iPointsiKiller ] += iTotal;
        
        return 
PLUGIN_CONTINUE;
    }

    public 
Cmd_Gangid )
    {    
        if( !
is_user_connectedid ) || cs_get_user_teamid ) != CS_TEAM_T )
        {
            
ColorChatidNORMAL"%s Only ^03prisoners ^01can access this menu."g_szPrefix );
            return 
PLUGIN_HANDLED;
        }
        
        static 
szMenu512 ], iLenaDataGangInfo ], iKeysiStatus;
        
        
iKeys MENU_KEY_0 MENU_KEY_4;
        
        
iStatus getStatusidg_iGangid ] );
        
        if( 
g_iGangid ] > -)
        {
            
ArrayGetArrayg_aGangsg_iGangid ], aData );
            
iLen     =     formatexszMenucharsmaxszMenu ),  "\yGang Menu^n\wCurrent Gang:\y %s^n"aDataGangName ] );
            
iLen    +=    formatexszMenuiLen ], charsmaxszMenu ) - iLen"\yEuros: \w%i^n^n"g_iPointsid ] );
            
iLen    +=    formatexszMenuiLen ], charsmaxszMenu ) - iLen"\r1. \dCreate a Gang [%i Euros]^n"get_pcvar_numg_pCreateCost ) );
        }
        
        else
        {
            
iLen     =     formatexszMenucharsmaxszMenu ),  "\yGang Menu^n\wCurrent Gang:\r None^n" );
            
iLen    +=    formatexszMenuiLen ], charsmaxszMenu ) - iLen"\yEuros: \w%i^n^n"g_iPointsid ] );
            
iLen    +=    formatexszMenuiLen ], charsmaxszMenu ) - iLen"\r1. \wCreate a Gang [%i Euros]^n"get_pcvar_numg_pCreateCost ) );
            
            
iKeys |= MENU_KEY_1;
        }
        
        
        if( 
iStatus STATUS_MEMBER && g_iGangid ] > -&& get_pcvar_numg_pMaxMembers ) > aDataNumMembers ] )
        {
            
iLen    +=    formatexszMenuiLen ], charsmaxszMenu ) - iLen"\r2. \wInvite Player to Gang^n" );
            
iKeys |= MENU_KEY_2;
        }
        else
            
iLen    +=    formatexszMenuiLen ], charsmaxszMenu ) - iLen"\r2. \dInvite Player to Gang^n" );
        
        if( 
g_iGangid ] > -)
        {
            
iLen    +=    formatexszMenuiLen ], charsmaxszMenu ) - iLen"\r3. \wSkills^n" );
            
iKeys |= MENU_KEY_3;
        }
        
        else
            
iLen    +=    formatexszMenuiLen ], charsmaxszMenu ) - iLen"\r3. \dSkills^n" );
            
        
iLen    +=    formatexszMenuiLen ], charsmaxszMenu ) - iLen"\r4. \wTop-10^n" );
        
        if( 
g_iGangid ] > -)
        {
            
iLen    +=    formatexszMenuiLen ], charsmaxszMenu ) - iLen"\r5. \wLeave Gang^n" );
            
iKeys |= MENU_KEY_5;
        }
        
        else
            
iLen    +=    formatexszMenuiLen ], charsmaxszMenu ) - iLen"\r5. \dLeave Gang^n" );
        
        
        if( 
iStatus STATUS_MEMBER )
        {
            
iLen    +=    formatexszMenuiLen ], charsmaxszMenu ) - iLen"\r6. \wGang Admin Menu^n" );
            
iKeys |= MENU_KEY_6;
        }
        
        else
            
iLen    +=    formatexszMenuiLen ], charsmaxszMenu ) - iLen"\r6. \dGang Admin Menu^n" );
        
        if( 
g_iGangid ] > -)
        {
            
iLen    +=    formatexszMenuiLen ], charsmaxszMenu ) - iLen"\r7. \wOnline Members^n" );
            
iKeys |= MENU_KEY_7;
        }
            
        else
            
iLen    +=    formatexszMenuiLen ], charsmaxszMenu ) - iLen"\r7. \dOnline Members^n" );
        
        
iLen    +=    formatexszMenuiLen ], charsmaxszMenu ) - iLen"^n\r0. \wExit" );
        
        
show_menuidiKeysszMenu, -1"Gang Menu" );
        
        return 
PLUGIN_CONTINUE;
    }

    public 
GangMenu_HandleridiKey )
    {
        switch( ( 
iKey ) % 10 )
        {
            case 
0: return PLUGIN_HANDLED;
            
            case 
1
            {
                if( 
get_pcvar_numg_pAdminCreate ) && get_user_flagsid ) & ADMIN_CREATE )
                {
                    
client_cmdid"messagemode gang_name" );
                }
                
                else if( 
g_iPointsid ] < get_pcvar_numg_pCreateCost ) )
                {
                    
ColorChatidNORMAL"%s You do not have enough Euros to create a gang!"g_szPrefix );
                    return 
PLUGIN_HANDLED;
                }
                
                else
                    
client_cmdid"messagemode gang_name" );
            }
            
            case 
2:
            {
                
ShowInviteMenuid );
            }
            
            case 
3:
            {
                
ShowSkillsMenuid );
            }
            
            case 
4:
            {
                
Cmd_Top10id );
            }
            
            case 
5:
            {
                
ShowLeaveConfirmMenuid );
            }
            
            case 
6:
            {
                
ShowLeaderMenuid );
            }
            
            case 
7:
            {
                
ShowMembersMenuid );
            }
        }
        
        return 
PLUGIN_HANDLED;
    }

    public 
Cmd_CreateGangid )
    {
        new 
bool:bAdmin false;
        
        if( 
get_pcvar_numg_pAdminCreate ) && get_user_flagsid ) & ADMIN_CREATE )
        {
            
bAdmin true;
        }
        
        else if( 
g_iPointsid ] < get_pcvar_numg_pCreateCost ) )
        {
            
ColorChatidNORMAL"%s You do not have enough Euros to create a gang."g_szPrefix );
            return 
PLUGIN_HANDLED;
        }
        
        else if( 
g_iGangid ] > -)
        {
            
ColorChatidNORMAL"%s You cannot create a gang if you are already in one!"g_szPrefix );
            return 
PLUGIN_HANDLED;
        }
        
        else if( 
cs_get_user_teamid ) != CS_TEAM_T )
        {
            
ColorChatidNORMAL"%s Only ^03prisoners ^01can create gangs!"g_szPrefix );
            return 
PLUGIN_HANDLED;
        }
        
        new 
szArgs60 ];
        
read_argsszArgscharsmaxszArgs ) );
        
        
remove_quotesszArgs );
        
        if( 
TrieKeyExistsg_tGangNamesszArgs ) )
        {
            
ColorChatidNORMAL"%s That gang with that name already exists."g_szPrefix );
            
Cmd_Gangid );
            return 
PLUGIN_HANDLED;
        }
        
        new 
aDataGangInfo ];
        
        
aDataGangName ]         = szArgs;
        
aDataGangHP ]         = 0;
        
aDataGangStealing ]     = 0;
        
aDataGangGravity ]     = 0;
        
aDataGangStamina ]     = 0;
        
aDataGangWeaponDrop ] = 0;
        
aDataGangDamage ]     = 0;
        
aDataNumMembers ]     = 0;
        
aDataGangMembers ]     = _:TrieCreate();
        
        
ArrayPushArrayg_aGangsaData );
        
        if( !
bAdmin )
            
g_iPointsid ] -= get_pcvar_numg_pCreateCost );
        
        
set_user_gangidArraySizeg_aGangs ) - 1STATUS_LEADER );
        
        
ColorChatidNORMAL"%s You have successfully created gang '^03%s^01'."g_szPrefixszArgs );
        
        return 
PLUGIN_HANDLED;
    }

    public 
ShowInviteMenuid )
    {    
        new 
iPlayers32 ], iNum;
        
get_playersiPlayersiNum );
        
        new 
szInfo], hMenu;
        
hMenu menu_create"Choose a Player to Invite:""InviteMenu_Handler" );
        new 
szName32 ];
        
        for( new 
0iPlayeriNumi++ )
        {
            
iPlayer iPlayers];
            
            
            if( 
iPlayer == id || g_iGangiPlayer ] == g_iGangid ] || cs_get_user_teamiPlayer ) != CS_TEAM_T )
                continue;
                
            
get_user_nameiPlayerszNamecharsmaxszName ) );
            
            
num_to_striPlayerszInfocharsmaxszInfo ) );
            
            
menu_additemhMenuszNameszInfo );
        }
            
        
menu_displayidhMenu);
    }

    public 
InviteMenu_HandleridhMenuiItem )
    {
        if( 
iItem == MENU_EXIT )
        {
            
Cmd_Gangid );
            return 
PLUGIN_HANDLED;
        }
        
        new 
szData], iAccesshCallbackszName32 ];
        
menu_item_getinfohMenuiItemiAccessszData5szName31hCallback );
        
        new 
iPlayer str_to_numszData );

        if( !
is_user_connectediPlayer ) )
            return 
PLUGIN_HANDLED;
            
        
ShowInviteConfirmMenuidiPlayer );

        
ColorChatidNORMAL"%s You have successfully invited %s to join your gang."g_szPrefixszName );
        
        
Cmd_Gangid );
        return 
PLUGIN_HANDLED;
    }

    public 
ShowInviteConfirmMenuidiPlayer )
    {
        new 
szName32 ];
        
get_user_nameidszNamecharsmaxszName ) );
        
        new 
aDataGangInfo ];
        
ArrayGetArrayg_aGangsg_iGangid ], aData );
        
        new 
szMenuTitle128 ];
        
formatexszMenuTitlecharsmaxszMenuTitle ), "%s Invited You to Join    %s"szNameaDataGangName ] );
        new 
hMenu menu_createszMenuTitle"InviteConfirmMenu_Handler" );
        
        new 
szInfo];
        
num_to_strg_iGangid ], szInfo);
        
        
menu_additemhMenu"Accept Invitation"szInfo );
        
menu_additemhMenu"Decline Invitation""-1" );
        
        
menu_displayiPlayerhMenu);    
    }

    public 
InviteConfirmMenu_HandleridhMenuiItem )
    {
        if( 
iItem == MENU_EXIT )
            return 
PLUGIN_HANDLED;
        
        new 
szData], iAccesshCallback;
        
menu_item_getinfohMenuiItemiAccessszData5__hCallback );
        
        new 
iGang str_to_numszData );
        
        if( 
iGang == -)
            return 
PLUGIN_HANDLED;
        
        if( 
getStatusidg_iGangid ] ) == STATUS_LEADER )
        {
            
ColorChatidNORMAL"%s You cannot leave your gang while you are the leader."g_szPrefix );
            return 
PLUGIN_HANDLED;
        }
        
        
set_user_gangidiGang );
        
        new 
aDataGangInfo ];
        
ArrayGetArrayg_aGangsiGangaData );
        
        
ColorChatidNORMAL"%s You have successfully joined the gang ^03%s^01."g_szPrefixaDataGangName ] );
        
        return 
PLUGIN_HANDLED;
    }
        

    public 
ShowSkillsMenuid )
    {    
        static 
szMenu512 ], iLeniKeysaDataGangInfo ];
        
        if( !
iKeys )
        {
            
iKeys MENU_KEY_1 MENU_KEY_2 MENU_KEY_3 MENU_KEY_4 MENU_KEY_5 MENU_KEY_6 MENU_KEY_0;
        }
        
        
ArrayGetArrayg_aGangsg_iGangid ], aData );
        
        
iLen    =    formatexszMenucharsmaxszMenu ), "\ySkills Menu^n^n" );
        
iLen    +=    formatexszMenuiLen ], 511 iLen"\r1. \wHealth Upgrade [\rCost: \y50 Euros\w] \y[Level:%i/%i]^n"aDataGangHP ], get_pcvar_numg_pHealthMax ) );
        
iLen    +=    formatexszMenuiLen ], 511 iLen"\r2. \wStealing Upgrade [\rCost: \y50 Euros\w] \y[Level:%i/%i]^n"aDataGangStealing ], get_pcvar_numg_pStealingMax ) );
        
iLen    +=    formatexszMenuiLen ], 511 iLen"\r3. \wGravity Upgrade [\rCost: \y50 Euros\w] \y[Level:%i/%i]^n"aDataGangGravity ], get_pcvar_numg_pGravityMax ) );
        
iLen    +=    formatexszMenuiLen ], 511 iLen"\r4. \wDamage Upgrade [\rCost: \y50 Euros\w] \y[Level:%i/%i]^n"aDataGangDamage ], get_pcvar_numg_pDamageMax ) );
        
iLen    +=    formatexszMenuiLen ], 511 iLen"\r5. \wWeapon Drop Upgrade [\rCost: \y50 Euros\w] \y[Level:%i/%i]^n"aDataGangWeaponDrop ], get_pcvar_numg_pWeaponDropMax ) );
        
iLen    +=    formatexszMenuiLen ], 511 iLen"\r6. \wSpeed Upgrade [\rCost: \y50 Euros\w] \y[Level:%i/%i]^n"aDataGangStamina ], get_pcvar_numg_pStaminaMax ) );
        
        
iLen    +=    formatexszMenuiLen ], 511 iLen"^n\r0. \wExit" );
        
        
show_menuidiKeysszMenu, -1"Skills Menu" );
    }

    public 
SkillsMenu_HandleridiKey )
    {
        new 
aDataGangInfo ];
        
ArrayGetArrayg_aGangsg_iGangid ], aData );
        
        switch( ( 
iKey ) % 10 )
        {
            case 
0
            {
                
Cmd_Gangid );
                return 
PLUGIN_HANDLED;
            }
            
            case 
1:
            {
                if( 
aDataGangHP ] == 5
                
{
                    
ColorChatidNORMAL"%s Your gang is already at the max level for that skill."g_szPrefix  );
                    
ShowSkillsMenuid );
                    return 
PLUGIN_HANDLED;
                }
                
                new 
iRemaining g_iPointsid ] - 50
                
                
if( iRemaining )
                {
                    
ColorChatidNORMAL"%s You don't have enough Euros for that."g_szPrefix );
                    
ShowSkillsMenuid );
                    return 
PLUGIN_HANDLED;
                }
                
                
aDataGangHP ]++;
                
                
g_iPointsid ] = iRemaining;
            }
            
            case 
2:
            {
                if( 
aDataGangStealing ] == 10
                
{
                    
ColorChatidNORMAL"%s Your gang is already at the max level for that skill."g_szPrefix  );
                    
ShowSkillsMenuid );
                    return 
PLUGIN_HANDLED;
                }
                
                new 
iRemaining g_iPointsid ] - 50
                
                
if( iRemaining )
                {
                    
ColorChatidNORMAL"%s You don't have enough Euros for that."g_szPrefix );
                    
ShowSkillsMenuid );
                    return 
PLUGIN_HANDLED;
                }
                
                
aDataGangStealing ]++;
                
                
g_iPointsid ] = iRemaining;
            }
            
            case 
3:
            {
                if( 
aDataGangGravity ] == 10
                
{
                    
ColorChatidNORMAL"%s Your gang is already at the max level for that skill."g_szPrefix  );
                    
ShowSkillsMenuid );
                    return 
PLUGIN_HANDLED;
                }
                
                new 
iRemaining g_iPointsid ] - 50
                
                
if( iRemaining )
                {
                    
ColorChatidNORMAL"%s You don't have enough Euros for that."g_szPrefix );
                    
ShowSkillsMenuid );
                    return 
PLUGIN_HANDLED;
                }
                
                
aDataGangGravity ]++;
                
                
g_iPointsid ] = iRemaining;
            }
            
            case 
4:
            {
                if( 
aDataGangDamage ] == 5
                
{
                    
ColorChatidNORMAL"%s Your gang is already at the max level for that skill."g_szPrefix  );
                    
ShowSkillsMenuid );
                    return 
PLUGIN_HANDLED;
                }
                
                new 
iRemaining g_iPointsid ] - 50
                
                
if( iRemaining )
                {
                    
ColorChatidNORMAL"%s You don't have enough Euros for that."g_szPrefix );
                    
ShowSkillsMenuid );
                    return 
PLUGIN_HANDLED;
                }
                
                
aDataGangDamage ]++;
                
                
g_iPointsid ] = iRemaining;
            }
            
            case 
5:
            {
                if( 
aDataGangWeaponDrop ] == 5
                
{
                    
ColorChatidNORMAL"%s Your gang is already at the max level for that skill."g_szPrefix  );
                    
ShowSkillsMenuid );
                    return 
PLUGIN_HANDLED;
                }
                
                new 
iRemaining g_iPointsid ] - 50
                
                
if( iRemaining )
                {
                    
ColorChatidNORMAL"%s You don't have enough Euros for that."g_szPrefix );
                    
ShowSkillsMenuid );
                    return 
PLUGIN_HANDLED;
                }
                
                
aDataGangWeaponDrop ]++;
                
                
g_iPointsid ] = iRemaining;
            }
            
            case 
6:
            {
                if( 
aDataGangStamina ] == get_pcvar_numg_pStaminaMax ) )
                {
                    
ColorChatidNORMAL"%s Your gang is already at the max level for that skill."g_szPrefix  );
                    
ShowSkillsMenuid );
                    return 
PLUGIN_HANDLED;
                }
                
                new 
iRemaining g_iPointsid ] - get_pcvar_numg_pStaminaCost );
                
                if( 
iRemaining )
                {
                    
ColorChatidNORMAL"%s You don't have enough Euros for that."g_szPrefix );
                    
ShowSkillsMenuid );
                    return 
PLUGIN_HANDLED;
                }
                
                
aDataGangStamina ]++;
                
                
g_iPointsid ] = iRemaining;
            }
        }
        
        
ArraySetArrayg_aGangsg_iGangid ], aData );
        
        new 
iPlayers32 ], iNumiPlayer;
        new 
szName32 ];
        
get_playersiPlayersiNum );
        
        for( new 
0iNumi++ )
        {
            
iPlayer iPlayers];
            
            if( 
iPlayer == id || g_iGangiPlayer ] != g_iGangid ] )
                continue;
                 
ColorChatiPlayerNORMAL"%s has just upgraded one of your gang's skills."szName );

        }
        
        
ColorChatidNORMAL"%s You have successfully upgraded your gang."g_szPrefix );
        
        
ShowSkillsMenuid );
        
        return 
PLUGIN_HANDLED;
    }
            
        
    public 
Cmd_Top10id )
    {
        new 
iSize ArraySizeg_aGangs );
        
        new 
iOrder100 ][ ];
        
        new 
aDataGangInfo ];
        
        for( new 
0iSizei++ )
        {
            
ArrayGetArrayg_aGangsiaData );
            
            
iOrder][ ] = i;
            
iOrder][ ] = aDataGangKills ];
        }
        
        
SortCustom2DiOrderiSize"Top10_Sort" );
        
        new 
szMessage2048 ];
        
formatexszMessagecharsmaxszMessage ), "<body bgcolor=#000000><font color=#FFB000><pre>" );
        
formatszMessagecharsmaxszMessage ), "%s%2s %-22.22s %7s %4s %10s %9s %9s %11s %8s^n"szMessage"#""Name""Kills""HP""Stealing"
            
"Gravity""Stamina""WeaponDrop""Damage" );
            
        for( new 
0min10iSize ); i++ )
        {
            
ArrayGetArrayg_aGangsiOrder][ ], aData );
            
            
formatszMessagecharsmaxszMessage ), "%s%-2d %22.22s %7d %4d %10d %9d %9d %11d %8d^n"szMessage1aDataGangName ], 
            
aDataGangKills ], aDataGangHP ], aDataGangStealing ], aDataGangGravity ], aDataGangStamina], aDataGangWeaponDrop ], aDataGangDamage ] );
        }
        
        
show_motdidszMessage"Gang Top 10" );
    }

    public 
Top10_Sort( const iElement1[ ], const iElement2[ ], const iArray[ ], szData[], iSize 
    {
        if( 
iElement1] > iElement2] )
            return -
1;
        
        else if( 
iElement1] < iElement2] )
            return 
1;
        
        return 
0;
    }

    public 
ShowLeaveConfirmMenuid )
    {
        new 
hMenu menu_create"Are you sure you want to leave?""LeaveConfirmMenu_Handler" );
        
menu_additemhMenu"Yes, Leave Now""0" );
        
menu_additemhMenu"No, Don't Leave""1" );
        
        
menu_displayidhMenu);
    }

    public 
LeaveConfirmMenu_HandleridhMenuiItem )
    {
        if( 
iItem == MENU_EXIT )
            return 
PLUGIN_HANDLED;
        
        new 
szData], iAccesshCallback;
        
menu_item_getinfohMenuiItemiAccessszData5__hCallback );
        
        switch( 
str_to_numszData ) )
        {
            case 
0
            {
                if( 
getStatusidg_iGangid ] ) == STATUS_LEADER )
                {
                    
ColorChatidNORMAL"%s You must transfer leadership before leaving this gang."g_szPrefix );
                    
Cmd_Gangid );
                    
                    return 
PLUGIN_HANDLED;
                }
                
                
ColorChatidNORMAL"%s You have successfully left your gang."g_szPrefix );
                
set_user_gangid, -);
                
Cmd_Gangid );
            }
            
            case 
1Cmd_Gangid );
        }
        
        return 
PLUGIN_HANDLED;
    }

    public 
ShowLeaderMenuid )
    {
        new 
hMenu menu_create"Gang Leader Menu""LeaderMenu_Handler" );
        
        new 
iStatus getStatusidg_iGangid ] );
        
        if( 
iStatus == STATUS_LEADER )
        {
            
menu_additemhMenu"Disband Gang""0" );
            
menu_additemhMenu"Transfer Leadership""1" );
            
menu_additemhMenu"Add An Admin""4" );
            
menu_additemhMenu"Remove An Admin""5" );
        }
        
        
menu_additemhMenu"Kick From Gang""2" );
        
menu_additemhMenu"Change Gang Name""3" );
        
        
        
menu_displayidhMenu);
    }

    public 
LeaderMenu_HandleridhMenuiItem )
    {
        if( 
iItem == MENU_EXIT )
        {
            
Cmd_Gangid );
            return 
PLUGIN_HANDLED;
        }
        
        new 
iAccesshCallbackszData];
        
menu_item_getinfohMenuiItemiAccessszData5__hCallback );
        
        switch( 
str_to_numszData ) )
        {
            case 
0:
            {
                
ShowDisbandConfirmMenuid );
            }
            
            case 
1:
            {
                
ShowTransferMenuid );
            }
            
            case 
2:
            {
                
ShowKickMenuid );
            }
            
            case 
3:
            {
                
client_cmdid"messagemode New_Name" );
            }
            
            case 
4:
            {
                
ShowAddAdminMenuid );
            }
            
            case 
5:
            {
                
ShowRemoveAdminMenuid );
            }
        }
        
        return 
PLUGIN_HANDLED;
    }

    public 
ShowDisbandConfirmMenuid )
    {
        new 
hMenu menu_create"Are you sure you want to disband the gang?""DisbandConfirmMenu_Handler" );
        
menu_additemhMenu"Yes, Disband Now""0" );
        
menu_additemhMenu"No, Don't Disband""1" );
        
        
menu_displayidhMenu);
    }

    public 
DisbandConfirmMenu_HandleridhMenuiItem )
    {
        if( 
iItem == MENU_EXIT )
            return 
PLUGIN_HANDLED;
        
        new 
szData], iAccesshCallback;
        
menu_item_getinfohMenuiItemiAccessszData5__hCallback );
        
        switch( 
str_to_numszData ) )
        {
            case 
0
            {
                
                
ColorChatidNORMAL"%s You have successfully disbanded your gang."g_szPrefix );
                
                new 
iPlayers32 ], iNum;
                
                
get_playersiPlayersiNum );
                
                new 
iPlayer;
                
                for( new 
0iNumi++ )
                {
                    
iPlayer iPlayers];
                    
                    if( 
iPlayer == id )
                        continue;
                    
                    if( 
g_iGangid ] != g_iGangiPlayer ] )
                        continue;

                    
ColorChatiPlayerNORMAL"%s Your gang has been disband by its leader."g_szPrefix );
                    
set_user_gangiPlayer, -);
                }
                
                new 
iGang g_iGangid ];
                
                
set_user_gangid, -);
                
                
ArrayDeleteItemg_aGangsiGang );

                
Cmd_Gangid );
            }
            
            case 
1Cmd_Gangid );
        }
        
        return 
PLUGIN_HANDLED;
    }

    public 
ShowTransferMenuid )
    {
        new 
iPlayers32 ], iNum;
        
get_playersiPlayersiNum"e""TERRORIST" );
        
        new 
hMenu menu_create"Transfer Leadership to:""TransferMenu_Handler" );
        new 
szName32 ], szData];
        
        for( new 
0iPlayeriNumi++ )
        {
            
iPlayer iPlayers];
            
            if( 
g_iGangiPlayer ] != g_iGangid ] || id == iPlayer )
                continue;
                
            
get_user_nameiPlayerszNamecharsmaxszName ) );
            
num_to_striPlayerszDatacharsmaxszData ) );
            
            
menu_additemhMenuszNameszData );
        }
        
        
menu_displayidhMenu);
    }

    public 
TransferMenu_HandleridhMenuiItem )
    {
        if( 
iItem == MENU_EXIT )
        {
            
ShowLeaderMenuid );
            return 
PLUGIN_HANDLED;
        }
        
        new 
iAccesshCallbackszData], szName32 ];
        
        
menu_item_getinfohMenuiItemiAccessszData5szNamecharsmaxszName ), hCallback );
        
        new 
iPlayer str_to_numszData );
        
        if( !
is_user_connectediPlayer ) )
        {
            
ColorChatidNORMAL"%s That player is no longer connected."g_szPrefix );
            
ShowTransferMenuid );
            return 
PLUGIN_HANDLED;
        }
        
        
set_user_gangiPlayerg_iGangid ], STATUS_LEADER );
        
set_user_gangidg_iGangid ], STATUS_ADMIN );
        
        
Cmd_Gangid );
        
        new 
iPlayers32 ], iNumiTemp;
        
get_playersiPlayersiNum );

        for( new 
0iNumi++ )
        {
            
iTemp iPlayers];
            
            if( 
iTemp == iPlayer )
            {
                
ColorChatiTempNORMAL"%s You are the new leader of your gang."g_szPrefix );
                continue;
            }
            
            else if( 
g_iGangiTemp ] != g_iGangid ] )
                continue;
            
            
ColorChatiTempNORMAL"%s ^03%s^01 is the new leader of your gang."g_szPrefixszName );
        }
        
        return 
PLUGIN_HANDLED;
    }


    public 
ShowKickMenuid )
    {
        new 
iPlayers32 ], iNum;
        
get_playersiPlayersiNum );
        
        new 
hMenu menu_create"Kick Player From Gang:""KickMenu_Handler" );
        new 
szName32 ], szData];
        
        
        for( new 
0iPlayeriNumi++ )
        {
            
iPlayer iPlayers];
            
            if( 
g_iGangiPlayer ] != g_iGangid ] || id == iPlayer )
                continue;
                
            
get_user_nameiPlayerszNamecharsmaxszName ) );
            
num_to_striPlayerszDatacharsmaxszData ) );
            
            
menu_additemhMenuszNameszData );
        }
        
        
menu_displayidhMenu);
    }

    public 
KickMenu_HandleridhMenuiItem )
    {
        if( 
iItem == MENU_EXIT )
        {
            
ShowLeaderMenuid );
            return 
PLUGIN_HANDLED;
        }
        
        new 
iAccesshCallbackszData], szName32 ];
        
        
menu_item_getinfohMenuiItemiAccessszData5szNamecharsmaxszName ), hCallback );
        
        new 
iPlayer str_to_numszData );
        
        if( !
is_user_connectediPlayer ) )
        {
            
ColorChatidNORMAL"%s That player is no longer connected."g_szPrefix );
            
ShowTransferMenuid );
            return 
PLUGIN_HANDLED;
        }
        
        
set_user_gangiPlayer, -);
        
        
Cmd_Gangid );
        
        new 
iPlayers32 ], iNumiTemp;
        
get_playersiPlayersiNum );
        
        for( new 
0iNumi++ )
        {
            
iTemp iPlayers];
            
            if( 
iTemp == iPlayer || g_iGangiTemp ] != g_iGangid ] )
                continue;
            
            
ColorChatiTempNORMAL"%s ^03%s^01 has been kicked from the gang."g_szPrefixszName );
        }
        
        
ColorChatiPlayerNORMAL"%s You have been kicked from your gang."g_szPrefixszName );
        
        return 
PLUGIN_HANDLED;
    }

    public 
ChangeName_Handlerid )
    {
        if( 
g_iGangid ] == -|| getStatusidg_iGangid ] ) == STATUS_MEMBER )
        {
            return;
        }
        
        new 
iGang g_iGangid ];
        
        new 
szArgs64 ];
        
read_argsszArgscharsmaxszArgs ) );
        
        new 
iPlayers32 ], iNum;
        
get_playersiPlayersiNum );
        
        new 
bool:bInGang33 ];
        new 
iStatus33 ];
        
        for( new 
0iPlayeriNumi++ )
        {
            
iPlayer iPlayers];
            
            if( 
g_iGangid ] != g_iGangiPlayer ] )
                continue;
        
            
bInGangiPlayer ] = true;
            
iStatusiPlayer ] = getStatusidiGang );
            
            
set_user_gangiPlayer, -);
        }
        
        new 
aDataGangInfo ];
        
ArrayGetArrayg_aGangsiGangaData );
        
        
aDataGangName ] = szArgs;
        
        
ArraySetArrayg_aGangsiGangaData );
        
        for( new 
0iPlayeriNumi++ )
        {
            
iPlayer iPlayers];
            
            if( !
bInGangiPlayer ] )
                continue;
            
            
set_user_gangiPlayeriGangiStatusid ] );
        }
    }
        
    public 
ShowAddAdminMenuid )
    {
        new 
iPlayers32 ], iNum;
        new 
szName32 ], szData];
        new 
hMenu menu_create"Choose a Player to Promote:""AddAdminMenu_Handler" );
        
        
get_playersiPlayersiNum );
        
        for( new 
0iPlayeriNumi++ )
        {
            
iPlayer iPlayers];
            
            if( 
g_iGangid ] != g_iGangiPlayer ] || getStatusiPlayerg_iGangiPlayer ] ) > STATUS_MEMBER )
                continue;
            
            
get_user_nameiPlayerszNamecharsmaxszName ) );
            
            
num_to_striPlayerszDatacharsmaxszData ) );
            
            
menu_additemhMenuszNameszData );
        }
        
        
menu_displayidhMenu);
    }

    public 
AddAdminMenu_HandleridhMenuiItem )
    {
        if( 
iItem == MENU_EXIT )
        {
            
menu_destroyhMenu );
            
ShowLeaderMenuid );
            return 
PLUGIN_HANDLED;
        }
        
        new 
iAccesshCallbackszData], szName32 ];
        
        
menu_item_getinfohMenuiItemiAccessszDatacharsmaxszData ), szNamecharsmaxszName ), hCallback );
        
        new 
iChosen str_to_numszData );
        
        if( !
is_user_connectediChosen ) )
        {
            
menu_destroyhMenu );
            
ShowLeaderMenuid );
            return 
PLUGIN_HANDLED;
        }
        
        
set_user_gangiChoseng_iGangid ], STATUS_LEADER );
        
        new 
iPlayers32 ], iNum;
        
get_playersiPlayersiNum );
        
        for( new 
0iPlayeriNumi++ )
        {
            
iPlayer iPlayers];
            
            if( 
g_iGangiPlayer ] != g_iGangid ] || iPlayer == iChosen )
                continue;
            
            
ColorChatiPlayerNORMAL"%s ^03%s ^01has been promoted to an admin of your gang."g_szPrefixszName );
        }
        
        
ColorChatiChosenNORMAL"%s ^01You have been promoted to an admin of your gang."g_szPrefix );
        
        
menu_destroyhMenu );
        return 
PLUGIN_HANDLED;
    }

    public 
ShowRemoveAdminMenuid )
    {
        new 
iPlayers32 ], iNum;
        new 
szName32 ], szData];
        new 
hMenu menu_create"Choose a Player to Demote:""RemoveAdminMenu_Handler" );
        
        
get_playersiPlayersiNum );
        
        for( new 
0iPlayeriNumi++ )
        {
            
iPlayer iPlayers];
            
            if( 
g_iGangid ] != g_iGangiPlayer ] || getStatusiPlayerg_iGangiPlayer ] ) != STATUS_ADMIN )
                continue;
            
            
get_user_nameiPlayerszNamecharsmaxszName ) );
            
            
num_to_striPlayerszDatacharsmaxszData ) );
            
            
menu_additemhMenuszNameszData );
        }
        
        
menu_displayidhMenu);
    }

    public 
RemoveAdminMenu_HandleridhMenuiItem )
    {
        if( 
iItem == MENU_EXIT )
        {
            
menu_destroyhMenu );
            
ShowLeaderMenuid );
            return 
PLUGIN_HANDLED;
        }
        
        new 
iAccesshCallbackszData], szName32 ];
        
        
menu_item_getinfohMenuiItemiAccessszDatacharsmaxszData ), szNamecharsmaxszName ), hCallback );
        
        new 
iChosen str_to_numszData );
        
        if( !
is_user_connectediChosen ) )
        {
            
menu_destroyhMenu );
            
ShowLeaderMenuid );
            return 
PLUGIN_HANDLED;
        }
        
        
set_user_gangiChoseng_iGangid ], STATUS_MEMBER );
        
        new 
iPlayers32 ], iNum;
        
get_playersiPlayersiNum );
        
        for( new 
0iPlayeriNumi++ )
        {
            
iPlayer iPlayers];
            
            if( 
g_iGangiPlayer ] != g_iGangid ] || iPlayer == iChosen )
                continue;
            
            
ColorChatiPlayerNORMAL"%s ^03%s ^01has been demoted from being an admin of your gang."g_szPrefixszName );
        }
        
        
ColorChatiChosenNORMAL"%s ^01You have been demoted from being an admin of your gang."g_szPrefix );
        
        
menu_destroyhMenu );
        return 
PLUGIN_HANDLED;
    }
        
    public 
ShowMembersMenuid )
    {
        new 
szName64 ], iPlayers32 ], iNum;
        
get_playersiPlayersiNum );
        
        new 
hMenu menu_create"Online Members:""MemberMenu_Handler" );
        
        for( new 
0iPlayeriNumi++ )
        {
            
iPlayer iPlayers];
            
            if( 
g_iGangid ] != g_iGangiPlayer ] )
                continue;
            
            
get_user_nameiPlayerszNamecharsmaxszName ) );
            
            switch( 
getStatusiPlayerg_iGangid ] ) )
            {
                case 
STATUS_MEMBER:
                {
                    
addszNamecharsmaxszName ), " \r[Member]" );
                }
                
                case 
STATUS_ADMIN:
                {
                    
addszNamecharsmaxszName ), " \r[Admin]" );
                }
                
                case 
STATUS_LEADER:
                {
                    
addszNamecharsmaxszName ), " \r[Leader]" );
                }
            }

            
menu_additemhMenuszName );
        }
        
        
menu_displayidhMenu);
    }

    public 
MemberMenu_HandleridhMenuiItem )
    {
        if( 
iItem == MENU_EXIT )
        {
            
menu_destroyhMenu );
            
Cmd_Gangid );
            return 
PLUGIN_HANDLED;
        }
        
        
menu_destroyhMenu );
        
        
ShowMembersMenuid )
        return 
PLUGIN_HANDLED;
    }

    
// Credits to Tirant from zombie mod and xOR from xRedirect
    
public LoadGangs()
    {
        new 
szConfigsDir60 ];
        
get_configsdirszConfigsDircharsmaxszConfigsDir ) );
        
addszConfigsDircharsmaxszConfigsDir ), "/jb_gangs.ini" );
        
        new 
iFile fopenszConfigsDir"rt" );
        
        new 
aDataGangInfo ];
        
        new 
szBuffer512 ], szData], szValue], iiCurGang;
        
        while( !
feofiFile ) )
        {
            
fgetsiFileszBuffercharsmaxszBuffer ) );
            
            
trimszBuffer );
            
remove_quotesszBuffer );
            
            if( !
szBuffer] || szBuffer] == ';' 
            {
                continue;
            }
            
            if( 
szBuffer] == '[' && szBufferstrlenszBuffer ) - ] == ']' )
            {
                
copyaDataGangName ], strlenszBuffer ) - 2szBuffer] );
                
aDataGangHP ] = 0;
                
aDataGangStealing ] = 0;
                
aDataGangGravity ] = 0;
                
aDataGangStamina ] = 0;
                
aDataGangWeaponDrop ] = 0;
                
aDataGangDamage ] = 0;
                
aDataGangKills ] = 0;
                
aDataNumMembers ] = 0;
                
aDataGangMembers ] = _:TrieCreate();
                
                if( 
TrieKeyExistsg_tGangNamesaDataGangName ] ) )
                {
                    new 
szError256 ];
                    
formatexszErrorcharsmaxszError ), "[JB Gangs] Gang already exists: %s"aDataGangName ] );
                    
set_fail_stateszError );
                }
                
                
ArrayPushArrayg_aGangsaData );
                
                
TrieSetCellg_tGangNamesaDataGangName ], iCurGang );

                
log_amx"Gang Created: %s"aDataGangName ] );
                
                
iCurGang++;
                
                continue;
            }
            
            
strtokszBufferszData31szValue511'=' );
            
trimszData );
            
trimszValue );
            
            if( 
TrieGetCellg_tGangValuesszData) )
            {
                
ArrayGetArrayg_aGangsiCurGang 1aData );
                
                switch( 
)
                {                    
                    case 
VALUE_HP:
                        
aDataGangHP ] = str_to_numszValue );
                    
                    case 
VALUE_STEALING:
                        
aDataGangStealing ] = str_to_numszValue );
                    
                    case 
VALUE_GRAVITY:
                        
aDataGangGravity ] = str_to_numszValue );
                    
                    case 
VALUE_STAMINA:
                        
aDataGangStamina ] = str_to_numszValue );
                    
                    case 
VALUE_WEAPONDROP:
                        
aDataGangWeaponDrop ] = str_to_numszValue );
                        
                    case 
VALUE_DAMAGE:
                        
aDataGangDamage ] = str_to_numszValue );
                    
                    case 
VALUE_KILLS:
                        
aDataGangKills ] = str_to_numszValue );
                }
                
                
ArraySetArrayg_aGangsiCurGang 1aData );
            }
        }
        
        new Array:
aSQL;
        
sqlv_read_all_exg_hVaultaSQL );
        
        new 
aVaultDataSQLVaultEntryEx ];
        
        new 
iGang;
        
        for( 
0ArraySizeaSQL ); i++ )
        {
            
ArrayGetArrayaSQLiaVaultData );
            
            if( 
TrieGetCellg_tGangNamesaVaultDataSQLVEx_Key2 ], iGang ) )
            {
                
ArrayGetArrayg_aGangsiGangaData );
                
                
TrieSetCellaDataGangMembers ], aVaultDataSQLVEx_Key1 ], str_to_numaVaultDataSQLVEx_Data ] ) );
                
                
aDataNumMembers ]++;
                
                
ArraySetArrayg_aGangsiGangaData );
            }
        }
        
        
fcloseiFile );
    }

    public 
SaveGangs()
    {
        new 
szConfigsDir64 ];
        
get_configsdirszConfigsDircharsmaxszConfigsDir ) );
        
        
addszConfigsDircharsmaxszConfigsDir ), "/jb_gangs.ini" );
        
        if( 
file_existsszConfigsDir ) )
            
delete_fileszConfigsDir );
            
        new 
iFile fopenszConfigsDir"wt" );
            
        new 
aDataGangInfo ];
        
        new 
szBuffer256 ];

        for( new 
0ArraySizeg_aGangs ); i++ )
        {
            
ArrayGetArrayg_aGangsiaData );
            
            
formatexszBuffercharsmaxszBuffer ), "[%s]^n"aDataGangName ] );
            
fputsiFileszBuffer );
            
            
formatexszBuffercharsmaxszBuffer ), "HP=%i^n"aDataGangHP ] );
            
fputsiFileszBuffer );
            
            
formatexszBuffercharsmaxszBuffer ), "Stealing=%i^n"aDataGangStealing ] );
            
fputsiFileszBuffer );
            
            
formatexszBuffercharsmaxszBuffer ), "Gravity=%i^n"aDataGangGravity ] );
            
fputsiFileszBuffer );
            
            
formatexszBuffercharsmaxszBuffer ), "Stamina=%i^n"aDataGangStamina ] );
            
fputsiFileszBuffer );
            
            
formatexszBuffercharsmaxszBuffer ), "WeaponDrop=%i^n"aDataGangWeaponDrop ] );
            
fputsiFileszBuffer );
            
            
formatexszBuffercharsmaxszBuffer ), "Damage=%i^n"aDataGangDamage ] );
            
fputsiFileszBuffer );
            
            
formatexszBuffercharsmaxszBuffer ), "Kills=%i^n^n"aDataGangKills ] );
            
fputsiFileszBuffer );
        }
        
        
fcloseiFile );
    }
        
        

    
set_user_gangidiGangiStatus=STATUS_MEMBER )
    {
        new 
szAuthID35 ];
        
get_user_authididszAuthIDcharsmaxszAuthID ) );

        new 
aDataGangInfo ];
        
        if( 
g_iGangid ] > -)
        {
            
ArrayGetArrayg_aGangsg_iGangid ], aData );
            
TrieDeleteKeyaDataGangMembers ], szAuthID );
            
aDataNumMembers ]--;
            
ArraySetArrayg_aGangsg_iGangid ], aData );
            
            
sqlv_remove_exg_hVaultszAuthIDaDataGangName ] );
        }

        if( 
iGang > -)
        {
            
ArrayGetArrayg_aGangsiGangaData );
            
TrieSetCellaDataGangMembers ], szAuthIDiStatus );
            
aDataNumMembers ]++;
            
ArraySetArrayg_aGangsiGangaData );
            
            
sqlv_set_num_exg_hVaultszAuthIDaDataGangName ], iStatus );        
        }

        
g_iGangid ] = iGang;
        
        return 
1;
    }
        
    
get_user_gangid )
    {
        new 
szAuthID35 ];
        
get_user_authididszAuthIDcharsmaxszAuthID ) );
        
        new 
aDataGangInfo ];
        
        for( new 
0ArraySizeg_aGangs ); i++ )
        {
            
ArrayGetArrayg_aGangsiaData );
            
            if( 
TrieKeyExistsaDataGangMembers ], szAuthID ) )
                return 
i;
        }
        
        return -
1;
    }
                
    
getStatusidiGang )
    {
        if( !
is_user_connectedid ) || iGang == -)
            return 
STATUS_NONE;
            
        new 
aDataGangInfo ];
        
ArrayGetArrayg_aGangsiGangaData );
        
        new 
szAuthID35 ];
        
get_user_authididszAuthIDcharsmaxszAuthID ) );
        
        new 
iStatus;
        
TrieGetCellaDataGangMembers ], szAuthIDiStatus );
        
        return 
iStatus;
    } 
terminator18 is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 07-03-2014 , 16:35   Re: Jailbreak Gangs
Reply With Quote #16

Аttach it as a .sma file. Because that indentation here is awful!
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
oxygen935
Veteran Member
Join Date: Jun 2012
Location: Athens, Greece
Old 07-03-2014 , 16:40   Re: Jailbreak Gangs
Reply With Quote #17

Quote:
Originally Posted by Flick3rR View Post
Аttach it as a .sma file. Because that indentation here is awful!
That's the same identation as your plugin. lol xD
__________________
Quote:
Originally Posted by quark View Post
You're a genius
Stopped any pawn work cause of university for computer science
oxygen935 is offline
Send a message via Skype™ to oxygen935
terminator18
Member
Join Date: Feb 2013
Location: Athens,Greece
Old 07-03-2014 , 16:43   Re: Jailbreak Gangs
Reply With Quote #18

Here you go.
Attached Files
File Type: sma Get Plugin or Get Source (jb_gangs.sma - 369 views - 44.1 KB)
terminator18 is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 07-03-2014 , 16:50   Re: Jailbreak Gangs
Reply With Quote #19

Here.
Attached Files
File Type: sma Get Plugin or Get Source (jb_gangs (1).sma - 476 views - 46.1 KB)
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
terminator18
Member
Join Date: Feb 2013
Location: Athens,Greece
Old 07-03-2014 , 16:59   Re: Jailbreak Gangs
Reply With Quote #20

The plugin works,but it shows the chat messages 2 times..
terminator18 is offline
Reply



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 09:52.


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