[rezolvat] Plugin shop

Categoria cu cereri de pluginuri si nu numai.

Moderators: Moderatori ajutatori, Moderatori

Forum rules
Accesează link-ul pentru a putea vedea regulile forumului

Daca doriti sa vi se modifice un plugin, va rugam postati aici .
User avatar
L E V I N
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 2155
Joined: 24 Aug 2011, 11:24
Detinator Steam: Da
CS Status:
Detinator server CS: ☯∴
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Location: ҳ̸Ҳ̸ҳ
Has thanked: 33 times
Been thanked: 349 times
Contact:

30 Oct 2013, 15:29

Am si eu shop-ul facut de Askhanar..vreau ca, atunci cand ia HP si AP sa poata lua pana in 255 HP si pana in 400 AP
.SMA | Afiseaza codul
#include < amxmodx >
#include < cstrike >
#include < fakemeta_util >
#include < hamsandwich >
#include < fun >

#define PLUGIN "FuRieN Credits Shop"
#define VERSION "1.2x"

#define HAS_NVGS		( 1<<0 )
#define USES_NVGS		( 1<<8 )
#define get_user_nvg( %1 )    	( get_pdata_int( %1, m_iNvg ) & HAS_NVGS )
#define SOUND_NVGOFF		"items/nvg_off.wav"

native fcs_get_user_credits( client );

native fcs_set_user_credits( client, credits );

stock fcs_add_user_credits( client, credits )
{
	return fcs_set_user_credits( client, fcs_get_user_credits( client ) + credits );
}

stock fcs_sub_user_credits( client, credits )
{
	return fcs_set_user_credits( client, fcs_get_user_credits( client ) - credits );
}

enum Color
{
	NORMAL = 1,
	GREEN,
	TEAM_COLOR,
	GREY,
	RED,
	BLUE,
}

new TeamName[  ][  ] = 
{
	"",
	"TERRORIST",
	"CT",
	"SPECTATOR"
}

new const g_szTag[ ] = "[ FuRieN Shop ]";

new g_szMenuName[ ] = "\w-- \y== \r| \dFuRieN ShoP \r| \y== \w--";

const m_iNvg = 129;
const m_iLinuxDiff = 5;

enum _:iCvars
{
	ENABLE,

	NADES_PRICE,
	NADES_TO,

	HP_PRICE,
	HP_AMOUNT,
	HP_TO,

	AP_PRICE,
	AP_AMOUNT,
	AP_TO,

	LIFE_PRICE,
	LIFE_TO,

	GOD_PRICE,
	GOD_TO,

	DEFUSE_PRICE,
	DEFUSE_TO,

	SILENT_PRICE,
	SILENT_TO,

	KNIFE_PRICE,
	KNIFE_TO,

	NVG_PRICE,
	NVG_TO
}

enum _:WhatUserHas
{
        GOD,
        SILENT,
        NVG,
        DEFUSE,
        KNIFE,
}

new g_iCvar[ iCvars ];

new bool:g_bUserHas[ 33 ][ WhatUserHas ];

new super_knife[ 66 ] = "models/v_super_cutit4.mdl";
new super_knife2[ 66 ] = "models/p_super_cutit4.mdl";

new gMessageNVG;

public plugin_init( )
{
	register_plugin( PLUGIN, VERSION, "Askhanar" );

	g_iCvar[ ENABLE ] = register_cvar( "fcsshop_enable", "1" );

	g_iCvar[ NADES_PRICE ] = register_cvar( "fcsshop_nades_price", "6" );
	g_iCvar[ NADES_TO ] = register_cvar( "fcsshop_nades_team", "3" );

	g_iCvar[ HP_PRICE ] = register_cvar( "fcsshop_hp_price", "16" );
	g_iCvar[ HP_AMOUNT ] = register_cvar( "fcsshop_hp_amount", "50" );
	g_iCvar[ HP_TO ] = register_cvar( "fcsshop_hp_team", "3" );

	g_iCvar[ AP_PRICE ] = register_cvar( "fcsshop_ap_price", "10" );
	g_iCvar[ AP_AMOUNT ] = register_cvar( "fcsshop_ap_amount", "100" );
	g_iCvar[ AP_TO ] = register_cvar( "fcsshop_ap_team", "3" );

	g_iCvar[ LIFE_PRICE ] = register_cvar( "fcsshop_life_price", "55" );
	g_iCvar[ LIFE_TO ] = register_cvar( "fcsshop_life_team", "3" );

	g_iCvar[ GOD_PRICE ] = register_cvar( "fcsshop_god_price", "26" );
	g_iCvar[ GOD_TO ] = register_cvar( "fcsshop_god_team", "2" );

	g_iCvar[ DEFUSE_PRICE ] = register_cvar( "fcsshop_defuse_price", "21" );
	g_iCvar[ DEFUSE_TO ] = register_cvar( "fcsshop_defuse_team", "2" );

	g_iCvar[ SILENT_PRICE ] = register_cvar( "fcsshop_silent_price", "41" );
	g_iCvar[ SILENT_TO ] = register_cvar( "fcsshop_silent_team", "2" );

	g_iCvar[ KNIFE_PRICE ] = register_cvar( "fcsshop_knife_price", "35" );
	g_iCvar[ KNIFE_TO ] = register_cvar( "fcsshop_knife_team", "1" );

	g_iCvar[ NVG_PRICE ] = register_cvar( "fcsshop_nvg_price", "50" );
	g_iCvar[ NVG_TO ] = register_cvar( "fcsshop_nvg_team", "2" );

	register_clcmd( "say shop", "ClCmdSayShop" );
	register_clcmd( "say_team shop", "ClCmdSayShop" );
	register_clcmd( "say /shop", "ClCmdSayShop" );
	register_clcmd( "say_team /shop", "ClCmdSayShop" );

        gMessageNVG = get_user_msgid( "NVGToggle" );

	RegisterHam( Ham_Spawn, "player", "ham_PlayerSpawnPre", true );
	RegisterHam( Ham_Killed, "player", "ham_PlayerKilledPre", true );
        RegisterHam( Ham_TakeDamage, "player", "Player_TakeDamage" );

        register_event( "CurWeapon", "RefreshWeapon", "be", "1=1" );
}

public RefreshWeapon( id )
{
      new szWeapon = get_user_weapon( id );
      if ( g_bUserHas[ id ][ KNIFE ] && szWeapon == CSW_KNIFE )
      {
         set_pev( id, pev_viewmodel2, super_knife );
         set_pev( id, pev_weaponmodel2, super_knife2 );
      }
}

public plugin_precache( )
{
   precache_model( super_knife );
   precache_model( super_knife2 );
}

public client_putinserver( id )
{
	if( is_user_bot( id ) || is_user_hltv( id ) )
		return;

	g_bUserHas[ id ][ SILENT ] = false;
	g_bUserHas[ id ][ NVG ] = false;
        g_bUserHas[ id ][ DEFUSE ] = false;
        g_bUserHas[ id ][ GOD ] = false;
        g_bUserHas[ id ][ KNIFE ] = false;

        client_cmd( id, "bind c ^"say_team shop By FuRieN.PlayWorld.Ro^"" );
}

public client_disconnect( id )
{
	if( is_user_bot( id ) || is_user_hltv( id ) )
		return;

	g_bUserHas[ id ][ SILENT ] = false;
	g_bUserHas[ id ][ NVG ] = false;
        g_bUserHas[ id ][ DEFUSE ] = false;
	g_bUserHas[ id ][ GOD ] = false;
        g_bUserHas[ id ][ KNIFE ] = false;
}

public ClCmdSayShop( id )
{
	if( get_pcvar_num( g_iCvar[ ENABLE ] ) == 0 )
	{
		ColorChat( id, NORMAL, "^x04%s^x01 Comanda dezactivata de catre server !", g_szTag );
		return PLUGIN_HANDLED;
	}

	if( !is_user_alive( id ) )
	{
		ColorChat( id, NORMAL, "^x04%s^x01 Trebuie sa fii in ^x03viata^x01 pentru a accesa ^x04Shop-ul^x01 !", g_szTag );
		return PLUGIN_HANDLED;
	}
	
	ShopMenu( id );
	return PLUGIN_HANDLED;
}

public ShopMenu( id )
{
	new szMenuName[ 64 ];
	formatex( szMenuName, sizeof ( szMenuName ) -1, "%s^n\rCredite: \d%i", g_szMenuName, fcs_get_user_credits( id ) );
	new iMenu = menu_create( szMenuName, "ShopMenuHandler" );	
	new iCallBack  =  menu_makecallback( "CallBackShop" );

	new szBuffer[ 9 ][ 64 ], szBufferKey[ 8 ], iBufferKey = 1;
	formatex( szBuffer[ 0 ], sizeof ( szBuffer[ ] ) -1, "\r[ \yFuLL\r ] \wGrenazi\y       [\r %iC\y ]", get_pcvar_num( g_iCvar[ NADES_PRICE ] ) );
	formatex( szBuffer[ 1 ], sizeof ( szBuffer[ ] ) -1, "\r[ \y+%i\r ] \wHP\y                [\r %iC\y ]", get_pcvar_num( g_iCvar[ HP_AMOUNT ] ), get_pcvar_num( g_iCvar[ HP_PRICE ] ) )
	formatex( szBuffer[ 2 ], sizeof ( szBuffer[ ] ) -1, "\r[ \y+%i\r ] \wAP\y                [\r %iC\y ]", get_pcvar_num( g_iCvar[ AP_AMOUNT ] ), get_pcvar_num( g_iCvar[ AP_PRICE ] ) )
	formatex( szBuffer[ 3 ], sizeof ( szBuffer[ ] ) -1, "\r[ \yFuLL\r ] \wReinviere\y       [\r %iC\y ]",  get_pcvar_num( g_iCvar[ LIFE_PRICE ] ) );
	formatex( szBuffer[ 4 ], sizeof ( szBuffer[ ] ) -1, "\r[ \y7s\r ] \wGoD MoD\y        [\r %iC\y ]", get_pcvar_num( g_iCvar[ GOD_PRICE ] ) );
	formatex( szBuffer[ 5 ], sizeof ( szBuffer[ ] ) -1, "\r[ \y1R\r ] \wDefuse Kit\y       [\r %iC\y ]", get_pcvar_num( g_iCvar[ DEFUSE_PRICE ] ) );
	formatex( szBuffer[ 6 ], sizeof ( szBuffer[ ] ) -1, "\r[ \y1R\r ] \wSilent Walk\y       [\r %iC\y ]", get_pcvar_num( g_iCvar[ SILENT_PRICE ] ) );
	formatex( szBuffer[ 7 ], sizeof ( szBuffer[ ] ) -1, "\r[ \yBesT\r ] \wSuPeR KniFe\y       [\r %iC\y ]", get_pcvar_num( g_iCvar[ KNIFE_PRICE ] ) );
	formatex( szBuffer[ 8 ], sizeof ( szBuffer[ ] ) -1, "\r[ \y1R\r ] \wNighT ViSioN\y       [\r %iC\y ]", get_pcvar_num( g_iCvar[ NVG_PRICE ] ) );

	for( new i = 0; i < 9; i++ )
	{
		formatex( szBufferKey, sizeof ( szBufferKey ) -1, "%i", iBufferKey );
		menu_additem( iMenu, szBuffer[ i ], szBufferKey, _, iCallBack );

		iBufferKey++;
	}

	menu_setprop( iMenu, MPROP_EXITNAME, "\dIesire" );

	menu_display( id, iMenu, 0 );
}

