[Rezolvat] Cerere: Adaugare comanda la 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 .
Post Reply
User avatar
roberteeel
Membru eXtream
Membru eXtream
Posts: 4438
Joined: 05 Sep 2012, 11:39
Detinator Steam: Nu
Reputatie: Nick anterior: QAZW, Robert.ultrasFarul, CT 18 ROS
Restrictie schimbare nume
Fost moderator
Fost Membru Club eXtreamCS (doua luni)
Has thanked: 313 times
Been thanked: 357 times

01 Mar 2014, 12:09

SMA | Afiseaza codul
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <hamsandwich>
#include <engine>
#include <cstrike>
#include <fun>

#define PLUGIN "Skullshop" 
#define VERSION "1.0" 
#define AUTHOR "Crash94"

enum _: iCoinSequences
{
	CoinIdle = 0,
	CoinFloat,
	CoinSpin
};

new const gCoinModel[ ] = "models/skullshop/skull.mdl";

new cherep[33], w_machete[33], w_benzo[33], w_electro[33]
new Float:HudTime[33]

new const gCoinClassname[ ] = "cherep$";

public plugin_init()   
{ 
    register_plugin(PLUGIN, VERSION, AUTHOR)   

    register_event( "DeathMsg", "Hook_DeathMessage", "a" );
    register_touch( gCoinClassname, "player", "Forward_TouchCoin" );
    register_forward(FM_EmitSound, "fw_EmitSound")
    register_event("CurWeapon", "Event_CurWeapon", "be", "1=1")
    RegisterHam(Ham_TakeDamage, "player", "Player_TakeDamage")
    RegisterHam(Ham_Spawn, "player", "Spawn_player", 1)
    RegisterHam( Ham_Player_PreThink, "player", "bacon_PlayerPreThink" );

    register_clcmd("say /skullshop", "ShopMenu")
    register_clcmd("say_team /skullshop", "ShopMenu")
	register_clcmd("say /shop", "ShopMenu")
	

    register_dictionary( "skullshop.txt" );
} 

stock ChatColor(const id, const input[], any:...)
{
    new count = 1, players[32]
    static msg[191]
    vformat(msg, 190, input, 3)
    
    replace_all(msg, 190, "!g", "^4")
    replace_all(msg, 190, "!y", "^1")
    replace_all(msg, 190, "!team", "^3")
    
    if (id) players[0] = id; else get_players(players, count, "ch")
    {
        for (new i = 0; i < count; i++)
        {
            if (is_user_connected(players))
            {
                message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players);
                write_byte(players);
                write_string(msg);
                message_end();
            }
        }
    }
} 

public Spawn_player(id)
{
   if(is_user_alive(id) && is_user_connected(id))
   {
      w_machete[id] = false
      w_benzo[id] = false
      ++cherep[id]
   }
}

public client_connect( id )
{
   cherep[id] = 2
}


public plugin_precache( )
{
   precache_model( gCoinModel );
   precache_model( "models/skullshop/benzo/v_benzo.mdl" )
   precache_model( "models/skullshop/benzo/p_benzo.mdl" )
   precache_model( "models/skullshop/Machete/v_Machete.mdl" )
   precache_model( "models/skullshop/Machete/p_Machete.mdl" )
   precache_model( "models/skullshop/electro/v_electro.mdl" )
   precache_model( "models/skullshop/electro/p_electro.mdl" )
   precache_sound("skullshop/pickup_sound.wav")
   precache_sound("skullshop/benzo/MTSlash.wav")
   precache_sound("skullshop/benzo/MTConvoca.wav")
   precache_sound("skullshop/benzo/MTHitWall.wav")
   precache_sound("skullshop/benzo/MTHit2.wav")
   precache_sound("skullshop/benzo/MTStab.wav")
   precache_sound("skullshop/machete/EConvoca.wav")
   precache_sound("skullshop/machete/EHitWall.wav")
   precache_sound("skullshop/machete/EHit2.wav")
   precache_sound("skullshop/machete/ESlash.wav")
   precache_sound("skullshop/machete/EStab.wav")
}

public Hook_DeathMessage( )
{
        new iVictim = read_data( 2 );

	if( read_data( 1 ) == iVictim )
	{
		return;
	}

	new Float:flPlayerOrigin[ 3 ];
	pev( iVictim, pev_origin, flPlayerOrigin );
	
	flPlayerOrigin[ 2 ] += 4.0;

	new iEntity = create_entity( "info_target" );

	if( !pev_valid( iEntity ) )
	{
		return;
	}
	
        if(get_user_team(iVictim) == 2)
        {
	   engfunc( EngFunc_SetOrigin, iEntity, flPlayerOrigin )
           set_pev( iEntity, pev_classname, gCoinClassname );
	   engfunc( EngFunc_SetModel, iEntity, gCoinModel );
	   set_pev( iEntity, pev_solid, SOLID_SLIDEBOX );
	   set_pev( iEntity, pev_movetype, MOVETYPE_NONE );
	   set_pev( iEntity, pev_framerate, 1.0 );
	   set_pev( iEntity, pev_sequence, CoinFloat );
           engfunc( EngFunc_SetSize, iEntity, Float:{ -10.0, -10.0, -10.0 }, Float:{ 10.0, 10.0, 10.0 } );
	   engfunc( EngFunc_DropToFloor, iEntity );
	   set_pev( iEntity, pev_nextthink, get_gametime( ) + 1.0 );
           set_rendering( iEntity, kRenderFxGlowShell, (random_num(1, 255)),  (random_num(1, 255)),  (random_num(1, 255)), kRenderNormal, 75 );
       }
}

public Forward_TouchCoin( iEntity, id )
{
	if( pev_valid( iEntity ) && get_user_team(id) ==1)
	{
                ++cherep[ id ]
                client_cmd(0, "spk skullshop/pickup_sound.wav")
                set_pev( iEntity, pev_flags, FL_KILLME );
	}
	
	return PLUGIN_CONTINUE;
}

public fw_EmitSound(id, channel, const sample[], Float:volume, Float:attn, flags, pitch)
{
	if (!is_user_connected(id))
		return FMRES_IGNORED;
		
	if (w_benzo[id] && equal(sample[8], "kni", 3))
	{
		volume = 0.6;
		
		if (equal(sample[14], "sla", 3))
		{
			engfunc(EngFunc_EmitSound, id, channel, "skullshop/benzo/MTSlash.wav", volume, attn, flags, pitch);
			return FMRES_SUPERCEDE;
		}
		if(equal(sample,"weapons/knife_deploy1.wav"))
		{
			engfunc(EngFunc_EmitSound, id, channel, "skullshop/benzo/MTConvoca.wav", volume, attn, flags, pitch);
			return FMRES_SUPERCEDE;
		}
		if (equal(sample[14], "hit", 3))
		{
			if (sample[17] == 'w') 
			{
				engfunc(EngFunc_EmitSound, id, channel,"skullshop/benzo/MTHitWall.wav", volume, attn, flags, pitch);
				return FMRES_SUPERCEDE;
			}
			else 
			{
				engfunc(EngFunc_EmitSound, id, channel, "skullshop/benzo/MTHit2.wav", volume, attn, flags, pitch);
				return FMRES_SUPERCEDE;
			}
		}
		if (equal(sample[14], "sta", 3)) 
		{
			engfunc(EngFunc_EmitSound, id, channel, "skullshop/benzo/MTStab.wav", volume, attn, flags, pitch);
			return FMRES_SUPERCEDE;
		}
	}
	if (w_machete[id] && equal(sample[8], "kni", 3))
	{
		volume = 0.6;
		
		if (equal(sample[14], "sla", 3))
		{
			engfunc(EngFunc_EmitSound, id, channel, "skullshop/machete/ESlash.wav", volume, attn, flags, pitch);
			return FMRES_SUPERCEDE;
		}
		if(equal(sample,"weapons/knife_deploy1.wav"))
		{
			engfunc(EngFunc_EmitSound, id, channel, "skullshop/machete/EConvoca.wav", volume, attn, flags, pitch);
			return FMRES_SUPERCEDE;
		}
		if (equal(sample[14], "hit", 3))
		{
			if (sample[17] == 'w') 
			{
				engfunc(EngFunc_EmitSound, id, channel,"skullshop/machete/EHitWall.wav", volume, attn, flags, pitch);
				return FMRES_SUPERCEDE;
			}
			else 
			{
				engfunc(EngFunc_EmitSound, id, channel, "skullshop/machete/EHit2.wav", volume, attn, flags, pitch);
				return FMRES_SUPERCEDE;
			}
		}
		if (equal(sample[14], "sta", 3)) 
		{
			engfunc(EngFunc_EmitSound, id, channel, "skullshop/machete/EStab.wav", volume, attn, flags, pitch);
			return FMRES_SUPERCEDE;
		}
	}
	return FMRES_IGNORED;
}

