[ CERERE ] Shop

Categoria cu cereri de pluginuri si nu numai.

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

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

Daca doriti sa vi se modifice un plugin, va rugam postati aici .
Ake
Membru, skill +1
Membru, skill +1
Posts: 128
Joined: 19 Dec 2013, 17:30
Detinator Steam: Da
Has thanked: 88 times
Been thanked: 2 times

22 Dec 2013, 17:52

Va rog frumos sa imi adaugati limita la reinviere ( de 2 ori pe runda )
SHOP | Afiseaza codul
#include < amxmodx >
#include < cstrike >
#include < fakemeta_util >
#include < hamsandwich >
#include < fun >

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

#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, max( 0, 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", "10" );
	g_iCvar[ NADES_TO ] = register_cvar( "fcsshop_nades_team", "3" );

	g_iCvar[ HP_PRICE ] = register_cvar( "fcsshop_hp_price", "25" );
	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", "20" );
	g_iCvar[ AP_AMOUNT ] = register_cvar( "fcsshop_ap_amount", "150" );
	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", "30" );
	g_iCvar[ GOD_TO ] = register_cvar( "fcsshop_god_team", "2" );

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

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

	g_iCvar[ KNIFE_PRICE ] = register_cvar( "fcsshop_knife_price", "45" );
	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" );

	register_clcmd( "say banca", "ClCmdSayBanca" );
	register_clcmd( "say_team banca", "ClCmdSayBanca" );
	register_clcmd( "say /banca", "ClCmdSayBanca" );
	register_clcmd( "say_team /banca", "ClCmdSayBanca" );

        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 ClCmdSayBanca( id )
{ 
         ColorChat( id, NORMAL, "^x04%s^x01 Scrie^x03 /retrage^x01 pentru a retrage^x04 1C^x01 si sa primesti^x03 16000$^x01 din banca^x04 FuRieN.HeLpCS.Ro", g_szTag );
         ColorChat( id, NORMAL, "^x04%s^x01 Scrie^x03 /depozit^x01 pentru a depozita^x04 16000$^x01 si sa primesti^x03 1C^x01 in banca^x04 FuRieN.HeLpCS.Ro", g_szTag );
         ColorChat( id, NORMAL, "^x04%s^x01 Scrie^x03 /credits^x01 pentru a-ti vizualiza^x04 creditele^x01 din banca^x03 FuRieN.HeLpCS.Ro", g_szTag );
         ColorChat( id, NORMAL, "^x04%s^x01 Scrie^x03 /transfer^x01 pentru a transfera^x04 xCredite^x01 unui jucator prin banca^x03 FuRieN.HeLpCS.Ro", g_szTag );
         ColorChat( id, NORMAL, "^x04%s^x01 Scrie^x03 /credite^x04 Jucator^x01 pentru a vizualiza cate credite are^x03 Jucatorul respectiv^x01 in banca^x04 FuRieN.HeLpCS.Ro", g_szTag );
}

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;
}

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;
	}
	
	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, "\wIesire" );

	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:
		{
	                if( !is_user_alive( id ) )
	                {
				ColorChat( id, NORMAL, "^x04%s^x01 Trebuie sa fii in^x03 viata^x01 pentru a accesa^x04 Shop-ul^x01 !", g_szTag );
				return PLUGIN_HANDLED;
	                }

			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:
		{
	                if( !is_user_alive( id ) )
	                {
				ColorChat( id, NORMAL, "^x04%s^x01 Trebuie sa fii in^x03 viata^x01 pentru a accesa^x04 Shop-ul^x01 !", g_szTag );
				return PLUGIN_HANDLED;
	                }

			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;
			}

			if( get_user_health( id ) >= 255 )
			{
				ColorChat( id, NORMAL, "^x04%s^x01 Nu poti cumpara mai mult de^x03 255^x01 HP", g_szTag );
				return PLUGIN_HANDLED;
			}

                        else
                        {
				new iHP = get_pcvar_num( g_iCvar[ HP_AMOUNT ] );

				fcs_sub_user_credits( id, iNeededCredits );

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

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

		case 3:
		{
	                if( !is_user_alive( id ) )
	                {
				ColorChat( id, NORMAL, "^x04%s^x01 Trebuie sa fii in^x03 viata^x01 pentru a accesa^x04 Shop-ul^x01 !", g_szTag );
				return PLUGIN_HANDLED;
	                }

			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;
			}

			if( get_user_armor( id ) >= 400 )
			{
				ColorChat( id, NORMAL, "^x04%s^x01 Nu poti cumpara mai mult de^x03 400^x01 AP", g_szTag );
				return PLUGIN_HANDLED;
			}

                        else
                        {
				new iAP = get_pcvar_num( g_iCvar[ AP_AMOUNT ] );

				fcs_sub_user_credits( id, iNeededCredits );

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

				ColorChat( id, NORMAL, "^x04%s^x01 Ai cumparat^x03 + %i AP^x01 pentru^x04 %i credite^x01 ! Max AP (^x03 400^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^x03 Mort^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^x04 %i credite^x01 !", g_szTag, iNeededCredits );
		}

		case 5:
		{
	                if( !is_user_alive( id ) )
	                {
				ColorChat( id, NORMAL, "^x04%s^x01 Trebuie sa fii in^x03 viata^x01 pentru a accesa^x04 Shop-ul^x01 !", g_szTag );
				return PLUGIN_HANDLED;
	                }

			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:
		{
	                if( !is_user_alive( id ) )
	                {
				ColorChat( id, NORMAL, "^x04%s^x01 Trebuie sa fii in^x03 viata^x01 pentru a accesa^x04 Shop-ul^x01 !", g_szTag );
				return PLUGIN_HANDLED;
	                }

			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:
		{
	                if( !is_user_alive( id ) )
	                {
				ColorChat( id, NORMAL, "^x04%s^x01 Trebuie sa fii in^x03 viata^x01 pentru a accesa^x04 Shop-ul^x01 !", g_szTag );
				return PLUGIN_HANDLED;
	                }

			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 ^x01pentru^x04 %i credite^x01 !", g_szTag, iNeededCredits );

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

		case 8:
		{
	                if( !is_user_alive( id ) )
	                {
				ColorChat( id, NORMAL, "^x04%s^x01 Trebuie sa fii in^x03 viata^x01 pentru a accesa^x04 Shop-ul^x01 !", g_szTag );
				return PLUGIN_HANDLED;
	                }

			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 );

                        g_bUserHas[ id ][ KNIFE ] = true;
                        set_task( 0.1, "Player_TakeDamage", id );
                        RefreshWeapon( id )
		}

		case 9:
		{
	                if( !is_user_alive( id ) )
	                {
				ColorChat( id, NORMAL, "^x04%s^x01 Trebuie sa fii in^x03 viata^x01 pentru a accesa^x04 Shop-ul^x01 !", g_szTag );
				return PLUGIN_HANDLED;
	                }

			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;
			}

			if( g_bUserHas[ id ][ NVG ] )
			{
				ColorChat( id, NORMAL, "^x04%s^x01 Deja ai cumparat 1^x03 Night Vision^x01 !", g_szTag );
				return PLUGIN_HANDLED;
			}

                        else
                        {
				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 ] && get_user_weapon( iAttacker ) == CSW_KNIFE && cs_get_user_team( iAttacker ) == CS_TEAM_T )
        {
		SetHamParamFloat( 4, fDamage * 4.1 );
		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 );
                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( get_user_team( id ) == 1 )	iTeam = 1;

	else 
        if( get_user_team( id ) == 2 )	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;
}
Rapidserver
Ake
Membru, skill +1
Membru, skill +1
Posts: 128
Joined: 19 Dec 2013, 17:30
Detinator Steam: Da
Has thanked: 88 times
Been thanked: 2 times

22 Dec 2013, 23:31

UP..mai erau cateva minute
User avatar
DaNNe.
Fost moderator
Fost moderator
Posts: 2808
Joined: 08 Nov 2013, 20:43
Detinator Steam: Da
CS Status: Activitate scăzută
SteamID: /id/FurienMaster
Reputatie: Nick anterior: DnD. Gold, Emrys
0.5/3
Fost moderator ajutator
Fost Membru Club eXtreamCS (doua luni)
Has thanked: 230 times
Been thanked: 128 times
Contact:

22 Dec 2013, 23:49

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

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

#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"
#define FOLOSIRE_VIATA 2 //Setezi de cate ori pe runda vrei.

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, max( 0, 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_razor.mdl";
new super_knife2[ 66 ] = "models/p_razor.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", "10" );
	g_iCvar[ NADES_TO ] = register_cvar( "fcsshop_nades_team", "3" );

	g_iCvar[ HP_PRICE ] = register_cvar( "fcsshop_hp_price", "25" );
	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", "20" );
	g_iCvar[ AP_AMOUNT ] = register_cvar( "fcsshop_ap_amount", "150" );
	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", "30" );
	g_iCvar[ GOD_TO ] = register_cvar( "fcsshop_god_team", "2" );

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

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

	g_iCvar[ KNIFE_PRICE ] = register_cvar( "fcsshop_knife_price", "45" );
	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" );

	register_clcmd( "say banca", "ClCmdSayBanca" );
	register_clcmd( "say_team banca", "ClCmdSayBanca" );
	register_clcmd( "say /banca", "ClCmdSayBanca" );
	register_clcmd( "say_team /banca", "ClCmdSayBanca" );

        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 ClCmdSayBanca( id )
{ 
         ColorChat( id, NORMAL, "^x04%s^x01 Scrie^x03 /retrage^x01 pentru a retrage^x04 1C^x01 si sa primesti^x03 16000$^x01 din banca^x04 FuRieN.HeLpCS.Ro", g_szTag );
         ColorChat( id, NORMAL, "^x04%s^x01 Scrie^x03 /depozit^x01 pentru a depozita^x04 16000$^x01 si sa primesti^x03 1C^x01 in banca^x04 FuRieN.HeLpCS.Ro", g_szTag );
         ColorChat( id, NORMAL, "^x04%s^x01 Scrie^x03 /credits^x01 pentru a-ti vizualiza^x04 creditele^x01 din banca^x03 FuRieN.HeLpCS.Ro", g_szTag );
         ColorChat( id, NORMAL, "^x04%s^x01 Scrie^x03 /transfer^x01 pentru a transfera^x04 xCredite^x01 unui jucator prin banca^x03 FuRieN.HeLpCS.Ro", g_szTag );
         ColorChat( id, NORMAL, "^x04%s^x01 Scrie^x03 /credite^x04 Jucator^x01 pentru a vizualiza cate credite are^x03 Jucatorul respectiv^x01 in banca^x04 FuRieN.HeLpCS.Ro", g_szTag );
}

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;
}

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;
	}
	
	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, "\wIesire" );

	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:
		{
	                if( !is_user_alive( id ) )
	                {
				ColorChat( id, NORMAL, "^x04%s^x01 Trebuie sa fii in^x03 viata^x01 pentru a accesa^x04 Shop-ul^x01 !", g_szTag );
				return PLUGIN_HANDLED;
	                }

			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:
		{
	                if( !is_user_alive( id ) )
	                {
				ColorChat( id, NORMAL, "^x04%s^x01 Trebuie sa fii in^x03 viata^x01 pentru a accesa^x04 Shop-ul^x01 !", g_szTag );
				return PLUGIN_HANDLED;
	                }

			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;
			}

			if( get_user_health( id ) >= 255 )
			{
				ColorChat( id, NORMAL, "^x04%s^x01 Nu poti cumpara mai mult de^x03 255^x01 HP", g_szTag );
				return PLUGIN_HANDLED;
			}

                        else
                        {
				new iHP = get_pcvar_num( g_iCvar[ HP_AMOUNT ] );

				fcs_sub_user_credits( id, iNeededCredits );

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

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

		case 3:
		{
	                if( !is_user_alive( id ) )
	                {
				ColorChat( id, NORMAL, "^x04%s^x01 Trebuie sa fii in^x03 viata^x01 pentru a accesa^x04 Shop-ul^x01 !", g_szTag );
				return PLUGIN_HANDLED;
	                }

			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;
			}

			if( get_user_armor( id ) >= 400 )
			{
				ColorChat( id, NORMAL, "^x04%s^x01 Nu poti cumpara mai mult de^x03 400^x01 AP", g_szTag );
				return PLUGIN_HANDLED;
			}

                        else
                        {
				new iAP = get_pcvar_num( g_iCvar[ AP_AMOUNT ] );

				fcs_sub_user_credits( id, iNeededCredits );

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

				ColorChat( id, NORMAL, "^x04%s^x01 Ai cumparat^x03 + %i AP^x01 pentru^x04 %i credite^x01 ! Max AP (^x03 400^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^x03 Mort^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^x04 %i credite^x01 !", g_szTag, iNeededCredits );
					if ( FOLOSIRE_VIATA )
					{
					 ColorChat( id, NORMAL, "^x04%s^x01 Nu te poti reinvia cand esti mort.", g_szTag);
					}
		}

		case 5:
		{
	                if( !is_user_alive( id ) )
	                {
				ColorChat( id, NORMAL, "^x04%s^x01 Trebuie sa fii in^x03 viata^x01 pentru a accesa^x04 Shop-ul^x01 !", g_szTag );
				return PLUGIN_HANDLED;
	                }

			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:
		{
	                if( !is_user_alive( id ) )
	                {
				ColorChat( id, NORMAL, "^x04%s^x01 Trebuie sa fii in^x03 viata^x01 pentru a accesa^x04 Shop-ul^x01 !", g_szTag );
				return PLUGIN_HANDLED;
	                }

			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:
		{
	                if( !is_user_alive( id ) )
	                {
				ColorChat( id, NORMAL, "^x04%s^x01 Trebuie sa fii in^x03 viata^x01 pentru a accesa^x04 Shop-ul^x01 !", g_szTag );
				return PLUGIN_HANDLED;
	                }

			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 ^x01pentru^x04 %i credite^x01 !", g_szTag, iNeededCredits );

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

		case 8:
		{
	                if( !is_user_alive( id ) )
	                {
				ColorChat( id, NORMAL, "^x04%s^x01 Trebuie sa fii in^x03 viata^x01 pentru a accesa^x04 Shop-ul^x01 !", g_szTag );
				return PLUGIN_HANDLED;
	                }

			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 );

                        g_bUserHas[ id ][ KNIFE ] = true;
                        set_task( 0.1, "Player_TakeDamage", id );
                        RefreshWeapon( id )
		}

		case 9:
		{
	                if( !is_user_alive( id ) )
	                {
				ColorChat( id, NORMAL, "^x04%s^x01 Trebuie sa fii in^x03 viata^x01 pentru a accesa^x04 Shop-ul^x01 !", g_szTag );
				return PLUGIN_HANDLED;
	                }

			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;
			}

			if( g_bUserHas[ id ][ NVG ] )
			{
				ColorChat( id, NORMAL, "^x04%s^x01 Deja ai cumparat 1^x03 Night Vision^x01 !", g_szTag );
				return PLUGIN_HANDLED;
			}

                        else
                        {
				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 ] && get_user_weapon( iAttacker ) == CSW_KNIFE && cs_get_user_team( iAttacker ) == CS_TEAM_T )
        {
		SetHamParamFloat( 4, fDamage * 4.1 );
		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 );
                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( get_user_team( id ) == 1 )	iTeam = 1;

	else 
        if( get_user_team( id ) == 2 )	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;
}
Testeazal si revin-o cu reply, preciez ca iti va da loose indentation la compilare, nu afecteaza.
Contact: Activitate scazuta.
Ake
Membru, skill +1
Membru, skill +1
Posts: 128
Joined: 19 Dec 2013, 17:30
Detinator Steam: Da
Has thanked: 88 times
Been thanked: 2 times

23 Dec 2013, 00:14

Nu merge.. da imi place ca, cum l-am pus l-ai si modificat :)
User avatar
DaNNe.
Fost moderator
Fost moderator
Posts: 2808
Joined: 08 Nov 2013, 20:43
Detinator Steam: Da
CS Status: Activitate scăzută
SteamID: /id/FurienMaster
Reputatie: Nick anterior: DnD. Gold, Emrys
0.5/3
Fost moderator ajutator
Fost Membru Club eXtreamCS (doua luni)
Has thanked: 230 times
Been thanked: 128 times
Contact:

23 Dec 2013, 00:18

Ake wrote:Nu merge.. da imi place ca, cum l-am pus l-ai si modificat :)
Adica ? :-??
Contact: Activitate scazuta.
Ake
Membru, skill +1
Membru, skill +1
Posts: 128
Joined: 19 Dec 2013, 17:30
Detinator Steam: Da
Has thanked: 88 times
Been thanked: 2 times