public ShopMenuHandler( id, iMenu, iItem )
{
	if( iItem == MENU_EXIT )
	{
		menu_destroy( iMenu );
		return 1PLUGIN_HANDLED;
	}

	new data[ 6 ], iName[ 64 ];
	new iaccess, callback;

	menu_item_getinfo( iMenu, iItem, iaccess, data, 5, iName, 63, callback );

	new key = str_to_num( data );

	menu_destroy( iMenu );
	switch( key )
	{
		case 1:
		{
			new iCredits, iNeededCredits;
			iCredits = fcs_get_user_credits( id );
			iNeededCredits = get_pcvar_num( g_iCvar[ NADES_PRICE ] );
		
			if( iCredits < iNeededCredits )
			{
				ColorChat( id, NORMAL, "^x04%s^x01 NU^x01 ai destule credite, iti mai trebuie^x03 %i credite^x01 !", g_szTag, iNeededCredits - iCredits );
				return PLUGIN_HANDLED;
			}

			if( bUserHasAnyNade( id ) )
			{
				ColorChat( id, NORMAL, "^x04%s^x01 Ai cel putin o grenada in mana, nu poti cumpara altele !", g_szTag );
				return PLUGIN_HANDLED;
			}

			fcs_sub_user_credits( id, iNeededCredits );
			ColorChat( id, NORMAL, "^x04%s^x01 Ai cumparat^x03 Pachet de Grenazi^x01 pentru^x04 %i credite^x01 !", g_szTag, iNeededCredits );

			give_item( id, "weapon_hegrenade" );
			give_item( id, "weapon_flashbang" );
			give_item( id, "weapon_flashbang" );
			give_item( id, "weapon_smokegrenade" );
		}

		case 2:
		{
			new iCredits, iNeededCredits;
			iCredits = fcs_get_user_credits( id );
			iNeededCredits = get_pcvar_num( g_iCvar[ HP_PRICE ] );

                        if( get_user_health( id ) >= 255 )
                        {
			    new iHP = get_pcvar_num( g_iCvar[ HP_AMOUNT ] );

			    fcs_sub_user_credits( id, iNeededCredits );

			    set_user_health( id, get_user_health( id ) + iHP );

			    ColorChat( id, NORMAL, "^x04%s^x01 Ai cumparat^x03 + %i HP^x01 pentru^x04 %i credite^x01 !", g_szTag, iHP, iNeededCredits );
                        }

                        else
			if( iCredits < iNeededCredits )
			{
				ColorChat( id, NORMAL, "^x04%s^x01 NU^x01 ai destule credite, iti mai trebuie^x03 %i credite^x01 !", g_szTag, iNeededCredits - iCredits );
				return PLUGIN_HANDLED;
			}
		}

		case 3:
		{
			new iCredits, iNeededCredits;
			iCredits = fcs_get_user_credits( id );
			iNeededCredits = get_pcvar_num( g_iCvar[ AP_PRICE ] );


                        if( get_user_armor( id ) >= 300 )
                        {
			    new iAP = get_pcvar_num( g_iCvar[ AP_AMOUNT ] );

			    fcs_sub_user_credits( id, iNeededCredits );

			    set_user_armor( id, get_user_armor( id ) + iAP );

			    ColorChat( id, NORMAL, "^x04%s^x01 Ai cumparat^x03 + %i AP^x01 pentru^x04 %i credite^x01 !", g_szTag, iAP, iNeededCredits );
                        }

                        else
			if( iCredits < iNeededCredits )
			{
				ColorChat( id, NORMAL, "^x04%s^x01 NU^x01 ai destule credite, iti mai trebuie^x03 %i credite^x01 !", g_szTag, iNeededCredits - iCredits );
				return PLUGIN_HANDLED;
			}
		}

		case 4:
		{
			new iCredits, iNeededCredits;
			iCredits = fcs_get_user_credits( id );
			iNeededCredits = get_pcvar_num( g_iCvar[ LIFE_PRICE ] );

			if( iCredits < iNeededCredits )
			{
				ColorChat( id, NORMAL, "^x04%s^x01 NU^x01 ai destule credite, iti mai trebuie^x03 %i credite^x01 !", g_szTag, iNeededCredits - iCredits );
				return PLUGIN_HANDLED;
			}

                        if( is_user_alive( id ) )
                        {
			       ColorChat( id, NORMAL, "^x04%s^x01 Trebuie sa fi^x03Mort^x01 pentru a te reincarna !", g_szTag );
                        }

                        else
                        if( !is_user_alive( id ) )
                        {
			       fcs_sub_user_credits( id, iNeededCredits );
                               ExecuteHamB( Ham_CS_RoundRespawn, id );
                               strip_user_weapons( id );
                               give_item( id, "weapon_knife" );
			       ColorChat( id, NORMAL, "^x04%s^x01 Ai fost^x03 Reinviat^x01 cu succes pentru^x03 %i credite^x01 !", g_szTag, iNeededCredits );
                        }
		}

		case 5:
		{
			new iCredits, iNeededCredits;
			iCredits = fcs_get_user_credits( id );
			iNeededCredits = get_pcvar_num( g_iCvar[ GOD_PRICE ] );

			if( iCredits < iNeededCredits )
			{
				ColorChat( id, NORMAL, "^x04%s^x01 NU^x01 ai destule credite, iti mai trebuie^x03 %i credite^x01 !", g_szTag, iNeededCredits - iCredits );
				return PLUGIN_HANDLED;
			}

			fcs_sub_user_credits( id, iNeededCredits );

			ColorChat( id, NORMAL, "^x04%s^x01 Ai cumparat^x03 God Mode^x01 pentru^x04 %i credite^x01 !", g_szTag, iNeededCredits );

			g_bUserHas[ id ][ GOD ] = true;
			set_user_godmode( id, 1 );
			set_task ( 7.0, "removegm", id );
		}

		case 6:
		{
			new iCredits, iNeededCredits;
			iCredits = fcs_get_user_credits( id );
			iNeededCredits = get_pcvar_num( g_iCvar[ DEFUSE_PRICE ] );

			if( iCredits < iNeededCredits )
			{
				ColorChat( id, NORMAL, "^x04%s^x01 NU^x01 ai destule credite, iti mai trebuie^x03 %i credite^x01 !", g_szTag, iNeededCredits - iCredits );
				return PLUGIN_HANDLED;
			}

			fcs_sub_user_credits( id, iNeededCredits );

			ColorChat( id, NORMAL, "^x04%s^x01 Ai cumparat^x03 Defuse KIT^x01 pentru^x04 %i credite^x01 !", g_szTag, iNeededCredits );

			fm_give_item ( id, "item_thighpack" );
			g_bUserHas[ id ][ DEFUSE ] = true;
		}

		case 7:
		{
			new iCredits, iNeededCredits;
			iCredits = fcs_get_user_credits( id );
			iNeededCredits = get_pcvar_num( g_iCvar[ SILENT_PRICE ] );

			if( iCredits < iNeededCredits )
			{
				ColorChat( id, NORMAL, "^x04%s^x01 NU^x01 ai destule credite, iti mai trebuie^x03 %i credite^x01 !", g_szTag, iNeededCredits - iCredits );
				return PLUGIN_HANDLED;
			}

			fcs_sub_user_credits( id, iNeededCredits );

			ColorChat( id, NORMAL, "^x04%s^x01 Ai cumparat^x03 Silent Walk ^x01 pentru^x04 %i credite^x01 !", g_szTag, iNeededCredits );

			set_user_footsteps( id, 1 );
			g_bUserHas[ id ][ SILENT ] = true;
		}

		case 8:
		{
			new iCredits, iNeededCredits;
			iCredits = fcs_get_user_credits( id );
			iNeededCredits = get_pcvar_num( g_iCvar[ KNIFE_PRICE ] );

			if( iCredits < iNeededCredits )
			{
				ColorChat( id, NORMAL, "^x04%s^x01 NU^x01 ai destule credite, iti mai trebuie^x03 %i credite^x01 !", g_szTag, iNeededCredits - iCredits );
				return PLUGIN_HANDLED;
			}

			fcs_sub_user_credits( id, iNeededCredits );

			ColorChat( id, NORMAL, "^x04%s^x01 Ai cumparat^x03 Super Knife ^x01pentru^x04 %i credite^x01 !", g_szTag, iNeededCredits );

                        give_item( id, "weapon_knife");
                        set_pev( id, pev_viewmodel2, super_knife );
                        set_pev( id, pev_weaponmodel2, super_knife2 );
                        g_bUserHas[ id ][ KNIFE ] = true;
                        set_task( 0.1, "Player_TakeDamage", id );
		}

		case 9:
		{
			new iCredits, iNeededCredits;
			iCredits = fcs_get_user_credits( id );
			iNeededCredits = get_pcvar_num( g_iCvar[ NVG_PRICE ] );

			if( iCredits < iNeededCredits )
			{
				ColorChat( id, NORMAL, "^x04%s^x01 NU^x01 ai destule credite, iti mai trebuie^x03 %i credite^x01 !", g_szTag, iNeededCredits - iCredits );
				return PLUGIN_HANDLED;
			}

			fcs_sub_user_credits( id, iNeededCredits );

			ColorChat( id, NORMAL, "^x04%s^x01 Ai cumparat^x03 Night Vision ^x01pentru^x04 %i credite^x01 !", g_szTag, iNeededCredits );

                        set_user_nvg( id, 1 );
                        g_bUserHas[ id ][ NVG ] = true;
		}
	}
	
	return PLUGIN_CONTINUE;
}

public removegm( id )
{
    set_user_godmode( id, 0 );
}

public Player_TakeDamage( iVictim, iInflictor, iAttacker, Float:fDamage )
{
	if ( is_user_alive( iAttacker ) && iInflictor == iAttacker && g_bUserHas[ iAttacker ][ KNIFE ] && cs_get_user_team( iAttacker ) == CS_TEAM_T && get_user_weapon ( iAttacker ) == CSW_KNIFE )
        {
		SetHamParamFloat( 4, fDamage * 4.0 );
		return HAM_HANDLED;
	}

	return HAM_IGNORED;
}

public CallBackShop( id, iMenu, iItem )
{
	static _access, szInfo[ 4 ],  callback;
	menu_item_getinfo( iMenu, iItem, _access, szInfo, sizeof ( szInfo ) -1, _, _, callback );
	
	if( szInfo[ 0 ] == '0' )          return ITEM_ENABLED;

 	if( szInfo[ 0 ] == '1' )
	{
		if( get_pcvar_num( g_iCvar[ NADES_TO ] ) == 3 || fcs_get_user_team( id ) == get_pcvar_num( g_iCvar[ NADES_TO ] ) )
			return ITEM_ENABLED;
	}

	else
        if( szInfo[ 0 ] == '2' )
	{
		if( get_pcvar_num( g_iCvar[ HP_TO ] ) == 3 || fcs_get_user_team( id ) == get_pcvar_num( g_iCvar[ HP_TO ] ) )
			return ITEM_ENABLED;
	}

	else
        if( szInfo[ 0 ] == '3' )
	{
		if( get_pcvar_num( g_iCvar[ AP_TO ] ) == 3 || fcs_get_user_team( id ) == get_pcvar_num( g_iCvar[ AP_TO ] ) )
			return ITEM_ENABLED;
	}

	else
        if( szInfo[ 0 ] == '4' )
	{
		if( get_pcvar_num( g_iCvar[ LIFE_TO ] ) == 3 || fcs_get_user_team( id ) == get_pcvar_num( g_iCvar[ LIFE_TO] ) )
			return ITEM_ENABLED;
	}

	else
        if( szInfo[ 0 ] == '5' )
	{
		if( get_pcvar_num( g_iCvar[ GOD_TO ] ) == 3 || fcs_get_user_team( id ) == get_pcvar_num( g_iCvar[ GOD_TO ] ) )
			return ITEM_ENABLED;
	}

	else
        if( szInfo[ 0 ] == '6' )
	{
		if( get_pcvar_num( g_iCvar[ DEFUSE_TO ] ) == 3 || fcs_get_user_team( id ) == get_pcvar_num( g_iCvar[ DEFUSE_TO ] ) )
			return ITEM_ENABLED;
	}

	else
        if( szInfo[ 0 ] == '7' )
	{
		if( get_pcvar_num( g_iCvar[ SILENT_TO ] ) == 3 || fcs_get_user_team( id ) == get_pcvar_num( g_iCvar[ SILENT_TO ] ) )
			return ITEM_ENABLED;
	}

	else
        if( szInfo[ 0 ] == '8' )
	{
		if( get_pcvar_num( g_iCvar[ KNIFE_TO ] ) == 3 || fcs_get_user_team( id ) == get_pcvar_num( g_iCvar[ KNIFE_TO ] ) )
			return ITEM_ENABLED;
	}

	else
        if( szInfo[ 0 ] == '9' )
	{
		if( get_pcvar_num( g_iCvar[ NVG_TO ] ) == 3 || fcs_get_user_team( id ) == get_pcvar_num( g_iCvar[ NVG_TO ] ) )
			return ITEM_ENABLED;
	}

	return ITEM_DISABLED;
}

public ham_PlayerSpawnPre( id )
{
	if( is_user_alive( id ) )
	{
	        set_user_armor( id, 0 );
		set_user_nvg( id, 0 );
		remove_user_nvg( id );
		//remove_task( id );
                g_bUserHas[ id ][ DEFUSE ] = false;
                g_bUserHas[ id ][ GOD ] = false;
                g_bUserHas[ id ][ KNIFE ] = false;
	}
}

public ham_PlayerKilledPre(  id  )
{
        g_bUserHas[ id ][ GOD ] = false;
        g_bUserHas[ id ][ DEFUSE ] = false;
	g_bUserHas[ id ][ SILENT ] = false;
	g_bUserHas[ id ][ NVG ] = false;
        g_bUserHas[ id ][ KNIFE ] = false;
}