public Player_TakeDamage(victim, inflicator, attacker, Float:damage, damage_type, bitsDamage)
{
        if(is_user_connected(attacker) && get_user_weapon(attacker) != CSW_KNIFE)
		return;

        if(pev(attacker, pev_button) & IN_ATTACK && w_benzo[attacker])
	{
               if(get_user_team(attacker) == get_user_team(victim))
                                            return;

               SetHamParamFloat(4, damage = 500.0)
	}
	else if(pev(attacker, pev_button) & IN_ATTACK2 && w_benzo[attacker])
	{ 
               SetHamParamFloat(4, damage = 500.0)
	}

        if(pev(attacker, pev_button) & IN_ATTACK && w_electro[attacker])
	{
               if(get_user_team(attacker) == get_user_team(victim))
                                            return;

               SetHamParamFloat(4, damage = 50.0)
	}
	else if(pev(attacker, pev_button) & IN_ATTACK2 && w_electro[attacker])
	{ 
               SetHamParamFloat(4, damage = 50.0)
	}
}  

public Event_CurWeapon(player)
{
        if(!is_user_alive(player))
		return PLUGIN_CONTINUE

        if(read_data(2) == CSW_KNIFE && w_benzo[player])
	{
            set_pev(player, pev_viewmodel2, "models/skullshop/benzo/v_benzo.mdl")
	    set_pev(player, pev_weaponmodel2, "models/skullshop/benzo/p_benzo.mdl")
        }

        if(read_data(2) == CSW_KNIFE  && w_machete[player])
        {
            set_pev(player, pev_viewmodel2, "models/skullshop/Machete/v_Machete.mdl")
	    set_pev(player, pev_weaponmodel2, "models/skullshop/Machete/p_Machete.mdl")    
        }

        if(read_data(2) == CSW_KNIFE  && w_electro[player])
        {
            set_pev(player, pev_viewmodel2, "models/skullshop/electro/v_electro.mdl")
	    set_pev(player, pev_weaponmodel2, "models/skullshop/electro/p_electro.mdl")    
        }
	return PLUGIN_CONTINUE
}


public ShopMenu(id)
{
   if(get_user_team(id)==1)
   {
      new szText[ 555 char ];

      formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPT_TITLE");
      new vip_menu = menu_create( szText, "ShopMenuT_handler" );

      formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPT_ITEM_1" );
      menu_additem( vip_menu, szText, "1", 0 );

      formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPT_ITEM_2" );
      menu_additem( vip_menu, szText, "2", 0 );

      formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPT_ITEM_3" );
      menu_additem( vip_menu, szText, "3", 0 );

      formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPT_ITEM_4" );
      menu_additem( vip_menu, szText, "4", 0 );

      formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPT_ITEM_5" );
      menu_additem( vip_menu, szText, "5", 0 );

      formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPT_ITEM_6" );
      menu_additem( vip_menu, szText, "6", 0 );

      formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPT_ITEM_7" );
      menu_additem( vip_menu, szText, "7", 0 );

      formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPT_ITEM_8" );
      menu_additem( vip_menu, szText, "8", 0 );
	  
      menu_display( id, vip_menu, 0)
   }else
   if(get_user_team(id)==2)
   {
      new szText[ 555 char ];

      formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPCT_TITLE");
      new vip_menu = menu_create( szText, "ShopMenuCT_handler" );

      formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPCT_ITEM_1" );
      menu_additem( vip_menu, szText, "1", 0 );

      formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPCT_ITEM_2" );
      menu_additem( vip_menu, szText, "2", 0 );

      formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPCT_ITEM_3" );
      menu_additem( vip_menu, szText, "3", 0 );

      menu_display( id, vip_menu, 0)
   }
}

public ShopMenuT_handler( id, menu, item )
{
    if( item == MENU_EXIT )
    {
        menu_destroy( menu )
        return PLUGIN_HANDLED
    }
    new data[6], iName[64]
    new access, callback

    menu_item_getinfo( menu, item, access, data,5, iName, 63, callback )
    new key = str_to_num( data )
    switch( key )
    {
        case 1:
        {
            ShopMenuTequipment(id)
        }
        case 2:
        {
            ShopMenuTability(id)
        }
        case 3:
        {
            ShopMenuTequipmenty(id)
        }
        case 4:
	{
           if(cs_get_user_money(id)>=3200)
           {
               cherep[id] = cherep[id]+1
               cs_set_user_money(id, cs_get_user_money(id)-3200)
           }else{
                ChatColor(id, "%L",0,"NOT_MONEY")  
           }
        }
        case 5:
	{
           if(cs_get_user_money(id)>=6400)
           {
               cherep[id] = cherep[id]+2
               cs_set_user_money(id, cs_get_user_money(id)-6400)
           }else{
                ChatColor(id, "%L",0,"NOT_MONEY")  
           }
        }
        case 6:
	{
           if(cs_get_user_money(id)>=9600)
           {
               cherep[id] = cherep[id]+3
               cs_set_user_money(id, cs_get_user_money(id)-9600)
           }else{
                ChatColor(id, "%L",0,"NOT_MONEY")  
           }
        }
        case 7:
        {
           if(cs_get_user_money(id)>=12800)
           {
               cherep[id] = cherep[id]+4
               cs_set_user_money(id, cs_get_user_money(id)-12800)
           }else{
                ChatColor(id, "%L",0,"NOT_MONEY")  
           }
        }

        case 8:
        {
           if(cs_get_user_money(id)>=16000)
           {
               cherep[id] = cherep[id]+
               cs_set_user_money(id, cs_get_user_money(id)-16000)
           }else{
                ChatColor(id, "%L",0,"NOT_MONEY")  
           }
        }
    }
    menu_destroy( menu )
    return PLUGIN_HANDLED
} 

public ShopMenuTequipment(id)
{
      new szText[ 555 char ];

      formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPTE_TITLE");
      new vip_menu = menu_create( szText, "ShopMenuTequipment_handler" );

      formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPTE_ITEM_1" );
      menu_additem( vip_menu, szText, "1", 0 );

      formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPTE_ITEM_2" );
      menu_additem( vip_menu, szText, "2", 0 );

      formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPTE_ITEM_3" );
      menu_additem( vip_menu, szText, "3", 0 );

      formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPTE_ITEM_4" );
      menu_additem( vip_menu, szText, "4", 0 );

      formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPTE_ITEM_5" );
      menu_additem( vip_menu, szText, "5", 0 );

      formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPTE_ITEM_6" );
      menu_additem( vip_menu, szText, "6", 0 );

      formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPTE_ITEM_7" );
      menu_additem( vip_menu, szText, "7", 0 );

      menu_display( id, vip_menu, 0)
}