23 Dec 2013, 00:24

Nu imi merge..da eroare cu aia cu viata :))
Si am vazut ca ai modificat ia knife ai pus razor :)
User avatar
DaNNe.
Fost moderator
Fost moderator
Posts: 2808
Joined: 08 Nov 2013, 20:43
Detinator Steam: Da
CS Status: Activitate scăzută
SteamID: /id/FurienMaster
Reputatie: Nick anterior: DnD. Gold, Emrys
0.5/3
Fost moderator ajutator
Fost Membru Club eXtreamCS (doua luni)
Has thanked: 230 times
Been thanked: 128 times
Contact:

23 Dec 2013, 00:28

Ake wrote:Nu imi merge..da eroare cu aia cu viata :))
Si am vazut ca ai modificat ia knife ai pus razor :)
Ce eroare da la viata ? Ca la mine sa compilat.
@ Tie greu sa schimbi modelul ? Am pus razor pentru ca ala il aveam in models la serverul de teste, dar nu am putut sa testez ca nu am botii ...
Contact: Activitate scazuta.
Ake
Membru, skill +1
Membru, skill +1
Posts: 128
Joined: 19 Dec 2013, 17:30
Detinator Steam: Da
Has thanked: 88 times
Been thanked: 2 times

23 Dec 2013, 00:32