stock bool:bUserHasAnyNade( id )
{
	if( user_has_weapon( id, CSW_HEGRENADE ) || user_has_weapon( id, CSW_FLASHBANG ) || user_has_weapon( id, CSW_SMOKEGRENADE ) )
		return true;

	return false;
}

stock fcs_get_user_team( id )
{
	new iTeam = -1;
	if( cs_get_user_team( id ) == CS_TEAM_T )	iTeam = 1;

	else 

        if( cs_get_user_team( id ) == CS_TEAM_CT )	iTeam = 2;

	return iTeam;
}

stock set_user_nvg( id, nvgoggles = 1 )
{
	if( nvgoggles )
	{
		set_pdata_int( id, m_iNvg, get_pdata_int( id, m_iNvg ) | HAS_NVGS );
	}

	else
	{
		set_pdata_int( id, m_iNvg, get_pdata_int( id, m_iNvg ) & ~HAS_NVGS );
	}
}

stock remove_user_nvg( id )
{
	new iNvgs = get_pdata_int( id, m_iNvg, m_iLinuxDiff );

	if( !iNvgs )
	{
		return;
	}

	if( iNvgs & USES_NVGS )
	{
		emit_sound( id, CHAN_ITEM, SOUND_NVGOFF, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );

		emessage_begin( MSG_ONE_UNRELIABLE, gMessageNVG, _, id );
		ewrite_byte( 0 );
		emessage_end();
	}

	set_pdata_int( id, m_iNvg, 0, m_iLinuxDiff );
}  

ColorChat( id, Color:iType, const msg[  ], { Float, Sql, Result, _ }:... )
{
	if( !get_playersnum( ) ) return;

	new szMessage[ 256 ];

	switch( iType )
	{
		case NORMAL:	szMessage[ 0 ] = 0x01;

		case GREEN:	szMessage[ 0 ] = 0x04;

		default: 	szMessage[ 0 ] = 0x03;
	}

	vformat( szMessage[ 1 ], 251, msg, 4 );

	szMessage[ 192 ] = '^0';
	
	new iTeam, iColorChange, iPlayerIndex, MSG_Type;

	if( id )
	{
		MSG_Type  =  MSG_ONE_UNRELIABLE;
		iPlayerIndex  =  id;
	}
	else
	{
		iPlayerIndex  =  CC_FindPlayer( );
		MSG_Type = MSG_ALL;
	}

	iTeam  =  get_user_team( iPlayerIndex );
	iColorChange  =  CC_ColorSelection( iPlayerIndex,  MSG_Type, iType );

	CC_ShowColorMessage( iPlayerIndex, MSG_Type, szMessage  );

	if( iColorChange )	CC_Team_Info( iPlayerIndex, MSG_Type,  TeamName[ iTeam ] );
}

CC_ShowColorMessage( id, const iType, const szMessage[ ] )
{
	static bool:bSayTextUsed;
	static iMsgSayText;

	if( !bSayTextUsed )
	{
		iMsgSayText  =  get_user_msgid( "SayText" );
		bSayTextUsed  =  true;
	}

	message_begin( iType, iMsgSayText, _, id  );
	write_byte(  id  )		
	write_string(  szMessage  );
	message_end(  );
}

CC_Team_Info( id, const iType, const szTeam[ ] )
{
	static bool:bTeamInfoUsed;
	static iMsgTeamInfo;
	if(  !bTeamInfoUsed  )
	{
		iMsgTeamInfo  =  get_user_msgid( "TeamInfo" );
		bTeamInfoUsed  =  true;
	}

	message_begin( iType, iMsgTeamInfo, _, id  );
	write_byte(  id  );
	write_string(  szTeam  );
	message_end(  );

	return 1;
}

CC_ColorSelection( id, const iType, Color:iColorType )
{
	switch( iColorType )
	{
		case RED:	return CC_Team_Info( id, iType, TeamName[ 1 ] );
		case BLUE:	return CC_Team_Info( id, iType, TeamName[ 2 ] );
		case GREY:	return CC_Team_Info( id, iType, TeamName[ 0 ] );
	}

	return 0;
}

CC_FindPlayer( )
{
	new iMaxPlayers  =  get_maxplayers( );
	
	for( new i = 1; i <= iMaxPlayers; i++ )
		if( is_user_connected( i ) )
			return i;
	return -1;
}
Last edited by Ulquiorra on 30 Oct 2013, 22:37, edited 2 times in total.
Reason: acum e prea tarziu.. dar vezi ca aveai slowhack in sursa de mai sus.. si nu inteleg cu ce te ajuta: -> #define PLUGIN "FuRieN Credits Shop" #define VERSION "1.2x" in loc de cele default ?
Nu fac nimic contra cost! Faceți cerere bine detaliată aici, pe forum. Nu-mi mai dați add pe Steam doar pentru a mă avea în lista de prieteni.
Am cont și activez doar aici! Aveți grijă la cei ce încearcă să mă copieze..Puteți lua legătura cu mine dacă aveți o problemă/nelămurire în acest caz.
* Inactiv momentan.
IG-BOOST.org - Instagram Followers Best, Cheap, Reliable
User avatar
Dane5
Membru, skill 0
Membru, skill 0
Posts: 55
Joined: 23 Oct 2013, 17:51
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Has thanked: 8 times
Been thanked: 2 times
Contact:

30 Oct 2013, 15:55

Code: Select all

new Health = get_user_health ( id );
				if ( Health <= 300 ) 
				{
					fm_set_user_health ( id, get_user_health ( id ) + 50 );
					ColorChat( id, GREEN, "^x01[ ^x04 FurienShop^x01 ]^x03 Ai cumparat X HP");
					set_user_credits ( id, iCredits );
					return 1;
				}
				
				if ( Health > 300 ) 
				{
					
					ColorChat ( id, GREEN, "^x01[ ^x04 FurienShop^x01 ]^x03 Nu poti cumpara mai mult de X HP !" );
					return 1;
				}
Ia vezi, te ajuta ?
FuryX.CsOutStanding.Com
Am revenit cu 32 Sloturi :D GO GO GO
User avatar
L E V I N
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 2155
Joined: 24 Aug 2011, 11:24
Detinator Steam: Da
CS Status:
Detinator server CS: ☯∴
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Location: ҳ̸Ҳ̸ҳ
Has thanked: 33 times
Been thanked: 349 times
Contact:

30 Oct 2013, 16:07

Eu vroiam pentru pluginul de mai sus :| , fara mesaj de genu " ColorChat ( id, GREEN, "^x01[ ^x04 FurienShop^x01 ]^x03 Nu poti cumpara mai mult de X HP !" ); " ( o sa incerc si a ta varianta, da mai astept ( falseq ) alti scripteri sa ma ajute )
Nu fac nimic contra cost! Faceți cerere bine detaliată aici, pe forum. Nu-mi mai dați add pe Steam doar pentru a mă avea în lista de prieteni.
Am cont și activez doar aici! Aveți grijă la cei ce încearcă să mă copieze..Puteți lua legătura cu mine dacă aveți o problemă/nelămurire în acest caz.
* Inactiv momentan.
User avatar
Dane5
Membru, skill 0
Membru, skill 0
Posts: 55
Joined: 23 Oct 2013, 17:51
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Has thanked: 8 times
Been thanked: 2 times
Contact:

30 Oct 2013, 16:08

Adryyy wrote:Eu vroiam pentru pluginul de mai sus :| , fara mesaj de genu " ColorChat ( id, GREEN, "^x01[ ^x04 FurienShop^x01 ]^x03 Nu poti cumpara mai mult de X HP !" ); " ( o sa incerc si a ta varianta, da mai astept ( falseq ) alti scripteri sa ma ajute )
Poti scoate mesajul !

Code: Select all

            if ( Health > 300 )
            {
               
               ColorChat ( id, GREEN, "^x01[ ^x04 FurienShop^x01 ]^x03 Nu poti cumpara mai mult de X HP !" );
               return 1;
            }