public ShopMenuTequipment_handler( id, menu, item )
{
    if( item == MENU_EXIT )
    {
        menu_destroy( menu )
        return PLUGIN_HANDLED
    }
    new data[6], iName[64]
    new access, callback

    menu_item_getinfo( menu, item, access, data,5, iName, 63, callback )
    new key = str_to_num( data )
    switch( key )
    {
        case 1:
        {
            if( is_user_alive(id))
            {
               if(cherep[id]>=6)
               {
                  engclient_cmd(id, "weapon_knife")
                  w_machete[id] = true
                  set_pev(id, pev_viewmodel2, "models/skullshop/Machete/v_Machete.mdl")
	          set_pev(id, pev_weaponmodel2, "models/skullshop/Machete/p_Machete.mdl")    
                  ChatColor(id, "%L",0,"YOUR_MACHETE")  
                  cherep[id]=cherep[id]-6
               }else{
                  ChatColor(id, "%L",0,"NOT_CHEREP")  
               }
            }else{
               ChatColor(id, "%L",0,"YOUR_DEAD")  
            }
        }
        case 2:
        {
            if(is_user_alive(id))
            {
               if(cherep[id]>=10)
               {
                  engclient_cmd(id, "weapon_knife")
                  w_benzo[id] = true
                  set_pev(id, pev_viewmodel2, "models/skullshop/benzo/v_benzo.mdl")
                  set_pev(id, pev_weaponmodel2, "models/skullshop/benzo/p_benzo.mdl")    
                  ChatColor(id, "%L",0,"YOUR_BENZO") 
                  cherep[id]=cherep[id]-10
               }else{
                  ChatColor(id, "%L",0,"NOT_CHEREP")  
               }
            }else{
               ChatColor(id, "%L",0,"YOUR_DEAD")  
            }
        }
        case 3:
        {
            if(is_user_alive(id))
            {
               if(cherep[id]>=16)
               {
                  entity_set_int(id, EV_INT_body, 7)
                  ChatColor(id, "%L",0,"YOUR_FD") 
                  cherep[id]=cherep[id]-16
                  return PLUGIN_HANDLED
               }else{
                  ChatColor(id, "%L",0,"NOT_CHEREP")  
               }
            }else{
               ChatColor(id, "%L",0,"YOUR_DEAD")  
            }
        }
        case 4:
	{
            if( is_user_alive(id))
            {
               if(cherep[id]>=4)
               {
                  give_item(id, "weapon_hegrenade")
                  give_item(id, "weapon_flashbang")
                  give_item(id, "weapon_flashbang")
                  give_item(id, "weapon_smokegrenade")
                  ChatColor(id, "%L",0,"YOUR_GRENADE")
                  cherep[id]=cherep[id]-4
               }else{
                  ChatColor(id, "%L",0,"NOT_CHEREP")  
               }
            }else{
               ChatColor(id, "%L",0,"YOUR_DEAD")  
            }
        }
        case 5:
	{
            if(is_user_alive(id))
	    {
               if(cherep[id]>=16)
               {
	          entity_set_int(id, EV_INT_body, 3)
                  ChatColor(id, "%L",0,"YOUR_MASK")
                  cherep[id]=cherep[id]-16
               }else{
                  ChatColor(id, "%L",0,"NOT_CHEREP")  
               }
            }else{
               ChatColor(id, "%L",0,"YOUR_DEAD")  
	    }
        }
        case 6:
	{
            if( is_user_alive(id))
            {
               if(cherep[id]>=8)
               {
                  give_item(id, "weapon_shield")
                  ChatColor(id, "%L",0,"YOUR_SHIELD")
                  cherep[id]=cherep[id]-8
               }else{
                  ChatColor(id, "%L",0,"NOT_CHEREP")  
               }
            }else{
               ChatColor(id, "%L",0,"YOUR_DEAD")  
            }
        }
        case 7:
        {
            if(is_user_alive(id))
            {
               if(cherep[id]>=10)
               {
                  client_cmd(id, "set_micro_cheper")
                  ChatColor(id, "%L",0,"YOUR_MICRO") 
                  cherep[id]=cherep[id]-10
                  return PLUGIN_HANDLED
               }else{
                  ChatColor(id, "%L",0,"NOT_CHEREP")  
               }
            }else{
               ChatColor(id, "%L",0,"YOUR_DEAD")  
            }
        }
    }
    menu_destroy( menu )
    return PLUGIN_HANDLED
} 

public ShopMenuTability(id)
{
      new szText[ 555 char ];

      formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPTA_TITLE");
      new vip_menu = menu_create( szText, "ShopMenuTability_handler" );

      formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPTA_ITEM_1" );
      menu_additem( vip_menu, szText, "1", 0 );

      formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPTA_ITEM_2" );
      menu_additem( vip_menu, szText, "2", 0 );

      formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPTA_ITEM_3" );
      menu_additem( vip_menu, szText, "3", 0 );

      formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPTA_ITEM_4" );
      menu_additem( vip_menu, szText, "4", 0 );

      menu_display( id, vip_menu, 0)
}

public ShopMenuTability_handler( id, menu, item )
{
    if( item == MENU_EXIT )
    {
        menu_destroy( menu )
        return PLUGIN_HANDLED
    }
    new data[6], iName[64]
    new access, callback

    menu_item_getinfo( menu, item, access, data,5, iName, 63, callback )
    new key = str_to_num( data )
    switch( key )
    {
        case 1:
        {
            if( is_user_alive(id))
            {
               if(cherep[id]>=16)
               {
                  set_user_gravity(id, 0.2)
                  ChatColor(id, "%L",0,"YOUR_GRAVITY")  
                  cherep[id]=cherep[id]-16
               }else{
                  ChatColor(id, "%L",0,"NOT_CHEREP")  
               }
            }else{
               ChatColor(id, "%L",0,"YOUR_DEAD")  
            }
        }
        case 2:
        {
            if(is_user_alive(id))
            {
               if(cherep[id]>=15)
               {
                  set_user_maxspeed(id, 0.7)
                  ChatColor(id, "%L",0,"YOUR_SPEED")  
                  cherep[id]=cherep[id]-15
               }else{
                  ChatColor(id, "%L",0,"NOT_CHEREP")  
               }
            }else{
               ChatColor(id, "%L",0,"YOUR_DEAD")  
            }
        }
        case 3:
        {
            if(is_user_alive(id))
            {
               if(cherep[id]>=14)
               {
                  set_user_health(id, 255)
                  ChatColor(id, "%L",0,"YOUR_HP") 
                  cherep[id]=cherep[id]-14
                  return PLUGIN_HANDLED
               }else{
                  ChatColor(id, "%L",0,"NOT_CHEREP")  
               }
            }else{
               ChatColor(id, "%L",0,"YOUR_DEAD")  
            }
        }
        case 4:
	{
            if( is_user_alive(id))
            {
               if(cherep[id]>=12)
               {
                  set_user_armor(id, 255)
                  ChatColor(id, "%L",0,"YOUR_ARMOR") 
                  cherep[id]=cherep[id]-12
               }else{
                  ChatColor(id, "%L",0,"NOT_CHEREP")  
               }
            }else{
               ChatColor(id, "%L",0,"YOUR_DEAD")  
            }
        }
    }
    menu_destroy( menu )
    return PLUGIN_HANDLED
} 

public ShopMenuTequipmenty(id)
{
      new szText[ 555 char ];

      formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPTEQ_TITLE");
      new vip_menu = menu_create( szText, "ShopMenuTequipmenty_handler" );

      formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPTEQ_ITEM_1" );
      menu_additem( vip_menu, szText, "1", 0 );

      formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPTEQ_ITEM_2" );
      menu_additem( vip_menu, szText, "2", 0 );

      formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPTEQ_ITEM_3" );
      menu_additem( vip_menu, szText, "3", 0 );

      menu_display( id, vip_menu, 0)
}   