/tmp/textuitzMI.sma(394) : warning 206: redundant test: constant expression is non-zero
Sper sa ai dreptate...
User avatar
DaNNe.
Fost moderator
Fost moderator
Posts: 2808
Joined: 08 Nov 2013, 20:43
Detinator Steam: Da
CS Status: Activitate scăzută
SteamID: /id/FurienMaster
Reputatie: Nick anterior: DnD. Gold, Emrys
0.5/3
Fost moderator ajutator
Fost Membru Club eXtreamCS (doua luni)
Has thanked: 230 times
Been thanked: 128 times
Contact:

23 Dec 2013, 00:39

Ake wrote:/tmp/textuitzMI.sma(394) : warning 206: redundant test: constant expression is non-zero
Sper sa ai dreptate...
E warning. Dc ai zis ca nu-ti merge daca nu l-ai testat ? :))
Contact: Activitate scazuta.
Ake
Membru, skill +1
Membru, skill +1
Posts: 128
Joined: 19 Dec 2013, 17:30
Detinator Steam: Da
Has thanked: 88 times
Been thanked: 2 times

23 Dec 2013, 00:41

Pai nu prea are logica if( viata )...e ilogic
User avatar
DaNNe.
Fost moderator
Fost moderator
Posts: 2808
Joined: 08 Nov 2013, 20:43
Detinator Steam: Da
CS Status: Activitate scăzută
SteamID: /id/FurienMaster
Reputatie: Nick anterior: DnD. Gold, Emrys
0.5/3
Fost moderator ajutator
Fost Membru Club eXtreamCS (doua luni)
Has thanked: 230 times
Been thanked: 128 times
Contact:

23 Dec 2013, 08:55

Ake wrote:Pai nu prea are logica if( viata )...e ilogic
Tu testeza-l. Nu trage concluzii inainte.
Contact: Activitate scazuta.
Ake
Membru, skill +1
Membru, skill +1
Posts: 128
Joined: 19 Dec 2013, 17:30
Detinator Steam: Da
Has thanked: 88 times
Been thanked: 2 times

23 Dec 2013, 09:42

Am testat si era logic ca nu merge :|
Post Reply

Return to “Cereri”

  • Information