Scoate asta ^
... Ti`l pun eu in shop ?
FuryX.CsOutStanding.Com
Am revenit cu 32 Sloturi :D GO GO GO
User avatar
Rap^
Membru, skill +2
Membru, skill +2
Posts: 621
Joined: 30 Sep 2011, 23:25
Detinator Steam: Da
Reputatie: Fost Scripter eXtreamCS
Fost Super moderator
Location: Bucuresti
Has thanked: 17 times
Been thanked: 156 times

30 Oct 2013, 16:14

Cauta liniile astea:

Code: Select all

set_user_health( id, get_user_health( id ) + iHP );
set_user_armor( id, get_user_armor( id ) + iAP );
si pune liniile astea in locul lor:

Code: Select all

set_user_health( id, min(255, get_user_health( id ) + iHP) );
set_user_armor( id, min(400, get_user_armor( id ) + iAP) );
Imagination is more important than knowledge.
Knowledge is limited - Imagination encircles the world.
User avatar
L E V I N
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 2155
Joined: 24 Aug 2011, 11:24
Detinator Steam: Da
CS Status:
Detinator server CS: ☯∴
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Location: ҳ̸Ҳ̸ҳ
Has thanked: 33 times
Been thanked: 349 times
Contact:

30 Oct 2013, 16:49

Ms RaP :) si tie dane :|( stiu sa le pun si eu ).. era incurcat cu ale tale returin 1 ;)
Poti rezolva si respawnarea ? sau sa imi zici daca e bine
Nu fac nimic contra cost! Faceți cerere bine detaliată aici, pe forum. Nu-mi mai dați add pe Steam doar pentru a mă avea în lista de prieteni.
Am cont și activez doar aici! Aveți grijă la cei ce încearcă să mă copieze..Puteți lua legătura cu mine dacă aveți o problemă/nelămurire în acest caz.
* Inactiv momentan.
User avatar
Rap^
Membru, skill +2
Membru, skill +2
Posts: 621
Joined: 30 Sep 2011, 23:25
Detinator Steam: Da
Reputatie: Fost Scripter eXtreamCS
Fost Super moderator
Location: Bucuresti
Has thanked: 17 times
Been thanked: 156 times

30 Oct 2013, 17:22

Este bine si respawn-ul doar ca nu ai nevoie de verificarea asta:

Code: Select all

else
if( !is_user_alive( id ) )
In primul rand, structura asta se numeste "else if" si la ea, else-ul si if-ul se pun unul langa altul. Nu este gresit cum ai facut tu, dar asa este numele structurii.
Daca nu e viu, automat e mort. Deci nu ai nevoie de acest else if de mai sus. Sterge-l si adauga in if( is_user_alive(id) ) dupa mesajul acela un return PLUGIN_HANDLED pentru a oprii publicul.

Modifica:

Code: Select all

stock fcs_sub_user_credits( client, credits )
{
	return fcs_set_user_credits( client, fcs_get_user_credits( client ) - credits );
}
in:

Code: Select all

stock fcs_sub_user_credits( client, credits )
{
	return fcs_set_user_credits( client, max( 0, fcs_get_user_credits( client ) - credits ) );
}
deoarece daca tu ai 2 vieti si cumperi ceva ce costa 5 vieti o sa ai -3 vieti.
Imagination is more important than knowledge.
Knowledge is limited - Imagination encircles the world.
User avatar
L E V I N
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 2155
Joined: 24 Aug 2011, 11:24
Detinator Steam: Da
CS Status:
Detinator server CS: ☯∴
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Location: ҳ̸Ҳ̸ҳ
Has thanked: 33 times
Been thanked: 349 times
Contact:

30 Oct 2013, 17:28

Deci cum fac ? :-?? cu else if..

Am asa:

Code: Select all

			if( iCredits < iNeededCredits )
			{
				ColorChat( id, NORMAL, "^x04%s^x01 NU^x01 ai destule credite, iti mai trebuie^x03 %i credite^x01 !", g_szTag, iNeededCredits - iCredits );
				return PLUGIN_HANDLED;
			}

                        if( is_user_alive( id ) )
                        {
			       ColorChat( id, NORMAL, "^x04%s^x01 Trebuie sa fi^x03Mort^x01 pentru a te reincarna !", g_szTag );
                        }

                        else
                        if( !is_user_alive( id ) )
                        {
			       fcs_sub_user_credits( id, iNeededCredits );
                               ExecuteHamB( Ham_CS_RoundRespawn, id );
                               strip_user_weapons( id );
                               give_item( id, "weapon_knife" );
			       ColorChat( id, NORMAL, "^x04%s^x01 Ai fost^x03 Reinviat^x01 cu succes pentru^x03 %i credite^x01 !", g_szTag, iNeededCredits );
                        }
Eu fac asa ?:

Code: Select all


			if( iCredits < iNeededCredits )
			{
				ColorChat( id, NORMAL, "^x04%s^x01 NU^x01 ai destule credite, iti mai trebuie^x03 %i credite^x01 !", g_szTag, iNeededCredits - iCredits );
				return PLUGIN_HANDLED;
			}

                        if( is_user_alive( id ) )
                        {
			       ColorChat( id, NORMAL, "^x04%s^x01 Trebuie sa fi^x03Mort^x01 pentru a te reincarna !", g_szTag );
                        }

                        fcs_sub_user_credits( id, iNeededCredits );
                        ExecuteHamB( Ham_CS_RoundRespawn, id );
                        strip_user_weapons( id );
                        give_item( id, "weapon_knife" );
                        ColorChat( id, NORMAL, "^x04%s^x01 Ai fost^x03 Reinviat^x01 cu succes pentru^x03 %i credite^x01 !", g_szTag, iNeededCredits );

Nu fac nimic contra cost! Faceți cerere bine detaliată aici, pe forum. Nu-mi mai dați add pe Steam doar pentru a mă avea în lista de prieteni.
Am cont și activez doar aici! Aveți grijă la cei ce încearcă să mă copieze..Puteți lua legătura cu mine dacă aveți o problemă/nelămurire în acest caz.
* Inactiv momentan.
User avatar
Rap^
Membru, skill +2
Membru, skill +2
Posts: 621
Joined: 30 Sep 2011, 23:25
Detinator Steam: Da
Reputatie: Fost Scripter eXtreamCS
Fost Super moderator
Location: Bucuresti
Has thanked: 17 times
Been thanked: 156 times

30 Oct 2013, 17:47

Exact, doar ca aici mai adaugi un return PLUGIN_HANDLED;

Code: Select all

if( is_user_alive( id ) )
                        {
                ColorChat( id, NORMAL, "^x04%s^x01 Trebuie sa fi^x03Mort^x01 pentru a te reincarna !", g_szTag );
                        }
->

Code: Select all

if( is_user_alive( id ) )
                        {
                ColorChat( id, NORMAL, "^x04%s^x01 Trebuie sa fi^x03Mort^x01 pentru a te reincarna !", g_szTag );
                return PLUGIN_HANDLED;
                        }
Imagination is more important than knowledge.
Knowledge is limited - Imagination encircles the world.
User avatar
L E V I N
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 2155
Joined: 24 Aug 2011, 11:24
Detinator Steam: Da
CS Status:
Detinator server CS: ☯∴
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Location: ҳ̸Ҳ̸ҳ
Has thanked: 33 times
Been thanked: 349 times
Contact:

30 Oct 2013, 19:30

Rezolvat !
Nu fac nimic contra cost! Faceți cerere bine detaliată aici, pe forum. Nu-mi mai dați add pe Steam doar pentru a mă avea în lista de prieteni.
Am cont și activez doar aici! Aveți grijă la cei ce încearcă să mă copieze..Puteți lua legătura cu mine dacă aveți o problemă/nelămurire în acest caz.
* Inactiv momentan.
User avatar
L E V I N
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 2155
Joined: 24 Aug 2011, 11:24
Detinator Steam: Da
CS Status:
Detinator server CS: ☯∴
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Location: ҳ̸Ҳ̸ҳ
Has thanked: 33 times
Been thanked: 349 times
Contact:

30 Oct 2013, 21:48

TOT NU MERGE :| RAP. Si candi iau ceva de la shop imi ia toate creditele chiar daca am 999999

Uite sursa
| Afiseaza codul
#include < amxmodx >
#include < cstrike >
#include < fakemeta_util >
#include < hamsandwich >
#include < fun >

#define PLUGIN "FuRieN Credits Shop"
#define VERSION "1.2x"

#define HAS_NVGS		( 1<<0 )
#define USES_NVGS		( 1<<8 )
#define get_user_nvg( %1 )    	( get_pdata_int( %1, m_iNvg ) & HAS_NVGS )
#define SOUND_NVGOFF		"items/nvg_off.wav"

native fcs_get_user_credits( client );

native fcs_set_user_credits( client, credits );

stock fcs_add_user_credits( client, credits )
{
	return fcs_set_user_credits( client, fcs_get_user_credits( client ) + credits );
}
/*
stock fcs_sub_user_credits( client, credits )
{
	return fcs_set_user_credits( client, fcs_get_user_credits( client ) - credits );
}
*/
stock fcs_sub_user_credits( client, credits )
{
	return fcs_set_user_credits( client, min( fcs_get_user_credits( client ) - credits, 0 ) );
}

enum Color
{
	NORMAL = 1,
	GREEN,
	TEAM_COLOR,
	GREY,
	RED,
	BLUE,
}

new TeamName[  ][  ] = 
{
	"",
	"TERRORIST",
	"CT",
	"SPECTATOR"
}

new const g_szTag[ ] = "[ FuRieN Shop ]";

new g_szMenuName[ ] = "\w-- \y== \r| \dFuRieN ShoP \r| \y== \w--";

const m_iNvg = 129;
const m_iLinuxDiff = 5;

enum _:iCvars
{
	ENABLE,

	NADES_PRICE,
	NADES_TO,

	HP_PRICE,
	HP_AMOUNT,
	HP_TO,

	AP_PRICE,
	AP_AMOUNT,
	AP_TO,

	LIFE_PRICE,
	LIFE_TO,

	GOD_PRICE,
	GOD_TO,

	DEFUSE_PRICE,
	DEFUSE_TO,

	SILENT_PRICE,
	SILENT_TO,

	KNIFE_PRICE,
	KNIFE_TO,

	NVG_PRICE,
	NVG_TO
}

enum _:WhatUserHas
{
        GOD,
        SILENT,
        NVG,
        DEFUSE,
        KNIFE,
}

new g_iCvar[ iCvars ];

new bool:g_bUserHas[ 33 ][ WhatUserHas ];

new super_knife[ 66 ] = "models/v_super_cutit4.mdl";
new super_knife2[ 66 ] = "models/p_super_cutit4.mdl";

new gMessageNVG;

public plugin_init( )
{
	register_plugin( PLUGIN, VERSION, "Askhanar" );

	g_iCvar[ ENABLE ] = register_cvar( "fcsshop_enable", "1" );

	g_iCvar[ NADES_PRICE ] = register_cvar( "fcsshop_nades_price", "6" );
	g_iCvar[ NADES_TO ] = register_cvar( "fcsshop_nades_team", "3" );

	g_iCvar[ HP_PRICE ] = register_cvar( "fcsshop_hp_price", "16" );
	g_iCvar[ HP_AMOUNT ] = register_cvar( "fcsshop_hp_amount", "50" );
	g_iCvar[ HP_TO ] = register_cvar( "fcsshop_hp_team", "3" );

	g_iCvar[ AP_PRICE ] = register_cvar( "fcsshop_ap_price", "10" );
	g_iCvar[ AP_AMOUNT ] = register_cvar( "fcsshop_ap_amount", "100" );
	g_iCvar[ AP_TO ] = register_cvar( "fcsshop_ap_team", "3" );

	g_iCvar[ LIFE_PRICE ] = register_cvar( "fcsshop_life_price", "55" );
	g_iCvar[ LIFE_TO ] = register_cvar( "fcsshop_life_team", "3" );

	g_iCvar[ GOD_PRICE ] = register_cvar( "fcsshop_god_price", "26" );
	g_iCvar[ GOD_TO ] = register_cvar( "fcsshop_god_team", "2" );

	g_iCvar[ DEFUSE_PRICE ] = register_cvar( "fcsshop_defuse_price", "21" );
	g_iCvar[ DEFUSE_TO ] = register_cvar( "fcsshop_defuse_team", "2" );

	g_iCvar[ SILENT_PRICE ] = register_cvar( "fcsshop_silent_price", "41" );
	g_iCvar[ SILENT_TO ] = register_cvar( "fcsshop_silent_team", "2" );

	g_iCvar[ KNIFE_PRICE ] = register_cvar( "fcsshop_knife_price", "35" );
	g_iCvar[ KNIFE_TO ] = register_cvar( "fcsshop_knife_team", "1" );

	g_iCvar[ NVG_PRICE ] = register_cvar( "fcsshop_nvg_price", "50" );
	g_iCvar[ NVG_TO ] = register_cvar( "fcsshop_nvg_team", "2" );

	register_clcmd( "say shop", "ClCmdSayShop" );
	register_clcmd( "say_team shop", "ClCmdSayShop" );
	register_clcmd( "say /shop", "ClCmdSayShop" );
	register_clcmd( "say_team /shop", "ClCmdSayShop" );

        gMessageNVG = get_user_msgid( "NVGToggle" );

	RegisterHam( Ham_Spawn, "player", "ham_PlayerSpawnPre", true );
	RegisterHam( Ham_Killed, "player", "ham_PlayerKilledPre", true );
        RegisterHam( Ham_TakeDamage, "player", "Player_TakeDamage" );

        register_event( "CurWeapon", "RefreshWeapon", "be", "1=1" );
}

public RefreshWeapon( id )
{
      new szWeapon = get_user_weapon( id );
      if ( g_bUserHas[ id ][ KNIFE ] && szWeapon == CSW_KNIFE )
      {
         set_pev( id, pev_viewmodel2, super_knife );
         set_pev( id, pev_weaponmodel2, super_knife2 );
      }
}

public plugin_precache( )
{
   precache_model( super_knife );
   precache_model( super_knife2 );
}

public client_putinserver( id )
{
	if( is_user_bot( id ) || is_user_hltv( id ) )
		return;

	g_bUserHas[ id ][ SILENT ] = false;
	g_bUserHas[ id ][ NVG ] = false;
        g_bUserHas[ id ][ DEFUSE ] = false;
        g_bUserHas[ id ][ GOD ] = false;
        g_bUserHas[ id ][ KNIFE ] = false;

        client_cmd( id, "bind c ^"say_team shop By FuRieN.PlayWorld.Ro^"" );
}

public client_disconnect( id )
{
	if( is_user_bot( id ) || is_user_hltv( id ) )
		return;

	g_bUserHas[ id ][ SILENT ] = false;
	g_bUserHas[ id ][ NVG ] = false;
        g_bUserHas[ id ][ DEFUSE ] = false;
	g_bUserHas[ id ][ GOD ] = false;
        g_bUserHas[ id ][ KNIFE ] = false;
}

public ClCmdSayShop( id )
{
	if( get_pcvar_num( g_iCvar[ ENABLE ] ) == 0 )
	{
		ColorChat( id, NORMAL, "^x04%s^x01 Comanda dezactivata de catre server !", g_szTag );
		return PLUGIN_HANDLED;
	}

	if( !is_user_alive( id ) )
	{
		ColorChat( id, NORMAL, "^x04%s^x01 Trebuie sa fii in ^x03viata^x01 pentru a accesa ^x04Shop-ul^x01 !", g_szTag );
		return PLUGIN_HANDLED;
	}
	
	ShopMenu( id );
	return PLUGIN_HANDLED;
}

public ShopMenu( id )
{
	new szMenuName[ 64 ];
	formatex( szMenuName, sizeof ( szMenuName ) -1, "%s^n\rCredite: \d%i", g_szMenuName, fcs_get_user_credits( id ) );
	new iMenu = menu_create( szMenuName, "ShopMenuHandler" );	
	new iCallBack  =  menu_makecallback( "CallBackShop" );

	new szBuffer[ 9 ][ 64 ], szBufferKey[ 8 ], iBufferKey = 1;
	formatex( szBuffer[ 0 ], sizeof ( szBuffer[ ] ) -1, "\r[ \yFuLL\r ] \wGrenazi\y       [\r %iC\y ]", get_pcvar_num( g_iCvar[ NADES_PRICE ] ) );
	formatex( szBuffer[ 1 ], sizeof ( szBuffer[ ] ) -1, "\r[ \y+%i\r ] \wHP\y                [\r %iC\y ]", get_pcvar_num( g_iCvar[ HP_AMOUNT ] ), get_pcvar_num( g_iCvar[ HP_PRICE ] ) )
	formatex( szBuffer[ 2 ], sizeof ( szBuffer[ ] ) -1, "\r[ \y+%i\r ] \wAP\y                [\r %iC\y ]", get_pcvar_num( g_iCvar[ AP_AMOUNT ] ), get_pcvar_num( g_iCvar[ AP_PRICE ] ) )
	formatex( szBuffer[ 3 ], sizeof ( szBuffer[ ] ) -1, "\r[ \yFuLL\r ] \wReinviere\y       [\r %iC\y ]",  get_pcvar_num( g_iCvar[ LIFE_PRICE ] ) );
	formatex( szBuffer[ 4 ], sizeof ( szBuffer[ ] ) -1, "\r[ \y7s\r ] \wGoD MoD\y        [\r %iC\y ]", get_pcvar_num( g_iCvar[ GOD_PRICE ] ) );
	formatex( szBuffer[ 5 ], sizeof ( szBuffer[ ] ) -1, "\r[ \y1R\r ] \wDefuse Kit\y       [\r %iC\y ]", get_pcvar_num( g_iCvar[ DEFUSE_PRICE ] ) );
	formatex( szBuffer[ 6 ], sizeof ( szBuffer[ ] ) -1, "\r[ \y1R\r ] \wSilent Walk\y       [\r %iC\y ]", get_pcvar_num( g_iCvar[ SILENT_PRICE ] ) );
	formatex( szBuffer[ 7 ], sizeof ( szBuffer[ ] ) -1, "\r[ \yBesT\r ] \wSuPeR KniFe\y       [\r %iC\y ]", get_pcvar_num( g_iCvar[ KNIFE_PRICE ] ) );
	formatex( szBuffer[ 8 ], sizeof ( szBuffer[ ] ) -1, "\r[ \y1R\r ] \wNighT ViSioN\y       [\r %iC\y ]", get_pcvar_num( g_iCvar[ NVG_PRICE ] ) );

	for( new i = 0; i < 9; i++ )
	{
		formatex( szBufferKey, sizeof ( szBufferKey ) -1, "%i", iBufferKey );
		menu_additem( iMenu, szBuffer[ i ], szBufferKey, _, iCallBack );

		iBufferKey++;
	}

	menu_setprop( iMenu, MPROP_EXITNAME, "\dIesire" );

	menu_display( id, iMenu, 0 );
}

public ShopMenuHandler( id, iMenu, iItem )
{
	if( iItem == MENU_EXIT )
	{
		menu_destroy( iMenu );
		return 1PLUGIN_HANDLED;
	}

	new data[ 6 ], iName[ 64 ];
	new iaccess, callback;

	menu_item_getinfo( iMenu, iItem, iaccess, data, 5, iName, 63, callback );

	new key = str_to_num( data );

	menu_destroy( iMenu );
	switch( key )
	{
		case 1:
		{
			new iCredits, iNeededCredits;
			iCredits = fcs_get_user_credits( id );
			iNeededCredits = get_pcvar_num( g_iCvar[ NADES_PRICE ] );
		
			if( iCredits < iNeededCredits )
			{
				ColorChat( id, NORMAL, "^x04%s^x01 NU^x01 ai destule credite, iti mai trebuie^x03 %i credite^x01 !", g_szTag, iNeededCredits - iCredits );
				return PLUGIN_HANDLED;
			}

			if( bUserHasAnyNade( id ) )
			{
				ColorChat( id, NORMAL, "^x04%s^x01 Ai cel putin o grenada in mana, nu poti cumpara altele !", g_szTag );
				return PLUGIN_HANDLED;
			}

			fcs_sub_user_credits( id, iNeededCredits );
			ColorChat( id, NORMAL, "^x04%s^x01 Ai cumparat^x03 Pachet de Grenazi^x01 pentru^x04 %i credite^x01 !", g_szTag, iNeededCredits );

			give_item( id, "weapon_hegrenade" );
			give_item( id, "weapon_flashbang" );
			give_item( id, "weapon_flashbang" );
			give_item( id, "weapon_smokegrenade" );
		}

		case 2:
		{
			new iCredits, iNeededCredits;
			iCredits = fcs_get_user_credits( id );
			iNeededCredits = get_pcvar_num( g_iCvar[ HP_PRICE ] );

			if( iCredits < iNeededCredits )
			{
				ColorChat( id, NORMAL, "^x04%s^x01 NU^x01 ai destule credite, iti mai trebuie^x03 %i credite^x01 !", g_szTag, iNeededCredits - iCredits );
				return PLUGIN_HANDLED;
			}

			new iHP = get_pcvar_num( g_iCvar[ HP_AMOUNT ] );

			fcs_sub_user_credits( id, iNeededCredits );

			//set_user_health( id, get_user_health( id ) + iHP );
                        set_user_health( id, max( get_user_health( id ) + iHP, 255 ) );

			ColorChat( id, NORMAL, "^x04%s^x01 Ai cumparat^x03 + %i HP^x01 pentru^x04 %i credite^x01 !", g_szTag, iHP, iNeededCredits );
		}

		case 3:
		{
			new iCredits, iNeededCredits;
			iCredits = fcs_get_user_credits( id );
			iNeededCredits = get_pcvar_num( g_iCvar[ AP_PRICE ] );

			if( iCredits < iNeededCredits )
			{
				ColorChat( id, NORMAL, "^x04%s^x01 NU^x01 ai destule credite, iti mai trebuie^x03 %i credite^x01 !", g_szTag, iNeededCredits - iCredits );
				return PLUGIN_HANDLED;
			}

			new iAP = get_pcvar_num( g_iCvar[ AP_AMOUNT ] );

			fcs_sub_user_credits( id, iNeededCredits );

			//set_user_armor( id, get_user_armor( id ) + iAP );
                        set_user_armor( id, max( get_user_armor( id ) + iAP, 400 ) );

			ColorChat( id, NORMAL, "^x04%s^x01 Ai cumparat^x03 + %i AP^x01 pentru^x04 %i credite^x01 !", g_szTag, iAP, iNeededCredits );
		}

		case 4:
		{
			new iCredits, iNeededCredits;
			iCredits = fcs_get_user_credits( id );
			iNeededCredits = get_pcvar_num( g_iCvar[ LIFE_PRICE ] );

			if( iCredits < iNeededCredits )
			{
				ColorChat( id, NORMAL, "^x04%s^x01 NU^x01 ai destule credite, iti mai trebuie^x03 %i credite^x01 !", g_szTag, iNeededCredits - iCredits );
				return PLUGIN_HANDLED;
			}

                        if( is_user_alive( id ) )
                        {
			       ColorChat( id, NORMAL, "^x04%s^x01 Trebuie sa fi^x03Mort^x01 pentru a te reincarna !", g_szTag );
			       return PLUGIN_HANDLED;
                        }

                        fcs_sub_user_credits( id, iNeededCredits );
                        ExecuteHamB( Ham_CS_RoundRespawn, id );
                        strip_user_weapons( id );
                        give_item( id, "weapon_knife" );
                        ColorChat( id, NORMAL, "^x04%s^x01 Ai fost^x03 Reinviat^x01 cu succes pentru^x03 %i credite^x01 !", g_szTag, iNeededCredits );
		}

		case 5:
		{
			new iCredits, iNeededCredits;
			iCredits = fcs_get_user_credits( id );
			iNeededCredits = get_pcvar_num( g_iCvar[ GOD_PRICE ] );

			if( iCredits < iNeededCredits )
			{
				ColorChat( id, NORMAL, "^x04%s^x01 NU^x01 ai destule credite, iti mai trebuie^x03 %i credite^x01 !", g_szTag, iNeededCredits - iCredits );
				return PLUGIN_HANDLED;
			}

			fcs_sub_user_credits( id, iNeededCredits );

			ColorChat( id, NORMAL, "^x04%s^x01 Ai cumparat^x03 God Mode^x01 pentru^x04 %i credite^x01 !", g_szTag, iNeededCredits );

			g_bUserHas[ id ][ GOD ] = true;
			set_user_godmode( id, 1 );
			set_task ( 7.0, "removegm", id );
		}

		case 6:
		{
			new iCredits, iNeededCredits;
			iCredits = fcs_get_user_credits( id );
			iNeededCredits = get_pcvar_num( g_iCvar[ DEFUSE_PRICE ] );

			if( iCredits < iNeededCredits )
			{
				ColorChat( id, NORMAL, "^x04%s^x01 NU^x01 ai destule credite, iti mai trebuie^x03 %i credite^x01 !", g_szTag, iNeededCredits - iCredits );
				return PLUGIN_HANDLED;
			}

			fcs_sub_user_credits( id, iNeededCredits );

			ColorChat( id, NORMAL, "^x04%s^x01 Ai cumparat^x03 Defuse KIT^x01 pentru^x04 %i credite^x01 !", g_szTag, iNeededCredits );

			fm_give_item ( id, "item_thighpack" );
			g_bUserHas[ id ][ DEFUSE ] = true;
		}

		case 7:
		{
			new iCredits, iNeededCredits;
			iCredits = fcs_get_user_credits( id );
			iNeededCredits = get_pcvar_num( g_iCvar[ SILENT_PRICE ] );

			if( iCredits < iNeededCredits )
			{
				ColorChat( id, NORMAL, "^x04%s^x01 NU^x01 ai destule credite, iti mai trebuie^x03 %i credite^x01 !", g_szTag, iNeededCredits - iCredits );
				return PLUGIN_HANDLED;
			}

			fcs_sub_user_credits( id, iNeededCredits );

			ColorChat( id, NORMAL, "^x04%s^x01 Ai cumparat^x03 Silent Walk ^x01 pentru^x04 %i credite^x01 !", g_szTag, iNeededCredits );

			set_user_footsteps( id, 1 );
			g_bUserHas[ id ][ SILENT ] = true;
		}

		case 8:
		{
			new iCredits, iNeededCredits;
			iCredits = fcs_get_user_credits( id );
			iNeededCredits = get_pcvar_num( g_iCvar[ KNIFE_PRICE ] );

			if( iCredits < iNeededCredits )
			{
				ColorChat( id, NORMAL, "^x04%s^x01 NU^x01 ai destule credite, iti mai trebuie^x03 %i credite^x01 !", g_szTag, iNeededCredits - iCredits );
				return PLUGIN_HANDLED;
			}

			fcs_sub_user_credits( id, iNeededCredits );

			ColorChat( id, NORMAL, "^x04%s^x01 Ai cumparat^x03 Super Knife ^x01pentru^x04 %i credite^x01 !", g_szTag, iNeededCredits );

                        give_item( id, "weapon_knife");
                        set_pev( id, pev_viewmodel2, super_knife );
                        set_pev( id, pev_weaponmodel2, super_knife2 );
                        g_bUserHas[ id ][ KNIFE ] = true;
                        set_task( 0.1, "Player_TakeDamage", id );
		}

		case 9:
		{
			new iCredits, iNeededCredits;
			iCredits = fcs_get_user_credits( id );
			iNeededCredits = get_pcvar_num( g_iCvar[ NVG_PRICE ] );

			if( iCredits < iNeededCredits )
			{
				ColorChat( id, NORMAL, "^x04%s^x01 NU^x01 ai destule credite, iti mai trebuie^x03 %i credite^x01 !", g_szTag, iNeededCredits - iCredits );
				return PLUGIN_HANDLED;
			}

			fcs_sub_user_credits( id, iNeededCredits );

			ColorChat( id, NORMAL, "^x04%s^x01 Ai cumparat^x03 Night Vision ^x01pentru^x04 %i credite^x01 !", g_szTag, iNeededCredits );

                        set_user_nvg( id, 1 );
                        g_bUserHas[ id ][ NVG ] = true;
		}
	}
	
	return PLUGIN_CONTINUE;
}

public removegm( id )
{
    set_user_godmode( id, 0 );
}

public Player_TakeDamage( iVictim, iInflictor, iAttacker, Float:fDamage )
{
	if ( is_user_alive( iAttacker ) && iInflictor == iAttacker && g_bUserHas[ iAttacker ][ KNIFE ] && cs_get_user_team( iAttacker ) == CS_TEAM_T && get_user_weapon ( iAttacker ) == CSW_KNIFE )
        {
		SetHamParamFloat( 4, fDamage * 4.0 );
		return HAM_HANDLED;
	}

	return HAM_IGNORED;
}

public CallBackShop( id, iMenu, iItem )
{
	static _access, szInfo[ 4 ],  callback;
	menu_item_getinfo( iMenu, iItem, _access, szInfo, sizeof ( szInfo ) -1, _, _, callback );
	
	//if( szInfo[ 0 ] == '0' )          return ITEM_ENABLED;

 	if( szInfo[ 0 ] == '1' )
	{
		if( get_pcvar_num( g_iCvar[ NADES_TO ] ) == 3 || fcs_get_user_team( id ) == get_pcvar_num( g_iCvar[ NADES_TO ] ) )
			return ITEM_ENABLED;
	}

	else
        if( szInfo[ 0 ] == '2' )
	{
		if( get_pcvar_num( g_iCvar[ HP_TO ] ) == 3 || fcs_get_user_team( id ) == get_pcvar_num( g_iCvar[ HP_TO ] ) )
			return ITEM_ENABLED;
	}

	else
        if( szInfo[ 0 ] == '3' )
	{
		if( get_pcvar_num( g_iCvar[ AP_TO ] ) == 3 || fcs_get_user_team( id ) == get_pcvar_num( g_iCvar[ AP_TO ] ) )
			return ITEM_ENABLED;
	}

	else
        if( szInfo[ 0 ] == '4' )
	{
		if( get_pcvar_num( g_iCvar[ LIFE_TO ] ) == 3 || fcs_get_user_team( id ) == get_pcvar_num( g_iCvar[ LIFE_TO] ) )
			return ITEM_ENABLED;
	}

	else
        if( szInfo[ 0 ] == '5' )
	{
		if( get_pcvar_num( g_iCvar[ GOD_TO ] ) == 3 || fcs_get_user_team( id ) == get_pcvar_num( g_iCvar[ GOD_TO ] ) )
			return ITEM_ENABLED;
	}

	else
        if( szInfo[ 0 ] == '6' )
	{
		if( get_pcvar_num( g_iCvar[ DEFUSE_TO ] ) == 3 || fcs_get_user_team( id ) == get_pcvar_num( g_iCvar[ DEFUSE_TO ] ) )
			return ITEM_ENABLED;
	}

	else
        if( szInfo[ 0 ] == '7' )
	{
		if( get_pcvar_num( g_iCvar[ SILENT_TO ] ) == 3 || fcs_get_user_team( id ) == get_pcvar_num( g_iCvar[ SILENT_TO ] ) )
			return ITEM_ENABLED;
	}

	else
        if( szInfo[ 0 ] == '8' )
	{
		if( get_pcvar_num( g_iCvar[ KNIFE_TO ] ) == 3 || fcs_get_user_team( id ) == get_pcvar_num( g_iCvar[ KNIFE_TO ] ) )
			return ITEM_ENABLED;
	}

	else
        if( szInfo[ 0 ] == '9' )
	{
		if( get_pcvar_num( g_iCvar[ NVG_TO ] ) == 3 || fcs_get_user_team( id ) == get_pcvar_num( g_iCvar[ NVG_TO ] ) )
			return ITEM_ENABLED;
	}

	return ITEM_DISABLED;
}

public ham_PlayerSpawnPre( id )
{
	if( is_user_alive( id ) )
	{
	        set_user_armor( id, 0 );
		set_user_nvg( id, 0 );
		remove_user_nvg( id );
		remove_task( id );
                g_bUserHas[ id ][ DEFUSE ] = false;
                g_bUserHas[ id ][ GOD ] = false;
                g_bUserHas[ id ][ KNIFE ] = false;
	}
}

public ham_PlayerKilledPre(  id  )
{
        g_bUserHas[ id ][ GOD ] = false;
        g_bUserHas[ id ][ DEFUSE ] = false;
	g_bUserHas[ id ][ SILENT ] = false;
	g_bUserHas[ id ][ NVG ] = false;
        g_bUserHas[ id ][ KNIFE ] = false;
}

stock bool:bUserHasAnyNade( id )
{
	if( user_has_weapon( id, CSW_HEGRENADE ) || user_has_weapon( id, CSW_FLASHBANG ) || user_has_weapon( id, CSW_SMOKEGRENADE ) )
		return true;

	return false;
}

stock fcs_get_user_team( id )
{
	new iTeam = -1;
	if( cs_get_user_team( id ) == CS_TEAM_T )	iTeam = 1;

	else 

        if( cs_get_user_team( id ) == CS_TEAM_CT )	iTeam = 2;

	return iTeam;
}

stock set_user_nvg( id, nvgoggles = 1 )
{
	if( nvgoggles )
	{
		set_pdata_int( id, m_iNvg, get_pdata_int( id, m_iNvg ) | HAS_NVGS );
	}

	else
	{
		set_pdata_int( id, m_iNvg, get_pdata_int( id, m_iNvg ) & ~HAS_NVGS );
	}
}

stock remove_user_nvg( id )
{
	new iNvgs = get_pdata_int( id, m_iNvg, m_iLinuxDiff );

	if( !iNvgs )
	{
		return;
	}

	if( iNvgs & USES_NVGS )
	{
		emit_sound( id, CHAN_ITEM, SOUND_NVGOFF, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );

		emessage_begin( MSG_ONE_UNRELIABLE, gMessageNVG, _, id );
		ewrite_byte( 0 );
		emessage_end();
	}

	set_pdata_int( id, m_iNvg, 0, m_iLinuxDiff );
}  

ColorChat( id, Color:iType, const msg[  ], { Float, Sql, Result, _ }:... )
{
	if( !get_playersnum( ) ) return;

	new szMessage[ 256 ];

	switch( iType )
	{
		case NORMAL:	szMessage[ 0 ] = 0x01;

		case GREEN:	szMessage[ 0 ] = 0x04;

		default: 	szMessage[ 0 ] = 0x03;
	}

	vformat( szMessage[ 1 ], 251, msg, 4 );

	szMessage[ 192 ] = '^0';
	
	new iTeam, iColorChange, iPlayerIndex, MSG_Type;

	if( id )
	{
		MSG_Type  =  MSG_ONE_UNRELIABLE;
		iPlayerIndex  =  id;
	}
	else
	{
		iPlayerIndex  =  CC_FindPlayer( );
		MSG_Type = MSG_ALL;
	}

	iTeam  =  get_user_team( iPlayerIndex );
	iColorChange  =  CC_ColorSelection( iPlayerIndex,  MSG_Type, iType );

	CC_ShowColorMessage( iPlayerIndex, MSG_Type, szMessage  );

	if( iColorChange )	CC_Team_Info( iPlayerIndex, MSG_Type,  TeamName[ iTeam ] );
}

CC_ShowColorMessage( id, const iType, const szMessage[ ] )
{
	static bool:bSayTextUsed;
	static iMsgSayText;

	if( !bSayTextUsed )
	{
		iMsgSayText  =  get_user_msgid( "SayText" );
		bSayTextUsed  =  true;
	}

	message_begin( iType, iMsgSayText, _, id  );
	write_byte(  id  )		
	write_string(  szMessage  );
	message_end(  );
}

CC_Team_Info( id, const iType, const szTeam[ ] )
{
	static bool:bTeamInfoUsed;
	static iMsgTeamInfo;
	if(  !bTeamInfoUsed  )
	{
		iMsgTeamInfo  =  get_user_msgid( "TeamInfo" );
		bTeamInfoUsed  =  true;
	}

	message_begin( iType, iMsgTeamInfo, _, id  );
	write_byte(  id  );
	write_string(  szTeam  );
	message_end(  );

	return 1;
}

CC_ColorSelection( id, const iType, Color:iColorType )
{
	switch( iColorType )
	{
		case RED:	return CC_Team_Info( id, iType, TeamName[ 1 ] );
		case BLUE:	return CC_Team_Info( id, iType, TeamName[ 2 ] );
		case GREY:	return CC_Team_Info( id, iType, TeamName[ 0 ] );
	}

	return 0;
}

CC_FindPlayer( )
{
	new iMaxPlayers  =  get_maxplayers( );
	
	for( new i = 1; i <= iMaxPlayers; i++ )
		if( is_user_connected( i ) )
			return i;
	return -1;
}
Nu fac nimic contra cost! Faceți cerere bine detaliată aici, pe forum. Nu-mi mai dați add pe Steam doar pentru a mă avea în lista de prieteni.
Am cont și activez doar aici! Aveți grijă la cei ce încearcă să mă copieze..Puteți lua legătura cu mine dacă aveți o problemă/nelămurire în acest caz.
* Inactiv momentan.
User avatar
Truth*
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 776
Joined: 11 Oct 2013, 10:08
Detinator Steam: Da
SteamID: Ezeru
Reputatie: Moderator ajutator
Membru Club eXtreamCS (4 luni)
Nume anterior: HyperioN.
Scripter eXtreamCS
0.2 / 3
Fond eXtream: 0
Location: Sibiu
Has thanked: 46 times
Been thanked: 123 times
Contact:

30 Oct 2013, 22:07

Incearca :
| Afiseaza codul
#include < amxmodx >
#include < cstrike >
#include < fakemeta_util >
#include < hamsandwich >
#include < fun >

#define PLUGIN "FuRieN Credits Shop"
#define VERSION "1.2x"

#define HAS_NVGS		( 1<<0 )
#define USES_NVGS		( 1<<8 )
#define get_user_nvg( %1 )    	( get_pdata_int( %1, m_iNvg ) & HAS_NVGS )
#define SOUND_NVGOFF		"items/nvg_off.wav"

native fcs_get_user_credits( client );

native fcs_set_user_credits( client, credits );

stock fcs_add_user_credits( client, credits )
{
	return fcs_set_user_credits( client, fcs_get_user_credits( client ) + credits );
}

stock fcs_sub_user_credits( client, credits )
{
	return fcs_set_user_credits( client, fcs_get_user_credits( client ) - credits );
}

enum Color
{
	NORMAL = 1,
	GREEN,
	TEAM_COLOR,
	GREY,
	RED,
	BLUE,
}

new TeamName[  ][  ] = 
{
	"",
	"TERRORIST",
	"CT",
	"SPECTATOR"
}

new const g_szTag[ ] = "[ FuRieN Shop ]";

new g_szMenuName[ ] = "\w-- \y== \r| \dFuRieN ShoP \r| \y== \w--";

const m_iNvg = 129;
const m_iLinuxDiff = 5;

enum _:iCvars
{
	ENABLE,

	NADES_PRICE,
	NADES_TO,

	HP_PRICE,
	HP_AMOUNT,
	HP_TO,

	AP_PRICE,
	AP_AMOUNT,
	AP_TO,

	LIFE_PRICE,
	LIFE_TO,

	GOD_PRICE,
	GOD_TO,

	DEFUSE_PRICE,
	DEFUSE_TO,

	SILENT_PRICE,
	SILENT_TO,

	KNIFE_PRICE,
	KNIFE_TO,

	NVG_PRICE,
	NVG_TO
}

enum _:WhatUserHas
{
        GOD,
        SILENT,
        NVG,
        DEFUSE,
        KNIFE,
}

new g_iCvar[ iCvars ];

new bool:g_bUserHas[ 33 ][ WhatUserHas ];

new super_knife[ 66 ] = "models/v_super_cutit4.mdl";
new super_knife2[ 66 ] = "models/p_super_cutit4.mdl";

new gMessageNVG;

public plugin_init( )
{
	register_plugin( PLUGIN, VERSION, "Askhanar" );

	g_iCvar[ ENABLE ] = register_cvar( "fcsshop_enable", "1" );

	g_iCvar[ NADES_PRICE ] = register_cvar( "fcsshop_nades_price", "6" );
	g_iCvar[ NADES_TO ] = register_cvar( "fcsshop_nades_team", "3" );

	g_iCvar[ HP_PRICE ] = register_cvar( "fcsshop_hp_price", "16" );
	g_iCvar[ HP_AMOUNT ] = register_cvar( "fcsshop_hp_amount", "50" );
	g_iCvar[ HP_TO ] = register_cvar( "fcsshop_hp_team", "3" );

	g_iCvar[ AP_PRICE ] = register_cvar( "fcsshop_ap_price", "10" );
	g_iCvar[ AP_AMOUNT ] = register_cvar( "fcsshop_ap_amount", "100" );
	g_iCvar[ AP_TO ] = register_cvar( "fcsshop_ap_team", "3" );

	g_iCvar[ LIFE_PRICE ] = register_cvar( "fcsshop_life_price", "55" );
	g_iCvar[ LIFE_TO ] = register_cvar( "fcsshop_life_team", "3" );

	g_iCvar[ GOD_PRICE ] = register_cvar( "fcsshop_god_price", "26" );
	g_iCvar[ GOD_TO ] = register_cvar( "fcsshop_god_team", "2" );

	g_iCvar[ DEFUSE_PRICE ] = register_cvar( "fcsshop_defuse_price", "21" );
	g_iCvar[ DEFUSE_TO ] = register_cvar( "fcsshop_defuse_team", "2" );

	g_iCvar[ SILENT_PRICE ] = register_cvar( "fcsshop_silent_price", "41" );
	g_iCvar[ SILENT_TO ] = register_cvar( "fcsshop_silent_team", "2" );

	g_iCvar[ KNIFE_PRICE ] = register_cvar( "fcsshop_knife_price", "35" );
	g_iCvar[ KNIFE_TO ] = register_cvar( "fcsshop_knife_team", "1" );

	g_iCvar[ NVG_PRICE ] = register_cvar( "fcsshop_nvg_price", "50" );
	g_iCvar[ NVG_TO ] = register_cvar( "fcsshop_nvg_team", "2" );

	register_clcmd( "say shop", "ClCmdSayShop" );
	register_clcmd( "say_team shop", "ClCmdSayShop" );
	register_clcmd( "say /shop", "ClCmdSayShop" );
	register_clcmd( "say_team /shop", "ClCmdSayShop" );

        gMessageNVG = get_user_msgid( "NVGToggle" );

	RegisterHam( Ham_Spawn, "player", "ham_PlayerSpawnPre", true );
	RegisterHam( Ham_Killed, "player", "ham_PlayerKilledPre", true );
        RegisterHam( Ham_TakeDamage, "player", "Player_TakeDamage" );

        register_event( "CurWeapon", "RefreshWeapon", "be", "1=1" );
}

public RefreshWeapon( id )
{
      new szWeapon = get_user_weapon( id );
      if ( g_bUserHas[ id ][ KNIFE ] && szWeapon == CSW_KNIFE )
      {
         set_pev( id, pev_viewmodel2, super_knife );
         set_pev( id, pev_weaponmodel2, super_knife2 );
      }
}

public plugin_precache( )
{
   precache_model( super_knife );
   precache_model( super_knife2 );
}

public client_putinserver( id )
{
	if( is_user_bot( id ) || is_user_hltv( id ) )
		return;

	g_bUserHas[ id ][ SILENT ] = false;
	g_bUserHas[ id ][ NVG ] = false;
        g_bUserHas[ id ][ DEFUSE ] = false;
        g_bUserHas[ id ][ GOD ] = false;
        g_bUserHas[ id ][ KNIFE ] = false;

        client_cmd( id, "bind c ^"say_team shop By FuRieN.PlayWorld.Ro^"" );
}

public client_disconnect( id )
{
	if( is_user_bot( id ) || is_user_hltv( id ) )
		return;

	g_bUserHas[ id ][ SILENT ] = false;
	g_bUserHas[ id ][ NVG ] = false;
        g_bUserHas[ id ][ DEFUSE ] = false;
	g_bUserHas[ id ][ GOD ] = false;
        g_bUserHas[ id ][ KNIFE ] = false;
}

public ClCmdSayShop( id )
{
	if( get_pcvar_num( g_iCvar[ ENABLE ] ) == 0 )
	{
		ColorChat( id, NORMAL, "^x04%s^x01 Comanda dezactivata de catre server !", g_szTag );
		return PLUGIN_HANDLED;
	}

	if( !is_user_alive( id ) )
	{
		ColorChat( id, NORMAL, "^x04%s^x01 Trebuie sa fii in ^x03viata^x01 pentru a accesa ^x04Shop-ul^x01 !", g_szTag );
		return PLUGIN_HANDLED;
	}
	
	ShopMenu( id );
	return PLUGIN_HANDLED;
}

public ShopMenu( id )
{
	new szMenuName[ 64 ];
	formatex( szMenuName, sizeof ( szMenuName ) -1, "%s^n\rCredite: \d%i", g_szMenuName, fcs_get_user_credits( id ) );
	new iMenu = menu_create( szMenuName, "ShopMenuHandler" );	
	new iCallBack  =  menu_makecallback( "CallBackShop" );

	new szBuffer[ 9 ][ 64 ], szBufferKey[ 8 ], iBufferKey = 1;
	formatex( szBuffer[ 0 ], sizeof ( szBuffer[ ] ) -1, "\r[ \yFuLL\r ] \wGrenazi\y       [\r %iC\y ]", get_pcvar_num( g_iCvar[ NADES_PRICE ] ) );
	formatex( szBuffer[ 1 ], sizeof ( szBuffer[ ] ) -1, "\r[ \y+%i\r ] \wHP\y                [\r %iC\y ]", get_pcvar_num( g_iCvar[ HP_AMOUNT ] ), get_pcvar_num( g_iCvar[ HP_PRICE ] ) )
	formatex( szBuffer[ 2 ], sizeof ( szBuffer[ ] ) -1, "\r[ \y+%i\r ] \wAP\y                [\r %iC\y ]", get_pcvar_num( g_iCvar[ AP_AMOUNT ] ), get_pcvar_num( g_iCvar[ AP_PRICE ] ) )
	formatex( szBuffer[ 3 ], sizeof ( szBuffer[ ] ) -1, "\r[ \yFuLL\r ] \wReinviere\y       [\r %iC\y ]",  get_pcvar_num( g_iCvar[ LIFE_PRICE ] ) );
	formatex( szBuffer[ 4 ], sizeof ( szBuffer[ ] ) -1, "\r[ \y7s\r ] \wGoD MoD\y        [\r %iC\y ]", get_pcvar_num( g_iCvar[ GOD_PRICE ] ) );
	formatex( szBuffer[ 5 ], sizeof ( szBuffer[ ] ) -1, "\r[ \y1R\r ] \wDefuse Kit\y       [\r %iC\y ]", get_pcvar_num( g_iCvar[ DEFUSE_PRICE ] ) );
	formatex( szBuffer[ 6 ], sizeof ( szBuffer[ ] ) -1, "\r[ \y1R\r ] \wSilent Walk\y       [\r %iC\y ]", get_pcvar_num( g_iCvar[ SILENT_PRICE ] ) );
	formatex( szBuffer[ 7 ], sizeof ( szBuffer[ ] ) -1, "\r[ \yBesT\r ] \wSuPeR KniFe\y       [\r %iC\y ]", get_pcvar_num( g_iCvar[ KNIFE_PRICE ] ) );
	formatex( szBuffer[ 8 ], sizeof ( szBuffer[ ] ) -1, "\r[ \y1R\r ] \wNighT ViSioN\y       [\r %iC\y ]", get_pcvar_num( g_iCvar[ NVG_PRICE ] ) );

	for( new i = 0; i < 9; i++ )
	{
		formatex( szBufferKey, sizeof ( szBufferKey ) -1, "%i", iBufferKey );
		menu_additem( iMenu, szBuffer[ i ], szBufferKey, _, iCallBack );

		iBufferKey++;
	}

	menu_setprop( iMenu, MPROP_EXITNAME, "\dIesire" );

	menu_display( id, iMenu, 0 );
}

public ShopMenuHandler( id, iMenu, iItem )
{
	if( iItem == MENU_EXIT )
	{
		menu_destroy( iMenu );
		return 1PLUGIN_HANDLED;
	}

	new data[ 6 ], iName[ 64 ];
	new iaccess, callback;

	menu_item_getinfo( iMenu, iItem, iaccess, data, 5, iName, 63, callback );

	new key = str_to_num( data );

	menu_destroy( iMenu );
	switch( key )
	{
		case 1:
		{
			new iCredits, iNeededCredits;
			iCredits = fcs_get_user_credits( id );
			iNeededCredits = get_pcvar_num( g_iCvar[ NADES_PRICE ] );
		
			if( iCredits < iNeededCredits )
			{
				ColorChat( id, NORMAL, "^x04%s^x01 NU^x01 ai destule credite, iti mai trebuie^x03 %i credite^x01 !", g_szTag, iNeededCredits - iCredits );
				return PLUGIN_HANDLED;
			}

			if( bUserHasAnyNade( id ) )
			{
				ColorChat( id, NORMAL, "^x04%s^x01 Ai cel putin o grenada in mana, nu poti cumpara altele !", g_szTag );
				return PLUGIN_HANDLED;
			}

			fcs_sub_user_credits( id, iNeededCredits );
			ColorChat( id, NORMAL, "^x04%s^x01 Ai cumparat^x03 Pachet de Grenazi^x01 pentru^x04 %i credite^x01 !", g_szTag, iNeededCredits );

			give_item( id, "weapon_hegrenade" );
			give_item( id, "weapon_flashbang" );
			give_item( id, "weapon_flashbang" );
			give_item( id, "weapon_smokegrenade" );
		}

		case 2:
		{
			new iCredits, iNeededCredits;
			iCredits = fcs_get_user_credits( id );
			iNeededCredits = get_pcvar_num( g_iCvar[ HP_PRICE ] );

                        if( get_user_health( id ) >= 255 )
                        {
			    new iHP = get_pcvar_num( g_iCvar[ HP_AMOUNT ] );

			    new Health = get_user_health ( id );
				if ( Health <= 255 ) {
					fm_set_user_health ( id, get_user_health ( id ) + iHP );
					fcs_sub_user_credits( id, iNeededCredits );
				}
				if ( Health > 255 ) {
					
					ColorChat(id, NORMAL, "^x04%s^x01 Nu poti cumpara 50 HP deoarece ai peste 255 Hp!", g_szTag, iHP );
					return 1;
				}

			    ColorChat( id, NORMAL, "^x04%s^x01 Ai cumparat^x03 + %i HP^x01 pentru^x04 %i credite^x01 !", g_szTag, iHP, iNeededCredits );
                        }

                        else
			if( iCredits < iNeededCredits )
			{
				ColorChat( id, NORMAL, "^x04%s^x01 NU^x01 ai destule credite, iti mai trebuie^x03 %i credite^x01 !", g_szTag, iNeededCredits - iCredits );
				return PLUGIN_HANDLED;
			}
		}

		case 3:
		{
			new iCredits, iNeededCredits;
			iCredits = fcs_get_user_credits( id );
			iNeededCredits = get_pcvar_num( g_iCvar[ AP_PRICE ] );


                        if( get_user_armor( id ) >= 300 )
                        {
			    new iAP = get_pcvar_num( g_iCvar[ AP_AMOUNT ] );

			    new Armor = get_user_armor ( id );
				if ( Health <= 400 ) {
					fm_set_user_armor ( id, get_user_armor ( id ) + iAP );
					fcs_sub_user_credits( id, iNeededCredits );
				}
				if ( Armor > 400 ) {
					
					ColorChat(id, NORMAL, "^x04%s^x01 Nu poti cumpara %s AP deoarece ai peste 400 Ap!", g_szTag, iAP );
					return 1;
				}

			    ColorChat( id, NORMAL, "^x04%s^x01 Ai cumparat^x03 + %i AP^x01 pentru^x04 %i credite^x01 !", g_szTag, iAP, iNeededCredits );
                        }

                        else
			if( iCredits < iNeededCredits )
			{
				ColorChat( id, NORMAL, "^x04%s^x01 NU^x01 ai destule credite, iti mai trebuie^x03 %i credite^x01 !", g_szTag, iNeededCredits - iCredits );
				return PLUGIN_HANDLED;
			}
		}

		case 4:
		{
			new iCredits, iNeededCredits;
			iCredits = fcs_get_user_credits( id );
			iNeededCredits = get_pcvar_num( g_iCvar[ LIFE_PRICE ] );

			if( iCredits < iNeededCredits )
			{
				ColorChat( id, NORMAL, "^x04%s^x01 NU^x01 ai destule credite, iti mai trebuie^x03 %i credite^x01 !", g_szTag, iNeededCredits - iCredits );
				return PLUGIN_HANDLED;
			}

                        if( is_user_alive( id ) )
                        {
			       ColorChat( id, NORMAL, "^x04%s^x01 Trebuie sa fi^x03Mort^x01 pentru a te reincarna !", g_szTag );
                        }

                        else
                        if( !is_user_alive( id ) )
                        {
			       fcs_sub_user_credits( id, iNeededCredits );
                               ExecuteHamB( Ham_CS_RoundRespawn, id );
                               strip_user_weapons( id );
                               give_item( id, "weapon_knife" );
			       ColorChat( id, NORMAL, "^x04%s^x01 Ai fost^x03 Reinviat^x01 cu succes pentru^x03 %i credite^x01 !", g_szTag, iNeededCredits );
                        }
		}

		case 5:
		{
			new iCredits, iNeededCredits;
			iCredits = fcs_get_user_credits( id );
			iNeededCredits = get_pcvar_num( g_iCvar[ GOD_PRICE ] );

			if( iCredits < iNeededCredits )
			{
				ColorChat( id, NORMAL, "^x04%s^x01 NU^x01 ai destule credite, iti mai trebuie^x03 %i credite^x01 !", g_szTag, iNeededCredits - iCredits );
				return PLUGIN_HANDLED;
			}

			fcs_sub_user_credits( id, iNeededCredits );

			ColorChat( id, NORMAL, "^x04%s^x01 Ai cumparat^x03 God Mode^x01 pentru^x04 %i credite^x01 !", g_szTag, iNeededCredits );

			g_bUserHas[ id ][ GOD ] = true;
			set_user_godmode( id, 1 );
			set_task ( 7.0, "removegm", id );
		}

		case 6:
		{
			new iCredits, iNeededCredits;
			iCredits = fcs_get_user_credits( id );
			iNeededCredits = get_pcvar_num( g_iCvar[ DEFUSE_PRICE ] );

			if( iCredits < iNeededCredits )
			{
				ColorChat( id, NORMAL, "^x04%s^x01 NU^x01 ai destule credite, iti mai trebuie^x03 %i credite^x01 !", g_szTag, iNeededCredits - iCredits );
				return PLUGIN_HANDLED;
			}

			fcs_sub_user_credits( id, iNeededCredits );

			ColorChat( id, NORMAL, "^x04%s^x01 Ai cumparat^x03 Defuse KIT^x01 pentru^x04 %i credite^x01 !", g_szTag, iNeededCredits );

			fm_give_item ( id, "item_thighpack" );
			g_bUserHas[ id ][ DEFUSE ] = true;
		}

		case 7:
		{
			new iCredits, iNeededCredits;
			iCredits = fcs_get_user_credits( id );
			iNeededCredits = get_pcvar_num( g_iCvar[ SILENT_PRICE ] );

			if( iCredits < iNeededCredits )
			{
				ColorChat( id, NORMAL, "^x04%s^x01 NU^x01 ai destule credite, iti mai trebuie^x03 %i credite^x01 !", g_szTag, iNeededCredits - iCredits );
				return PLUGIN_HANDLED;
			}

			fcs_sub_user_credits( id, iNeededCredits );

			ColorChat( id, NORMAL, "^x04%s^x01 Ai cumparat^x03 Silent Walk ^x01 pentru^x04 %i credite^x01 !", g_szTag, iNeededCredits );

			set_user_footsteps( id, 1 );
			g_bUserHas[ id ][ SILENT ] = true;
		}

		case 8:
		{
			new iCredits, iNeededCredits;
			iCredits = fcs_get_user_credits( id );
			iNeededCredits = get_pcvar_num( g_iCvar[ KNIFE_PRICE ] );

			if( iCredits < iNeededCredits )
			{
				ColorChat( id, NORMAL, "^x04%s^x01 NU^x01 ai destule credite, iti mai trebuie^x03 %i credite^x01 !", g_szTag, iNeededCredits - iCredits );
				return PLUGIN_HANDLED;
			}

			fcs_sub_user_credits( id, iNeededCredits );

			ColorChat( id, NORMAL, "^x04%s^x01 Ai cumparat^x03 Super Knife ^x01pentru^x04 %i credite^x01 !", g_szTag, iNeededCredits );

                        give_item( id, "weapon_knife");
                        set_pev( id, pev_viewmodel2, super_knife );
                        set_pev( id, pev_weaponmodel2, super_knife2 );
                        g_bUserHas[ id ][ KNIFE ] = true;
                        set_task( 0.1, "Player_TakeDamage", id );
		}

		case 9:
		{
			new iCredits, iNeededCredits;
			iCredits = fcs_get_user_credits( id );
			iNeededCredits = get_pcvar_num( g_iCvar[ NVG_PRICE ] );

			if( iCredits < iNeededCredits )
			{
				ColorChat( id, NORMAL, "^x04%s^x01 NU^x01 ai destule credite, iti mai trebuie^x03 %i credite^x01 !", g_szTag, iNeededCredits - iCredits );
				return PLUGIN_HANDLED;
			}

			fcs_sub_user_credits( id, iNeededCredits );

			ColorChat( id, NORMAL, "^x04%s^x01 Ai cumparat^x03 Night Vision ^x01pentru^x04 %i credite^x01 !", g_szTag, iNeededCredits );

                        set_user_nvg( id, 1 );
                        g_bUserHas[ id ][ NVG ] = true;
		}
	}
	
	return PLUGIN_CONTINUE;
}

public removegm( id )
{
    set_user_godmode( id, 0 );
}

public Player_TakeDamage( iVictim, iInflictor, iAttacker, Float:fDamage )
{
	if ( is_user_alive( iAttacker ) && iInflictor == iAttacker && g_bUserHas[ iAttacker ][ KNIFE ] && cs_get_user_team( iAttacker ) == CS_TEAM_T && get_user_weapon ( iAttacker ) == CSW_KNIFE )
        {
		SetHamParamFloat( 4, fDamage * 4.0 );
		return HAM_HANDLED;
	}

	return HAM_IGNORED;
}

public CallBackShop( id, iMenu, iItem )
{
	static _access, szInfo[ 4 ],  callback;
	menu_item_getinfo( iMenu, iItem, _access, szInfo, sizeof ( szInfo ) -1, _, _, callback );
	
	if( szInfo[ 0 ] == '0' )          return ITEM_ENABLED;

 	if( szInfo[ 0 ] == '1' )
	{
		if( get_pcvar_num( g_iCvar[ NADES_TO ] ) == 3 || fcs_get_user_team( id ) == get_pcvar_num( g_iCvar[ NADES_TO ] ) )
			return ITEM_ENABLED;
	}

	else
        if( szInfo[ 0 ] == '2' )
	{
		if( get_pcvar_num( g_iCvar[ HP_TO ] ) == 3 || fcs_get_user_team( id ) == get_pcvar_num( g_iCvar[ HP_TO ] ) )
			return ITEM_ENABLED;
	}

	else
        if( szInfo[ 0 ] == '3' )
	{
		if( get_pcvar_num( g_iCvar[ AP_TO ] ) == 3 || fcs_get_user_team( id ) == get_pcvar_num( g_iCvar[ AP_TO ] ) )
			return ITEM_ENABLED;
	}

	else
        if( szInfo[ 0 ] == '4' )
	{
		if( get_pcvar_num( g_iCvar[ LIFE_TO ] ) == 3 || fcs_get_user_team( id ) == get_pcvar_num( g_iCvar[ LIFE_TO] ) )
			return ITEM_ENABLED;
	}

	else
        if( szInfo[ 0 ] == '5' )
	{
		if( get_pcvar_num( g_iCvar[ GOD_TO ] ) == 3 || fcs_get_user_team( id ) == get_pcvar_num( g_iCvar[ GOD_TO ] ) )
			return ITEM_ENABLED;
	}

	else
        if( szInfo[ 0 ] == '6' )
	{
		if( get_pcvar_num( g_iCvar[ DEFUSE_TO ] ) == 3 || fcs_get_user_team( id ) == get_pcvar_num( g_iCvar[ DEFUSE_TO ] ) )
			return ITEM_ENABLED;
	}

	else
        if( szInfo[ 0 ] == '7' )
	{
		if( get_pcvar_num( g_iCvar[ SILENT_TO ] ) == 3 || fcs_get_user_team( id ) == get_pcvar_num( g_iCvar[ SILENT_TO ] ) )
			return ITEM_ENABLED;
	}

	else
        if( szInfo[ 0 ] == '8' )
	{
		if( get_pcvar_num( g_iCvar[ KNIFE_TO ] ) == 3 || fcs_get_user_team( id ) == get_pcvar_num( g_iCvar[ KNIFE_TO ] ) )
			return ITEM_ENABLED;
	}

	else
        if( szInfo[ 0 ] == '9' )
	{
		if( get_pcvar_num( g_iCvar[ NVG_TO ] ) == 3 || fcs_get_user_team( id ) == get_pcvar_num( g_iCvar[ NVG_TO ] ) )
			return ITEM_ENABLED;
	}

	return ITEM_DISABLED;
}

public ham_PlayerSpawnPre( id )
{
	if( is_user_alive( id ) )
	{
	        set_user_armor( id, 0 );
		set_user_nvg( id, 0 );
		remove_user_nvg( id );
		//remove_task( id );
                g_bUserHas[ id ][ DEFUSE ] = false;
                g_bUserHas[ id ][ GOD ] = false;
                g_bUserHas[ id ][ KNIFE ] = false;
	}
}

public ham_PlayerKilledPre(  id  )
{
        g_bUserHas[ id ][ GOD ] = false;
        g_bUserHas[ id ][ DEFUSE ] = false;
	g_bUserHas[ id ][ SILENT ] = false;
	g_bUserHas[ id ][ NVG ] = false;
        g_bUserHas[ id ][ KNIFE ] = false;
}

stock bool:bUserHasAnyNade( id )
{
	if( user_has_weapon( id, CSW_HEGRENADE ) || user_has_weapon( id, CSW_FLASHBANG ) || user_has_weapon( id, CSW_SMOKEGRENADE ) )
		return true;

	return false;
}

stock fcs_get_user_team( id )
{
	new iTeam = -1;
	if( cs_get_user_team( id ) == CS_TEAM_T )	iTeam = 1;

	else 

        if( cs_get_user_team( id ) == CS_TEAM_CT )	iTeam = 2;

	return iTeam;
}

stock set_user_nvg( id, nvgoggles = 1 )
{
	if( nvgoggles )
	{
		set_pdata_int( id, m_iNvg, get_pdata_int( id, m_iNvg ) | HAS_NVGS );
	}

	else
	{
		set_pdata_int( id, m_iNvg, get_pdata_int( id, m_iNvg ) & ~HAS_NVGS );
	}
}

stock remove_user_nvg( id )
{
	new iNvgs = get_pdata_int( id, m_iNvg, m_iLinuxDiff );

	if( !iNvgs )
	{
		return;
	}

	if( iNvgs & USES_NVGS )
	{
		emit_sound( id, CHAN_ITEM, SOUND_NVGOFF, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );

		emessage_begin( MSG_ONE_UNRELIABLE, gMessageNVG, _, id );
		ewrite_byte( 0 );
		emessage_end();
	}

	set_pdata_int( id, m_iNvg, 0, m_iLinuxDiff );
}  

ColorChat( id, Color:iType, const msg[  ], { Float, Sql, Result, _ }:... )
{
	if( !get_playersnum( ) ) return;

	new szMessage[ 256 ];

	switch( iType )
	{
		case NORMAL:	szMessage[ 0 ] = 0x01;

		case GREEN:	szMessage[ 0 ] = 0x04;

		default: 	szMessage[ 0 ] = 0x03;
	}

	vformat( szMessage[ 1 ], 251, msg, 4 );

	szMessage[ 192 ] = '^0';
	
	new iTeam, iColorChange, iPlayerIndex, MSG_Type;

	if( id )
	{
		MSG_Type  =  MSG_ONE_UNRELIABLE;
		iPlayerIndex  =  id;
	}
	else
	{
		iPlayerIndex  =  CC_FindPlayer( );
		MSG_Type = MSG_ALL;
	}

	iTeam  =  get_user_team( iPlayerIndex );
	iColorChange  =  CC_ColorSelection( iPlayerIndex,  MSG_Type, iType );

	CC_ShowColorMessage( iPlayerIndex, MSG_Type, szMessage  );

	if( iColorChange )	CC_Team_Info( iPlayerIndex, MSG_Type,  TeamName[ iTeam ] );
}

CC_ShowColorMessage( id, const iType, const szMessage[ ] )
{
	static bool:bSayTextUsed;
	static iMsgSayText;

	if( !bSayTextUsed )
	{
		iMsgSayText  =  get_user_msgid( "SayText" );
		bSayTextUsed  =  true;
	}

	message_begin( iType, iMsgSayText, _, id  );
	write_byte(  id  )		
	write_string(  szMessage  );
	message_end(  );
}

CC_Team_Info( id, const iType, const szTeam[ ] )
{
	static bool:bTeamInfoUsed;
	static iMsgTeamInfo;
	if(  !bTeamInfoUsed  )
	{
		iMsgTeamInfo  =  get_user_msgid( "TeamInfo" );
		bTeamInfoUsed  =  true;
	}

	message_begin( iType, iMsgTeamInfo, _, id  );
	write_byte(  id  );
	write_string(  szTeam  );
	message_end(  );

	return 1;
}

CC_ColorSelection( id, const iType, Color:iColorType )
{
	switch( iColorType )
	{
		case RED:	return CC_Team_Info( id, iType, TeamName[ 1 ] );
		case BLUE:	return CC_Team_Info( id, iType, TeamName[ 2 ] );
		case GREY:	return CC_Team_Info( id, iType, TeamName[ 0 ] );
	}

	return 0;
}

CC_FindPlayer( )
{
	new iMaxPlayers  =  get_maxplayers( );
	
	for( new i = 1; i <= iMaxPlayers; i++ )
		if( is_user_connected( i ) )
			return i;
	return -1;
}
P.S.: Netestat = Nu am avut timp să mă uit atent peste cod. Deci ceea ce am scris este posibil să fie greşit sau să aibă erori.

If i helped you and you wanna thank me, you can donate at this link : here
This will motivate me to help you in the future.
[If you want a private plugin send me a PM.(No complex plugins please, I am a student and I don't have the time to make those)]
Post Reply

Return to “Cereri”

  • Information