public ShopMenuTequipmenty_handler( id, menu, item )
{
    if( item == MENU_EXIT )
    {
        menu_destroy( menu )
        return PLUGIN_HANDLED
    }
    new data[6], iName[64]
    new access, callback

    menu_item_getinfo( menu, item, access, data,5, iName, 63, callback )
    new key = str_to_num( data )
    switch( key )
    {
        case 1:
        {
            if( is_user_alive(id))
            {
               if(cherep[id]>=14)
               {
                  give_item(id, "weapon_glock18")
                  ChatColor(id, "%L",0,"YOUR_GLOCK")  
                  cherep[id]=cherep[id]-14
               }else{
                  ChatColor(id, "%L",0,"NOT_CHEREP")  
               }
            }else{
               ChatColor(id, "%L",0,"YOUR_DEAD")  
            }
        }
        case 2:
        {
            if(is_user_alive(id))
            {
               if(cherep[id]>=16)
               {
                  give_item(id, "weapon_tmp")
                  ChatColor(id, "%L",0,"YOUR_TMP")  
                  cherep[id]=cherep[id]-16
               }else{
                  ChatColor(id, "%L",0,"NOT_CHEREP")  
               }
            }else{
               ChatColor(id, "%L",0,"YOUR_DEAD")  
            }
        }
        case 3:
        {
            if(is_user_alive(id))
            {
               if(cherep[id]>=16)
               {
                  give_item(id, "weapon_deagle")
                  ChatColor(id, "%L",0,"YOUR_DEAGLE") 
                  cherep[id]=cherep[id]-14
               }else{
                  ChatColor(id, "%L",0,"NOT_CHEREP")  
               }
            }else{
               ChatColor(id, "%L",0,"YOUR_DEAD")  
            }
        }
    }
    menu_destroy( menu )
    return PLUGIN_HANDLED
} 

public bacon_PlayerPreThink( id )
{
	if( is_user_alive( id ) && !is_user_bot( id ) && get_user_team(id) == 1)
	{
		new Float:flGameTime = get_gametime ( );
           
		if( flGameTime - HudTime[ id ] >= 1.2 )
		{
			HudTime[ id ] = flGameTime;
                        set_hudmessage( 255, 105, 0, -1.1, 0.60, 0, 6.0, 1.2);
                        show_hudmessage(id,  "%L", 0, "SKULLS", cherep[id]);  
		}
	}
}

public ShopMenuCT_handler( id, menu, item )
{
    if( item == MENU_EXIT )
    {
        menu_destroy( menu )
        return PLUGIN_HANDLED
    }
    new data[6], iName[64]
    new access, callback

    menu_item_getinfo( menu, item, access, data,5, iName, 63, callback )
    new key = str_to_num( data )
    switch( key )
    {
        case 1:
        {
            if( is_user_alive(id))
            {
               if(cs_get_user_money(id)>=6000)
               {
                  engclient_cmd(id, "weapon_knife")
                  w_electro[id] = true
                  set_pev(id, pev_viewmodel2, "models/skullshop/electro/v_electro.mdl")
	          set_pev(id, pev_weaponmodel2, "models/skullshop/electro/p_electro.mdl")    
                  ChatColor(id, "%L",0,"YOUR_ELECTRO")  
                  cs_set_user_money(id, cs_get_user_money(id)-6000)
               }else{
                  ChatColor(id, "%L",0,"NOT_MONEY")  
               }
            }else{
               ChatColor(id, "%L",0,"YOUR_DEAD")  
            }
        }
        case 2:
        {
            if( is_user_alive(id))
            {
               if(cs_get_user_money(id)>=16000)
               {
                  set_user_rendering( id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 0 )
                  ChatColor(id, "%L",0,"YOUR_INVIS")  
                  cs_set_user_money(id, cs_get_user_money(id)-16000)
               }else{
                  ChatColor(id, "%L",0,"NOT_MONEY")  
               }
            }else{
               ChatColor(id, "%L",0,"YOUR_DEAD")  
            }
        }
        case 3:
	{
            if( is_user_alive(id))
            {
               if(cs_get_user_money(id)>=6000)
               {
                  set_user_maxspeed(id, 700.0)
                  ChatColor(id, "%L",0,"YOUR_SPEED")  
                  cs_set_user_money(id, cs_get_user_money(id)-16000)
               }else{
                  ChatColor(id, "%L",0,"NOT_MONEY")  
               }
            }else{
               ChatColor(id, "%L",0,"YOUR_DEAD")  
            }
        }
    }
    menu_destroy( menu )
    return PLUGIN_HANDLED
}


Nickname: QAZW.
Numele pluginului cerut: -.
Descriere plugin cerut: Vreau sa adaugati comanda amx_give_skulls (sa pot da cranii altor jucatori). Sa aiba acces doar cei cu flagul a.
Alte informatii: -.
Last edited by roberteeel on 01 Mar 2014, 13:35, edited 1 time in total.
RoyalServer
User avatar
-Turbo-
Membru, skill +4
Membru, skill +4
Posts: 1664
Joined: 11 Nov 2012, 01:28
Detinator Steam: Da
CS Status: Bored !
Detinator server CS: Da
SteamID: kingforbidden
Reputatie: Utilizator neserios ( tepar )
Restrictie moderator
Ban scos ( achitat )
Nume anterior: Turbo19973
Location: Botosani
Has thanked: 49 times
Been thanked: 212 times

01 Mar 2014, 12:49

| Afiseaza codul
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <hamsandwich>
#include <engine>
#include <cstrike>
#include <fun>
#include <nvault>

#define PLUGIN "Skullshop" 
#define VERSION "1.0" 
#define AUTHOR "Crash94"

new const g_szGiveSkullsFlag[ ] = "a";
new const g_szTag[ ] = "[SKULLS]";
new g_szName[ 33 ][ 32 ];
new iVault;

enum _: iCoinSequences
{
          CoinIdle = 0,
          CoinFloat,
          CoinSpin
};


new const gCoinModel[ ] = "models/skullshop/skull.mdl";

new cherep[33], w_machete[33], w_benzo[33], w_electro[33]
new Float:HudTime[33]

new const gCoinClassname[ ] = "cherep$";

public plugin_init()   
{ 
	register_plugin(PLUGIN, VERSION, AUTHOR)   
	
	register_event( "DeathMsg", "Hook_DeathMessage", "a" );
	register_touch( gCoinClassname, "player", "Forward_TouchCoin" );
	register_forward(FM_EmitSound, "fw_EmitSound")
	register_event("CurWeapon", "Event_CurWeapon", "be", "1=1")
	RegisterHam(Ham_TakeDamage, "player", "Player_TakeDamage")
	RegisterHam(Ham_Spawn, "player", "Spawn_player", 1)
	RegisterHam( Ham_Player_PreThink, "player", "bacon_PlayerPreThink" );
	
	register_clcmd( "amx_give_skulls", "GiveSkulls" );
	register_clcmd( "amx_remove_skulls", "TakeSkulls" );
	
	register_clcmd("say /skullshop", "ShopMenu")
	register_clcmd("say_team /skullshop", "ShopMenu")
	register_clcmd("say /shop", "ShopMenu")
	
	
	register_dictionary( "skullshop.txt" );
	
	iVault  =  nvault_open(  "SkullSystem"  );
	
	if(  iVault  ==  INVALID_HANDLE  )
	{
		set_fail_state(  "nValut returned invalid handle!"  );
	}
}  

public Spawn_player(id)
{
	if(is_user_alive(id) && is_user_connected(id))
	{
		w_machete[id] = false
		w_benzo[id] = false
		++cherep[id]
	}
}

public client_connect( id )
{
	cherep[id] = 2
}
public client_authorized( id )
{
	if( is_user_bot( id ) )
		return 0;
		
	get_user_name( id, g_szName[ id ], sizeof ( g_szName[] ) -1 );
	LoadSkulls( id );
	return 0;
	
}

public client_disconnect( id )
{
	if( is_user_bot( id ) )
		return 0;
		
	SaveSkulls( id );
	
	return 0;
	
}

public plugin_precache( )
{
	precache_model( gCoinModel );
	precache_model( "models/skullshop/benzo/v_benzo.mdl" )
	precache_model( "models/skullshop/benzo/p_benzo.mdl" )
	precache_model( "models/skullshop/Machete/v_Machete.mdl" )
	precache_model( "models/skullshop/Machete/p_Machete.mdl" )
	precache_model( "models/skullshop/electro/v_electro.mdl" )
	precache_model( "models/skullshop/electro/p_electro.mdl" )
	precache_sound("skullshop/pickup_sound.wav")
	precache_sound("skullshop/benzo/MTSlash.wav")
	precache_sound("skullshop/benzo/MTConvoca.wav")
	precache_sound("skullshop/benzo/MTHitWall.wav")
	precache_sound("skullshop/benzo/MTHit2.wav")
	precache_sound("skullshop/benzo/MTStab.wav")
	precache_sound("skullshop/machete/EConvoca.wav")
	precache_sound("skullshop/machete/EHitWall.wav")
	precache_sound("skullshop/machete/EHit2.wav")
	precache_sound("skullshop/machete/ESlash.wav")
	precache_sound("skullshop/machete/EStab.wav")
}

public Hook_DeathMessage( )
{
	new iVictim = read_data( 2 );
	
	if( read_data( 1 ) == iVictim )
	{
		return;
	}
	
	new Float:flPlayerOrigin[ 3 ];
	pev( iVictim, pev_origin, flPlayerOrigin );
	
	flPlayerOrigin[ 2 ] += 4.0;
	
	new iEntity = create_entity( "info_target" );
	
	if( !pev_valid( iEntity ) )
	{
		return;
	}
	
	if(get_user_team(iVictim) == 2)
	{
		engfunc( EngFunc_SetOrigin, iEntity, flPlayerOrigin )
		set_pev( iEntity, pev_classname, gCoinClassname );
		engfunc( EngFunc_SetModel, iEntity, gCoinModel );
		set_pev( iEntity, pev_solid, SOLID_SLIDEBOX );
		set_pev( iEntity, pev_movetype, MOVETYPE_NONE );
		set_pev( iEntity, pev_framerate, 1.0 );
		set_pev( iEntity, pev_sequence, CoinFloat );
		engfunc( EngFunc_SetSize, iEntity, Float:{ -10.0, -10.0, -10.0 }, Float:{ 10.0, 10.0, 10.0 } );
		engfunc( EngFunc_DropToFloor, iEntity );
		set_pev( iEntity, pev_nextthink, get_gametime( ) + 1.0 );
		set_rendering( iEntity, kRenderFxGlowShell, (random_num(1, 255)),  (random_num(1, 255)),  (random_num(1, 255)), kRenderNormal, 75 );
	}
}

public Forward_TouchCoin( iEntity, id )
{
	if( pev_valid( iEntity ) && get_user_team(id) ==1)
	{
		++cherep[ id ]
		client_cmd(0, "spk skullshop/pickup_sound.wav")
		set_pev( iEntity, pev_flags, FL_KILLME );
	}
	
	return PLUGIN_CONTINUE;
}

public fw_EmitSound(id, channel, const sample[], Float:volume, Float:attn, flags, pitch)
{
	if (!is_user_connected(id))
		return FMRES_IGNORED;
	
	if (w_benzo[id] && equal(sample[8], "kni", 3))
	{
		volume = 0.6;
		
		if (equal(sample[14], "sla", 3))
		{
			engfunc(EngFunc_EmitSound, id, channel, "skullshop/benzo/MTSlash.wav", volume, attn, flags, pitch);
			return FMRES_SUPERCEDE;
		}
		if(equal(sample,"weapons/knife_deploy1.wav"))
		{
			engfunc(EngFunc_EmitSound, id, channel, "skullshop/benzo/MTConvoca.wav", volume, attn, flags, pitch);
			return FMRES_SUPERCEDE;
		}
		if (equal(sample[14], "hit", 3))
		{
			if (sample[17] == 'w') 
			{
				engfunc(EngFunc_EmitSound, id, channel,"skullshop/benzo/MTHitWall.wav", volume, attn, flags, pitch);
				return FMRES_SUPERCEDE;
			}
			else 
			{
				engfunc(EngFunc_EmitSound, id, channel, "skullshop/benzo/MTHit2.wav", volume, attn, flags, pitch);
				return FMRES_SUPERCEDE;
			}
		}
		if (equal(sample[14], "sta", 3)) 
		{
			engfunc(EngFunc_EmitSound, id, channel, "skullshop/benzo/MTStab.wav", volume, attn, flags, pitch);
			return FMRES_SUPERCEDE;
		}
	}
	if (w_machete[id] && equal(sample[8], "kni", 3))
	{
		volume = 0.6;
		
		if (equal(sample[14], "sla", 3))
		{
			engfunc(EngFunc_EmitSound, id, channel, "skullshop/machete/ESlash.wav", volume, attn, flags, pitch);
			return FMRES_SUPERCEDE;
		}
		if(equal(sample,"weapons/knife_deploy1.wav"))
		{
			engfunc(EngFunc_EmitSound, id, channel, "skullshop/machete/EConvoca.wav", volume, attn, flags, pitch);
			return FMRES_SUPERCEDE;
		}
		if (equal(sample[14], "hit", 3))
		{
			if (sample[17] == 'w') 
			{
				engfunc(EngFunc_EmitSound, id, channel,"skullshop/machete/EHitWall.wav", volume, attn, flags, pitch);
				return FMRES_SUPERCEDE;
			}
			else 
			{
				engfunc(EngFunc_EmitSound, id, channel, "skullshop/machete/EHit2.wav", volume, attn, flags, pitch);
				return FMRES_SUPERCEDE;
			}
		}
		if (equal(sample[14], "sta", 3)) 
		{
			engfunc(EngFunc_EmitSound, id, channel, "skullshop/machete/EStab.wav", volume, attn, flags, pitch);
			return FMRES_SUPERCEDE;
		}
	}
	return FMRES_IGNORED;
}

public Player_TakeDamage(victim, inflicator, attacker, Float:damage, damage_type, bitsDamage)
{
	if(is_user_connected(attacker) && get_user_weapon(attacker) != CSW_KNIFE)
		return;
	
	if(pev(attacker, pev_button) & IN_ATTACK && w_benzo[attacker])
	{
		if(get_user_team(attacker) == get_user_team(victim))
			return;
		
		SetHamParamFloat(4, damage = 500.0)
	}
	else if(pev(attacker, pev_button) & IN_ATTACK2 && w_benzo[attacker])
	{ 
		SetHamParamFloat(4, damage = 500.0)
	}
	
	if(pev(attacker, pev_button) & IN_ATTACK && w_electro[attacker])
	{
		if(get_user_team(attacker) == get_user_team(victim))
			return;
		
		SetHamParamFloat(4, damage = 50.0)
	}
	else if(pev(attacker, pev_button) & IN_ATTACK2 && w_electro[attacker])
	{ 
		SetHamParamFloat(4, damage = 50.0)
	}
}  

public Event_CurWeapon(player)
{
	if(!is_user_alive(player))
		return PLUGIN_CONTINUE
	
	if(read_data(2) == CSW_KNIFE && w_benzo[player])
	{
		set_pev(player, pev_viewmodel2, "models/skullshop/benzo/v_benzo.mdl")
		set_pev(player, pev_weaponmodel2, "models/skullshop/benzo/p_benzo.mdl")
	}
	
	if(read_data(2) == CSW_KNIFE  && w_machete[player])
	{
		set_pev(player, pev_viewmodel2, "models/skullshop/Machete/v_Machete.mdl")
		set_pev(player, pev_weaponmodel2, "models/skullshop/Machete/p_Machete.mdl")    
	}
	
	if(read_data(2) == CSW_KNIFE  && w_electro[player])
	{
		set_pev(player, pev_viewmodel2, "models/skullshop/electro/v_electro.mdl")
		set_pev(player, pev_weaponmodel2, "models/skullshop/electro/p_electro.mdl")    
	}
	return PLUGIN_CONTINUE
}


public ShopMenu(id)
{
	if(get_user_team(id)==1)
	{
		new szText[ 555 char ];
		
		formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPT_TITLE");
		new vip_menu = menu_create( szText, "ShopMenuT_handler" );
		
		formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPT_ITEM_1" );
		menu_additem( vip_menu, szText, "1", 0 );
		
		formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPT_ITEM_2" );
		menu_additem( vip_menu, szText, "2", 0 );
		
		formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPT_ITEM_3" );
		menu_additem( vip_menu, szText, "3", 0 );
		
		formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPT_ITEM_4" );
		menu_additem( vip_menu, szText, "4", 0 );
		
		formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPT_ITEM_5" );
		menu_additem( vip_menu, szText, "5", 0 );
		
		formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPT_ITEM_6" );
		menu_additem( vip_menu, szText, "6", 0 );
		
		formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPT_ITEM_7" );
		menu_additem( vip_menu, szText, "7", 0 );
		
		formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPT_ITEM_8" );
		menu_additem( vip_menu, szText, "8", 0 );
		
		menu_display( id, vip_menu, 0)
	}else
	if(get_user_team(id)==2)
	{
		new szText[ 555 char ];
		
		formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPCT_TITLE");
		new vip_menu = menu_create( szText, "ShopMenuCT_handler" );
		
		formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPCT_ITEM_1" );
		menu_additem( vip_menu, szText, "1", 0 );
		
		formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPCT_ITEM_2" );
		menu_additem( vip_menu, szText, "2", 0 );
		
		formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPCT_ITEM_3" );
		menu_additem( vip_menu, szText, "3", 0 );
		
		menu_display( id, vip_menu, 0)
	}
}

public ShopMenuT_handler( id, menu, item )
{
	if( item == MENU_EXIT )
	{
		menu_destroy( menu )
		return PLUGIN_HANDLED
	}
	new data[6], iName[64]
	new access, callback
	
	menu_item_getinfo( menu, item, access, data,5, iName, 63, callback )
	new key = str_to_num( data )
	switch( key )
	{
		case 1:
		{
			ShopMenuTequipment(id)
		}
		case 2:
		{
			ShopMenuTability(id)
		}
		case 3:
		{
			ShopMenuTequipmenty(id)
		}
		case 4:
		{
			if(cs_get_user_money(id)>=3200)
			{
				cherep[id] = cherep[id]+1
				cs_set_user_money(id, cs_get_user_money(id)-3200)
				}else{
				ChatColor(id, "%L",0,"NOT_MONEY")  
			}
		}
		case 5:
		{
			if(cs_get_user_money(id)>=6400)
			{
				cherep[id] = cherep[id]+2
				cs_set_user_money(id, cs_get_user_money(id)-6400)
				}else{
				ChatColor(id, "%L",0,"NOT_MONEY")  
			}
		}
		case 6:
		{
			if(cs_get_user_money(id)>=9600)
			{
				cherep[id] = cherep[id]+3
				cs_set_user_money(id, cs_get_user_money(id)-9600)
				}else{
				ChatColor(id, "%L",0,"NOT_MONEY")  
			}
		}
		case 7:
		{
			if(cs_get_user_money(id)>=12800)
			{
				cherep[id] = cherep[id]+4
				cs_set_user_money(id, cs_get_user_money(id)-12800)
				}else{
				ChatColor(id, "%L",0,"NOT_MONEY")  
			}
		}
		
		case 8:
		{
			if(cs_get_user_money(id)>=16000)
			{
				cherep[id] = cherep[id]+
				cs_set_user_money(id, cs_get_user_money(id)-16000)
				}else{
				ChatColor(id, "%L",0,"NOT_MONEY")  
			}
		}
	}
	menu_destroy( menu )
	return PLUGIN_HANDLED
} 

public ShopMenuTequipment(id)
{
	new szText[ 555 char ];
	
	formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPTE_TITLE");
	new vip_menu = menu_create( szText, "ShopMenuTequipment_handler" );
	
	formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPTE_ITEM_1" );
	menu_additem( vip_menu, szText, "1", 0 );
	
	formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPTE_ITEM_2" );
	menu_additem( vip_menu, szText, "2", 0 );
	
	formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPTE_ITEM_3" );
	menu_additem( vip_menu, szText, "3", 0 );
	
	formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPTE_ITEM_4" );
	menu_additem( vip_menu, szText, "4", 0 );
	
	formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPTE_ITEM_5" );
	menu_additem( vip_menu, szText, "5", 0 );
	
	formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPTE_ITEM_6" );
	menu_additem( vip_menu, szText, "6", 0 );
	
	formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPTE_ITEM_7" );
	menu_additem( vip_menu, szText, "7", 0 );
	
	menu_display( id, vip_menu, 0)
}

public ShopMenuTequipment_handler( id, menu, item )
{
	if( item == MENU_EXIT )
	{
		menu_destroy( menu )
		return PLUGIN_HANDLED
	}
	new data[6], iName[64]
	new access, callback
	
	menu_item_getinfo( menu, item, access, data,5, iName, 63, callback )
	new key = str_to_num( data )
	switch( key )
	{
		case 1:
		{
			if( is_user_alive(id))
			{
				if(cherep[id]>=6)
				{
					engclient_cmd(id, "weapon_knife")
					w_machete[id] = true
					set_pev(id, pev_viewmodel2, "models/skullshop/Machete/v_Machete.mdl")
					set_pev(id, pev_weaponmodel2, "models/skullshop/Machete/p_Machete.mdl")    
					ChatColor(id, "%L",0,"YOUR_MACHETE")  
					cherep[id]=cherep[id]-6
					}else{
					ChatColor(id, "%L",0,"NOT_CHEREP")  
				}
				}else{
				ChatColor(id, "%L",0,"YOUR_DEAD")  
			}
		}
		case 2:
		{
			if(is_user_alive(id))
			{
				if(cherep[id]>=10)
				{
					engclient_cmd(id, "weapon_knife")
					w_benzo[id] = true
					set_pev(id, pev_viewmodel2, "models/skullshop/benzo/v_benzo.mdl")
					set_pev(id, pev_weaponmodel2, "models/skullshop/benzo/p_benzo.mdl")    
					ChatColor(id, "%L",0,"YOUR_BENZO") 
					cherep[id]=cherep[id]-10
					}else{
					ChatColor(id, "%L",0,"NOT_CHEREP")  
				}
				}else{
				ChatColor(id, "%L",0,"YOUR_DEAD")  
			}
		}
		case 3:
		{
			if(is_user_alive(id))
			{
				if(cherep[id]>=16)
				{
					entity_set_int(id, EV_INT_body, 7)
					ChatColor(id, "%L",0,"YOUR_FD") 
					cherep[id]=cherep[id]-16
					return PLUGIN_HANDLED
					}else{
					ChatColor(id, "%L",0,"NOT_CHEREP")  
				}
				}else{
				ChatColor(id, "%L",0,"YOUR_DEAD")  
			}
		}
		case 4:
		{
			if( is_user_alive(id))
			{
				if(cherep[id]>=4)
				{
					give_item(id, "weapon_hegrenade")
					give_item(id, "weapon_flashbang")
					give_item(id, "weapon_flashbang")
					give_item(id, "weapon_smokegrenade")
					ChatColor(id, "%L",0,"YOUR_GRENADE")
					cherep[id]=cherep[id]-4
					}else{
					ChatColor(id, "%L",0,"NOT_CHEREP")  
				}
				}else{
				ChatColor(id, "%L",0,"YOUR_DEAD")  
			}
		}
		case 5:
		{
			if(is_user_alive(id))
			{
				if(cherep[id]>=16)
				{
					entity_set_int(id, EV_INT_body, 3)
					ChatColor(id, "%L",0,"YOUR_MASK")
					cherep[id]=cherep[id]-16
					}else{
					ChatColor(id, "%L",0,"NOT_CHEREP")  
				}
				}else{
				ChatColor(id, "%L",0,"YOUR_DEAD")  
			}
		}
		case 6:
		{
			if( is_user_alive(id))
			{
				if(cherep[id]>=8)
				{
					give_item(id, "weapon_shield")
					ChatColor(id, "%L",0,"YOUR_SHIELD")
					cherep[id]=cherep[id]-8
					}else{
					ChatColor(id, "%L",0,"NOT_CHEREP")  
				}
				}else{
				ChatColor(id, "%L",0,"YOUR_DEAD")  
			}
		}
		case 7:
		{
			if(is_user_alive(id))
			{
				if(cherep[id]>=10)
				{
					client_cmd(id, "set_micro_cheper")
					ChatColor(id, "%L",0,"YOUR_MICRO") 
					cherep[id]=cherep[id]-10
					return PLUGIN_HANDLED
					}else{
					ChatColor(id, "%L",0,"NOT_CHEREP")  
				}
				}else{
				ChatColor(id, "%L",0,"YOUR_DEAD")  
			}
		}
	}
	menu_destroy( menu )
	return PLUGIN_HANDLED
} 

public ShopMenuTability(id)
{
	new szText[ 555 char ];
	
	formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPTA_TITLE");
	new vip_menu = menu_create( szText, "ShopMenuTability_handler" );
	
	formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPTA_ITEM_1" );
	menu_additem( vip_menu, szText, "1", 0 );
	
	formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPTA_ITEM_2" );
	menu_additem( vip_menu, szText, "2", 0 );
	
	formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPTA_ITEM_3" );
	menu_additem( vip_menu, szText, "3", 0 );
	
	formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPTA_ITEM_4" );
	menu_additem( vip_menu, szText, "4", 0 );
	
	menu_display( id, vip_menu, 0)
}

public ShopMenuTability_handler( id, menu, item )
{
	if( item == MENU_EXIT )
	{
		menu_destroy( menu )
		return PLUGIN_HANDLED
	}
	new data[6], iName[64]
	new access, callback
	
	menu_item_getinfo( menu, item, access, data,5, iName, 63, callback )
	new key = str_to_num( data )
	switch( key )
	{
		case 1:
		{
			if( is_user_alive(id))
			{
				if(cherep[id]>=16)
				{
					set_user_gravity(id, 0.2)
					ChatColor(id, "%L",0,"YOUR_GRAVITY")  
					cherep[id]=cherep[id]-16
					}else{
					ChatColor(id, "%L",0,"NOT_CHEREP")  
				}
				}else{
				ChatColor(id, "%L",0,"YOUR_DEAD")  
			}
		}
		case 2:
		{
			if(is_user_alive(id))
			{
				if(cherep[id]>=15)
				{
					set_user_maxspeed(id, 0.7)
					ChatColor(id, "%L",0,"YOUR_SPEED")  
					cherep[id]=cherep[id]-15
					}else{
					ChatColor(id, "%L",0,"NOT_CHEREP")  
				}
				}else{
				ChatColor(id, "%L",0,"YOUR_DEAD")  
			}
		}
		case 3:
		{
			if(is_user_alive(id))
			{
				if(cherep[id]>=14)
				{
					set_user_health(id, 255)
					ChatColor(id, "%L",0,"YOUR_HP") 
					cherep[id]=cherep[id]-14
					return PLUGIN_HANDLED
					}else{
					ChatColor(id, "%L",0,"NOT_CHEREP")  
				}
				}else{
				ChatColor(id, "%L",0,"YOUR_DEAD")  
			}
		}
		case 4:
		{
			if( is_user_alive(id))
			{
				if(cherep[id]>=12)
				{
					set_user_armor(id, 255)
					ChatColor(id, "%L",0,"YOUR_ARMOR") 
					cherep[id]=cherep[id]-12
					}else{
					ChatColor(id, "%L",0,"NOT_CHEREP")  
				}
				}else{
				ChatColor(id, "%L",0,"YOUR_DEAD")  
			}
		}
	}
	menu_destroy( menu )
	return PLUGIN_HANDLED
} 

public ShopMenuTequipmenty(id)
{
	new szText[ 555 char ];
	
	formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPTEQ_TITLE");
	new vip_menu = menu_create( szText, "ShopMenuTequipmenty_handler" );
	
	formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPTEQ_ITEM_1" );
	menu_additem( vip_menu, szText, "1", 0 );
	
	formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPTEQ_ITEM_2" );
	menu_additem( vip_menu, szText, "2", 0 );
	
	formatex( szText, charsmax( szText ), "%L", id, "MAIN_SHOPTEQ_ITEM_3" );
	menu_additem( vip_menu, szText, "3", 0 );
	
	menu_display( id, vip_menu, 0)
}   

public ShopMenuTequipmenty_handler( id, menu, item )
{
	if( item == MENU_EXIT )
	{
		menu_destroy( menu )
		return PLUGIN_HANDLED
	}
	new data[6], iName[64]
	new access, callback
	
	menu_item_getinfo( menu, item, access, data,5, iName, 63, callback )
	new key = str_to_num( data )
	switch( key )
	{
		case 1:
		{
			if( is_user_alive(id))
			{
				if(cherep[id]>=14)
				{
					give_item(id, "weapon_glock18")
					ChatColor(id, "%L",0,"YOUR_GLOCK")  
					cherep[id]=cherep[id]-14
					}else{
					ChatColor(id, "%L",0,"NOT_CHEREP")  
				}
				}else{
				ChatColor(id, "%L",0,"YOUR_DEAD")  
			}
		}
		case 2:
		{
			if(is_user_alive(id))
			{
				if(cherep[id]>=16)
				{
					give_item(id, "weapon_tmp")
					ChatColor(id, "%L",0,"YOUR_TMP")  
					cherep[id]=cherep[id]-16
					}else{
					ChatColor(id, "%L",0,"NOT_CHEREP")  
				}
				}else{
				ChatColor(id, "%L",0,"YOUR_DEAD")  
			}
		}
		case 3:
		{
			if(is_user_alive(id))
			{
				if(cherep[id]>=16)
				{
					give_item(id, "weapon_deagle")
					ChatColor(id, "%L",0,"YOUR_DEAGLE") 
					cherep[id]=cherep[id]-14
					}else{
					ChatColor(id, "%L",0,"NOT_CHEREP")  
				}
				}else{
				ChatColor(id, "%L",0,"YOUR_DEAD")  
			}
		}
	}
	menu_destroy( menu )
	return PLUGIN_HANDLED
} 

public bacon_PlayerPreThink( id )
{
	if( is_user_alive( id ) && !is_user_bot( id ) && get_user_team(id) == 1)
	{
		new Float:flGameTime = get_gametime ( );
		
		if( flGameTime - HudTime[ id ] >= 1.2 )
		{
			HudTime[ id ] = flGameTime;
			set_hudmessage( 255, 105, 0, -1.1, 0.60, 0, 6.0, 1.2);
			show_hudmessage(id,  "%L", 0, "SKULLS", cherep[id]);  
		}
	}
}

public ShopMenuCT_handler( id, menu, item )
{
	if( item == MENU_EXIT )
	{
		menu_destroy( menu )
		return PLUGIN_HANDLED
	}
	new data[6], iName[64]
	new access, callback
	
	menu_item_getinfo( menu, item, access, data,5, iName, 63, callback )
	new key = str_to_num( data )
	switch( key )
	{
		case 1:
		{
			if( is_user_alive(id))
			{
				if(cs_get_user_money(id)>=6000)
				{
					engclient_cmd(id, "weapon_knife")
					w_electro[id] = true
					set_pev(id, pev_viewmodel2, "models/skullshop/electro/v_electro.mdl")
					set_pev(id, pev_weaponmodel2, "models/skullshop/electro/p_electro.mdl")    
					ChatColor(id, "%L",0,"YOUR_ELECTRO")  
					cs_set_user_money(id, cs_get_user_money(id)-6000)
					}else{
					ChatColor(id, "%L",0,"NOT_MONEY")  
				}
				}else{
				ChatColor(id, "%L",0,"YOUR_DEAD")  
			}
		}
		case 2:
		{
			if( is_user_alive(id))
			{
				if(cs_get_user_money(id)>=16000)
				{
					set_user_rendering( id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 0 )
					ChatColor(id, "%L",0,"YOUR_INVIS")  
					cs_set_user_money(id, cs_get_user_money(id)-16000)
					}else{
					ChatColor(id, "%L",0,"NOT_MONEY")  
				}
				}else{
				ChatColor(id, "%L",0,"YOUR_DEAD")  
			}
		}
		case 3:
		{
			if( is_user_alive(id))
			{
				if(cs_get_user_money(id)>=6000)
				{
					set_user_maxspeed(id, 700.0)
					ChatColor(id, "%L",0,"YOUR_SPEED")  
					cs_set_user_money(id, cs_get_user_money(id)-16000)
					}else{
					ChatColor(id, "%L",0,"NOT_MONEY")  
				}
				}else{
				ChatColor(id, "%L",0,"YOUR_DEAD")  
			}
		}
	}
	menu_destroy( menu )
	return PLUGIN_HANDLED
}
stock ChatColor(const id, const input[], any:...)
{
	new count = 1, players[32]
	static msg[191]
	vformat(msg, 190, input, 3)
	
	replace_all(msg, 190, "!g", "^4")
	replace_all(msg, 190, "!y", "^1")
	replace_all(msg, 190, "!team", "^3")
	
	if (id) players[0] = id; else get_players(players, count, "ch")
        {
	for (new i = 0; i < count; i++)
	{
		if (is_user_connected(players))
		{
			message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players);
			write_byte(players);
			write_string(msg);
			message_end();
		}
	}
}
}

public GiveSkulls( id )
{
	
	if( !( get_user_flags( id ) & read_flags( g_szGiveSkullsFlag ) ) )
	{
		client_cmd( id, "echo NU ai acces la aceasta comanda!" );
		return 1;
	}
	
	new szFirstArg[ 32 ], szSecondArg[ 10 ];
	
	read_argv( 1, szFirstArg, sizeof ( szFirstArg ) -1 );
	read_argv( 2, szSecondArg, sizeof ( szSecondArg ) -1 );
	
	if( equal( szFirstArg, "" ) || equal( szSecondArg, "" ) )
	{
		client_cmd( id, "echo amx_give_skulls < nume/ @ALL/ @T/ @CT > < skulls >" );
		return 1;
	}
	
	new iPlayers[ 32 ];
	new iPlayersNum;
	
	new iSkulls = str_to_num( szSecondArg );
	if( iSkulls <= 0 )
	{
		client_cmd( id, "echo Valoare craniilor trebuie sa fie mai mare decat 0!" );
		return 1;
	}
	
	if( szFirstArg[ 0 ] == '@' )
	{
		
		switch ( szFirstArg[ 1 ] )
		{
			case 'A':
			{
				if( equal( szFirstArg, "@ALL" ) )
				{
					
					get_players( iPlayers, iPlayersNum, "ch" );
					for( new i = 0; i < iPlayersNum ; i++ )
						cherep[ iPlayers[ i ] ] += iSkulls;
						
					new szName[ 32 ];
					get_user_name( id, szName, sizeof ( szName ) -1 );
					ChatColor( 0,"^x04^%s^x01 Adminul^x03 %s^x01 le-a dat^x03 %i^x01 skulls tuturor jucatorilor!", g_szTag, szName, iSkulls );
					return 1;
				}
			}
			
			case 'T':
			{
				if( equal( szFirstArg, "@T" ) )
				{
					
					get_players( iPlayers, iPlayersNum, "ceh", "TERRORIST" );
					if( iPlayersNum == 0 )
					{
						client_cmd( id, "echo NU se afla niciun jucator in aceasta echipa!" );
						return 1;
					}
					for( new i = 0; i < iPlayersNum ; i++ )
						cherep[ iPlayers[ i ] ] += iSkulls;
						
					new szName[ 32 ];
					get_user_name( id, szName, sizeof ( szName ) -1 );
					ChatColor( 0,"^x04^%s^x01 Adminul^x03 %s^x01 le-a dat^x03 %i^x01 credite jucatorilor de la^x03 TERO^x01!", g_szTag, szName, iSkulls );
					return 1;
				}
			}
			
			case 'C':
			{
				if( equal( szFirstArg, "@CT" ) )
				{
					
					get_players( iPlayers, iPlayersNum, "ceh", "CT" );
					if( iPlayersNum == 0 )
					{
						client_cmd( id, "echo NU se afla niciun jucator in aceasta echipa!" );
						return 1;
					}
					for( new i = 0; i < iPlayersNum ; i++ )
						cherep[ iPlayers[ i ] ] += iSkulls;
						
					new szName[ 32 ];
					get_user_name( id, szName, sizeof ( szName ) -1 );
					ChatColor( 0, "^x04^%s^x01 Adminul^x03 %s^x01 le-a dat^x03 %i^x01 skulls jucatorilor de la^x03 CT^x01!", g_szTag, szName, iSkulls );
					return 1;
				}
			}
		}
	}
		
	new iPlayer = cmd_target( id, szFirstArg, 8 );
	if( !iPlayer )
	{
		client_cmd( id, "echo Jucatorul %s nu a fost gasit!", szFirstArg );
		return 1;
	}
	
	cherep[ iPlayer ] += iSkulls;
	
	new szName[ 32 ], _szName[ 32 ];
	get_user_name( id, szName, sizeof ( szName ) -1 );
	get_user_name( id, _szName, sizeof ( _szName ) -1 );
	
	ChatColor( 0, "^x04%s^x01 Adminul^x03 %s^x01 i-a dat^x03 %i^x01 skulls lui^x03 %s^x01.", g_szTag, szName, iSkulls, _szName );
	
	return 1;
	
}
public TakeSkulls( id )
{
	
	if( !( get_user_flags( id ) & read_flags( g_szGiveSkullsFlag ) ) )
	{
		client_cmd( id, "echo NU ai acces la aceasta comanda!" );
		return 1;
	}
	
	new szFirstArg[ 32 ], szSecondArg[ 10 ];
	
	read_argv( 1, szFirstArg, sizeof ( szFirstArg ) -1 );
	read_argv( 2, szSecondArg, sizeof ( szSecondArg ) -1 );
	
	if( equal( szFirstArg, "" ) || equal( szSecondArg, "" ) )
	{
		client_cmd( id, "echo amx_remove_skulls < nume > < skulls >" );
		return 1;
	}
	
	new iSkulls = str_to_num( szSecondArg );
	if( iSkulls <= 0 )
	{
		client_cmd( id, "echo Valoare craniilor trebuie sa fie mai mare decat 0!" );
		return 1;
	}
			
	new iPlayer = cmd_target( id, szFirstArg, 8 );
	if( !iPlayer )
	{
		client_cmd( id, "echo Jucatorul %s nu a fost gasit!", szFirstArg );
		return 1;
	}
	
	if( cherep[ iPlayer ] < iSkulls )
	{
		client_cmd( id, "echo Jucatorul %s nu are atatea cranii !Are doar %i", szFirstArg, cherep[ iPlayer ] );
		return 1;
	}
	
	cherep[ iPlayer ] -= iSkulls;
	
	new szName[ 32 ], _szName[ 32 ];
	get_user_name( id, szName, sizeof ( szName ) -1 );
	get_user_name( id, _szName, sizeof ( _szName ) -1 );
	
	ChatColor( 0, "^x04%s^x01 Adminul^x03 %s^x01 i-a sters^x03 %i^x01 cranii lui^x03 %s^x01.", g_szTag, szName, iSkulls, _szName );
	
	return 1;
	
	
}

public LoadSkulls( id )
{
	static szData[ 256 ],  iTimestamp;
	
	if(  nvault_lookup( iVault, g_szName[ id ], szData, sizeof ( szData ) -1, iTimestamp ) )
	{
		static szSkulls[ 15 ];
		parse( szData, szSkulls, sizeof ( szSkulls ) -1 );
		cherep[ id ] = str_to_num( szSkulls );
		return;
	}
	
}


public SaveSkulls(  id  )
{
	
	static szData[ 256 ];
	formatex( szData, sizeof ( szData ) -1, "%i", cherep[ id ] );
	
	nvault_set( iVault, g_szName[ id ], szData );
}


Ai asa: Se salveaza pe nvault, amx_give_skulls, amx_remove_skulls. Daca am omis ceva revino cu reply :P
Post Reply

Return to “Cereri”

  • Information