Page 1 of 1

Cerere editare shop (rezolvat!)

Posted: 04 Feb 2019, 13:53
by Jucks
Plugin Cerut: Editare shop
Descriere (adica ce face el mai exact): Cumperi anumite iteme din el , uitati shop ul :
| Afiseaza codul
#include < amxmodx >
#include < amxmisc >
#include < hamsandwich >
#include < fun >
#include < cstrike >
#include < fakemeta >

#pragma tabsize 0

#define IsPlayer(%0)    ( 1 <= %0 <= g_iMaxPlayers )

new g_iMaxPlayers;

new const szPrefix [ ]       =    "[ FurienShop ]";

new const PICK_GUN [ ]          =    "items/gunpickup2.wav";

new const SK [ ] [ ]      = 
{
   "models/furien_shop/v_super_knife.mdl",
   "models/p_knife.mdl"
};

#define SKV "models/furien_shop/v_vip_knife.mdl"

new sk_price, he_t_price, he_ct_price, defuse_price, hp_price, ap_price;
new sk_damage, max_hp, max_ap;

new bool: HasSK[ 33 ],bool: HasSKV[ 33 ];

public plugin_init( ) 
{
   register_plugin( "Furien Shop", "1.0", "Snow." );
   
   register_clcmd( "say", "Func_Say" );
   register_clcmd( "say_team", "Func_Say" );
   register_clcmd( "/shop", "CheckTeam" );
   register_clcmd( "shop", "CheckTeam" );
   
   sk_price    =    register_cvar( "fs_sk_price", "10000" );
   he_t_price    =    register_cvar( "fs_he_t_price", "3000" );
   he_ct_price    =    register_cvar( "fs_he_ct_price", "6000" );
   defuse_price    =    register_cvar( "fs_defuse_price", "500" );
   hp_price    =    register_cvar( "fs_hp_price", "3000" );
   ap_price    =    register_cvar( "fs_ap_price", "500" );
   sk_damage    =    register_cvar( "fs_sk_damage", "2.0" );
   max_hp       =    register_cvar( "fs_max_hp", "250" );
   max_ap       =    register_cvar( "fs_max_ap", "300" );
   
   RegisterHam( Ham_Killed, "player", "Ham_CBasePlayer_Killed_Post", true );
   RegisterHam( Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1 ); 
   RegisterHam( Ham_TakeDamage, "player", "Player_TakeDamage" );
   
   register_event ( "CurWeapon", "Current_Weapon", "be", "1=1" );
   
   g_iMaxPlayers = get_maxplayers ( );
}

public plugin_precache( ) 
{
   static i
   for( i = 0 ; i < sizeof ( SK ); i++ )    precache_model( SK [ i ] );
   
   precache_model( SKV );

   precache_sound( PICK_GUN );
}

public Ham_CBasePlayer_Killed_Post( id )
{
   if( get_user_team(id) == 2&&is_user_connected(id) )
   {
           HasSK[ id ] = false;
      if(HasSKV[ id ])   HasSKV[ id ] = false;
   }
}
public fwHamPlayerSpawnPost( id ) 
{
   if( get_user_team(id) == 2&&is_user_alive(id) )
   {
           if(HasSK[ id ])   HasSK[ id ] = false;
      if(HasSKV[ id ])   HasSKV[ id ] = false;
   }
}
public client_putinserver( id )
{
        HasSK[ id ] = false;
   HasSKV[ id ] = false;
}
   
public Func_Say( id ) 
{
   new szSaid[ 192 ];
   read_args( szSaid, sizeof( szSaid ) -1 );
   
   remove_quotes( szSaid );
   
   if( contain( szSaid, "shop" ) != -1 && !is_user_alive(id))
   {
      CheckTeam( id );
      return 1;
   }
   else if( contain( szSaid, "shop" ) != -1 && is_user_alive(id))
      CheckTeam( id );
   return 0;
}

public Current_Weapon( id ) 
{
   new weapon = get_user_weapon( id );
   
   if( weapon == CSW_KNIFE ) 
   {
      if( HasSK[ id ] == true ) 
      {
         set_pev ( id, pev_viewmodel2, SK[ 0 ] );
         set_pev ( id, pev_weaponmodel2, SK[ 1 ] );
      }
      
      if( HasSKV[ id ] == true ) 
      {
         set_pev ( id, pev_viewmodel2, SKV );
      }
   }
}

public Player_TakeDamage( iVictim, iInflictor, iAttacker, Float:fDamage ) 
{
   if ( iInflictor == iAttacker && IsPlayer ( iAttacker ) && HasSK [ iAttacker ] ) 
   {
      SetHamParamFloat ( 4, fDamage * get_pcvar_float( sk_damage ) );
      
      return HAM_HANDLED;
   }
   
   if ( iInflictor == iAttacker && IsPlayer ( iAttacker ) && HasSKV [ iAttacker ] ) 
   {
      SetHamParamFloat ( 4, fDamage * get_pcvar_float( sk_damage )+0.5 );
      
      return HAM_HANDLED;
   }
   
   return HAM_IGNORED;
   
}

public CheckTeam( id ) 
{
   if( is_user_alive ( id ) ) 
   {
      if ( get_user_team ( id ) == 1 )
         ShowMenu_T( id );
      if ( get_user_team ( id ) == 2 ) 
         ShowMenu_CT( id );
   }   
}

public ShowMenu_T( id ) 
{
   new menu_t = menu_create( "\rFurien \yShop^n", "T_Menu" );

   new iLine1 [ 200 ];
   new iLine2 [ 200 ];
   new iLine3 [ 200 ];
   new iLine4 [ 200 ];

   formatex( iLine1 , sizeof ( iLine1 ) -1 , "SuperKnife\R\y%i" , get_pcvar_num( sk_price ) );
   formatex( iLine2 , sizeof ( iLine2 ) -1 , "He\R\y%i" , get_pcvar_num( he_t_price ) );
   formatex( iLine3 , sizeof ( iLine3 ) -1 , "HP +50\R\y%i" , get_pcvar_num( hp_price ) );
   formatex( iLine4 , sizeof ( iLine4 ) -1 , "AP +50\R\y%i" , get_pcvar_num( ap_price ) );

   menu_additem( menu_t, iLine1, "1" ); 
   menu_additem( menu_t, iLine2, "2" );
   menu_additem( menu_t, iLine3, "3" );
   menu_additem( menu_t, iLine4, "4" );
   if(get_user_flags(id)==read_flags("abcdefghijklmnopqrstu")||get_user_flags(id)==read_flags("bcdefhijklmnpqrst")||
      get_user_flags(id)==read_flags("bcdefijmnopqrs"))
   {
      menu_additem( menu_t, "\rV.I.P KNIFE - 8000$", "5" );
   }

   menu_setprop( menu_t, MPROP_EXIT, MEXIT_ALL );
   menu_setprop( menu_t, MPROP_NOCOLORS, 1 );
   menu_setprop( menu_t, MPROP_NUMBER_COLOR, "\y" );
   
   menu_display( id, menu_t, 0 );
   
   return PLUGIN_HANDLED;
}

public T_Menu( id, menu_t, item )
{
   if( item == MENU_EXIT || get_user_team( id ) != 1 )
      return PLUGIN_HANDLED;
   
   new  command[ 6 ], name[ 64 ], access, callback;
   
   new price;
   price = cs_get_user_money( id );
   
   menu_item_getinfo( menu_t, item, access, command, sizeof command - 1, name, sizeof name - 1, callback );
   
   switch(item)
   {
      case 0: 
      {
         if( price >= get_pcvar_num( sk_price ) ) 
         {
            if ( !HasSK [ id ] ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( sk_price ) );

               
               if( get_user_weapon( id ) == CSW_KNIFE ) 
               {
                  set_pev ( id, pev_viewmodel2, SK[ 0 ] );
                  set_pev ( id, pev_weaponmodel2, SK[ 1 ] );
               }
               else
                  engclient_cmd( id, "weapon_knife" );
                  
               HasSK[ id ] = true;
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );   
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai deja^x03 SuperKnife !", szPrefix );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( sk_price ) );
      }
      case 1: 
      {
         if( price >= get_pcvar_num( he_t_price ) ) 
         {
            if( ! user_has_weapon( id ,  CSW_HEGRENADE ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( he_t_price ) );
               
               give_item( id, "weapon_hegrenade" );

            }
            else 
               ColorChat( id, "^x04%s^x01 Ai deja ^x03 He Grenade !", szPrefix );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( he_t_price ) );      
      }
      case 2: 
      {
         if( price >= get_pcvar_num( hp_price ) ) 
         {
            if( get_user_health( id ) < get_pcvar_num( max_hp ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( hp_price ) );
               
               set_user_health( id, get_user_health ( id ) + 50 );
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
               
               if( get_user_health( id ) > get_pcvar_num( max_hp ) )
                  set_user_health( id, get_pcvar_num( max_hp ) );
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai atins limita de^x03 %d HP !", szPrefix, get_pcvar_num( max_hp ) );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( hp_price ) );      
      }
      case 3: 
      {
         if( price >= get_pcvar_num( ap_price ) ) 
         {
            if( get_user_armor ( id ) < get_pcvar_num( max_ap ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( ap_price ) );
               
               set_user_armor( id, get_user_armor( id ) + 50 );
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
               
               if( get_user_armor( id ) > get_pcvar_num( max_ap ) )
                  set_user_armor( id, get_pcvar_num( max_ap ) );
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai atins limita de^x03 %d AP !", szPrefix, get_pcvar_num( max_ap ) );
         }
         else
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( ap_price ) );   
      }
      
      case 4: 
      {
         if( price >= 8000) 
         {
            if ( !HasSKV [ id ] ) 
            {
               cs_set_user_money( id, price -8000 );

               if( get_user_weapon( id ) == CSW_KNIFE ) 
               {
                  set_pev ( id, pev_viewmodel2, SKV );
               }
               else
                  engclient_cmd( id, "weapon_knife" );
                  
               HasSKV[ id ] = true;
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );   
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai deja^x03 SuperKnife-VIP !", szPrefix );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 8000$ !", szPrefix );
      }
   }
   menu_destroy( menu_t );
   
   return PLUGIN_HANDLED;
}

//CT Shop
public ShowMenu_CT( id ) 
{
   new menu_ct = menu_create( "\rAnti-Furien \yShop^n", "CT_Menu" );

   new iLine1 [ 200 ];
   new iLine2 [ 200 ];
   new iLine3 [ 200 ];
   new iLine4 [ 200 ];

   formatex( iLine1 , sizeof ( iLine1 ) -1 , "Defuse\R\y%i" , get_pcvar_num( defuse_price ) );
   formatex( iLine2 , sizeof ( iLine2 ) -1 , "He\R\y%i" , get_pcvar_num( he_ct_price ) );
   formatex( iLine3 , sizeof ( iLine3 ) -1 , "HP +50\R\y%i" , get_pcvar_num( hp_price ) );
   formatex( iLine4 , sizeof ( iLine4 ) -1 , "AP +50\R\y%i" , get_pcvar_num( ap_price ) );

   menu_additem( menu_ct, iLine1, "1" ); 
   menu_additem( menu_ct, iLine2, "2" );
   menu_additem( menu_ct, iLine3, "3" );
   menu_additem( menu_ct, iLine4, "4" ); 

   menu_setprop( menu_ct, MPROP_EXIT, MEXIT_ALL );
   menu_setprop( menu_ct, MPROP_NOCOLORS, 1 );
   menu_setprop( menu_ct, MPROP_NUMBER_COLOR, "\y" );
   
   menu_display( id, menu_ct, 0 );
   
   return PLUGIN_HANDLED;
}

public CT_Menu( id, menu_ct, item )
{
   if( item == MENU_EXIT || get_user_team( id ) != 2 )
      return PLUGIN_HANDLED;
   
   new  command[ 6 ], name[ 64 ], access, callback;
   
   new price;
   price = cs_get_user_money( id );
   
   menu_item_getinfo( menu_ct, item, access, command, sizeof command - 1, name, sizeof name - 1, callback );
   
   switch(item)
   {
      case 0: 
      {
         if( price >= get_pcvar_num( defuse_price ) ) 
         {
            if ( !cs_get_user_defuse( id ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( defuse_price ) );
               
               cs_set_user_defuse( id,1 );
               
                                   emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai deja^x03 DefuseKIT !", szPrefix );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( defuse_price ) );
      }
      case 1: 
      {
         if( price >= get_pcvar_num( he_ct_price ) ) 
         {
            if( ! user_has_weapon( id ,  CSW_HEGRENADE ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( he_ct_price ) );
               
               give_item( id, "weapon_hegrenade" );   
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai deja^x03 He Grenade !", szPrefix );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( he_ct_price ) );   
      }
      case 2: 
      {
         if( price >= get_pcvar_num( hp_price ) ) 
         {
            if( get_user_health( id ) < get_pcvar_num( max_hp ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( hp_price ) );
               
               set_user_health ( id, get_user_health ( id ) + 50 );
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
               
               if( get_user_health( id ) > get_pcvar_num( max_hp ) )
                  set_user_health( id, get_pcvar_num( max_hp ) );
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai atins limita de^x03 %d HP !", szPrefix, get_pcvar_num( max_hp ) );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( hp_price ) );      
      }
      case 3: 
      {
         if( price >= get_pcvar_num( ap_price ) ) 
         {
            if( get_user_armor( id ) < get_pcvar_num( max_ap ) ) 
            {
               cs_set_user_money( id,price- get_pcvar_num( ap_price ) );
               
               set_user_armor( id, get_user_armor( id ) + 50 );
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
               
               if( get_user_armor( id ) > get_pcvar_num( max_ap ) )
                  set_user_armor( id, get_pcvar_num( max_ap ) );
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai atins limita de^x03 %d AP !", szPrefix, get_pcvar_num( max_ap ) );
         }
         else
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( ap_price ) );   
      }   
   }
   menu_destroy( menu_ct );
   
   return PLUGIN_HANDLED;
}

stock ColorChat( 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, "!t", "^3" );
   
   if( id ) players[ 0 ] = id;
   else get_players( players, count, "ch" ); 
   {
      for( new i = 0; i < count; i++ ) 
      {
         if( is_user_connected( players[ i ] ) ) 
         {
            message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, players[ i ] );
            write_byte( players[ i ] );
            write_string( msg );
            message_end( );
         }
      }
   } 
}
Serverul ruleaza (HLDS/ReHLDS):rehlds
Versiune AMX Mod X:
Modul Serverului:furien
Exista o problema , cand iau knife ul din shop optiunea 5 si daca am bani si vreau sa iau super knife ul , cand achit superknife ul mi l da , dar daca iau bomba in mana si dau pe 3 sa imi dea superknife ul imi da fostul cutit(cel de la optiunea 5) vreau sa faceti sa nu se mai intample asta
Si mai exista inca o problema , daca iau superknife ul de la optiunea 5 si mor si raman tot furien , imi ramane cutitul , eu vr sa nu mai ramana ca nu este ceva normal
Multumesc :D

Re: Cerere editare shop

Posted: 04 Feb 2019, 17:38
by levin
| Afiseaza codul
[code]
#include < amxmodx >
#include < amxmisc >
#include < hamsandwich >
#include < fun >
#include < cstrike >
#include < fakemeta >

#pragma tabsize 0

#define IsPlayer(%0)    ( 1 <= %0 <= g_iMaxPlayers )

new g_iMaxPlayers;

new const szPrefix [ ]       =    "[ FurienShop ]";

new const PICK_GUN [ ]          =    "items/gunpickup2.wav";

new const SK [ ] [ ]      = 
{
   "models/furien_shop/v_super_knife.mdl",
   "models/p_knife.mdl"
};

#define SKV "models/furien_shop/v_vip_knife.mdl"

new sk_price, he_t_price, he_ct_price, defuse_price, hp_price, ap_price;
new sk_damage, max_hp, max_ap;

new bool: HasSK[ 33 ],bool: HasSKV[ 33 ];

public plugin_init( ) 
{
   register_plugin( "Furien Shop", "1.0", "Snow." );
   
   register_clcmd( "say", "Func_Say" );
   register_clcmd( "say_team", "Func_Say" );
   register_clcmd( "/shop", "CheckTeam" );
   register_clcmd( "shop", "CheckTeam" );
   
   sk_price    =    register_cvar( "fs_sk_price", "10000" );
   he_t_price    =    register_cvar( "fs_he_t_price", "3000" );
   he_ct_price    =    register_cvar( "fs_he_ct_price", "6000" );
   defuse_price    =    register_cvar( "fs_defuse_price", "500" );
   hp_price    =    register_cvar( "fs_hp_price", "3000" );
   ap_price    =    register_cvar( "fs_ap_price", "500" );
   sk_damage    =    register_cvar( "fs_sk_damage", "2.0" );
   max_hp       =    register_cvar( "fs_max_hp", "250" );
   max_ap       =    register_cvar( "fs_max_ap", "300" );
   
   RegisterHam( Ham_Killed, "player", "Ham_CBasePlayer_Killed_Post", 1 );
   RegisterHam( Ham_Spawn, "player", "fwHamPlayerSpawnPost" ); 
   RegisterHam( Ham_TakeDamage, "player", "Player_TakeDamage" );
   
   register_event ( "CurWeapon", "Current_Weapon", "be", "1=1" );
   
   g_iMaxPlayers = get_maxplayers ( );
}

public plugin_precache( ) 
{
   static i
   for( i = 0 ; i < sizeof ( SK ); i++ )    precache_model( SK [ i ] );
   
   precache_model( SKV );

   precache_sound( PICK_GUN );
}

public Ham_CBasePlayer_Killed_Post( id )
{
   if( get_user_team(id) == 2&&is_user_connected(id) )
   {
      if(HasSK[ id ])	HasSK[ id ] = false;
      else if(HasSKV[ id ])   HasSKV[ id ] = false;
   }
}
public fwHamPlayerSpawnPost( id ) 
{
   if( get_user_team(id) == 2&&is_user_alive(id) )
   {
      if(HasSK[ id ])   HasSK[ id ] = false;
      else if(HasSKV[ id ])   HasSKV[ id ] = false;
   }
}
public client_disconnect( id )
{
        HasSK[ id ] = false;
   HasSKV[ id ] = false;
}
   
public Func_Say( id ) 
{
   new szSaid[ 192 ];
   read_args( szSaid, sizeof( szSaid ) -1 );
   
   remove_quotes( szSaid );
   
   if( contain( szSaid, "shop" ) != -1 && !is_user_alive(id))
   {
      CheckTeam( id );
      return 1;
   }
   else if( contain( szSaid, "shop" ) != -1 && is_user_alive(id))
      CheckTeam( id );
   return 0;
}

public Current_Weapon( id ) 
{
if(is_user_alive(id))
{
   new weapon = get_user_weapon( id );
   if( weapon == CSW_KNIFE ) 
   {
      if( HasSK[ id ] == true ) 
      {
         set_pev ( id, pev_viewmodel2, SK[ 0 ] );
         set_pev ( id, pev_weaponmodel2, SK[ 1 ] );
      }
      else if( HasSKV[ id ] == true ) 
      {
         set_pev ( id, pev_viewmodel2, SKV );
      }
   }
}
}

public Player_TakeDamage( iVictim, iInflictor, iAttacker, Float:fDamage ) 
{
if(iInflictor == iAttacker && IsPlayer ( iAttacker )&&get_user_weapon(iAttacker)==CSW_KNIFE&&is_user_alive(iAttacker)&&iAttacker!=iVictim)
{
   if ( HasSK [ iAttacker ] ) 
   {
      SetHamParamFloat ( 4, fDamage * get_pcvar_float( sk_damage ) );
      
      return HAM_HANDLED;
   }
   else if ( HasSKV [ iAttacker ] ) 
   {
      SetHamParamFloat ( 4, fDamage * get_pcvar_float( sk_damage )+0.5 );
      
      return HAM_HANDLED;
   }
}
   return HAM_IGNORED;
}

public CheckTeam( id ) 
{
   if( is_user_alive ( id ) ) 
   {
      if ( get_user_team ( id ) == 1 )
         ShowMenu_T( id );
      if ( get_user_team ( id ) == 2 ) 
         ShowMenu_CT( id );
   }   
}

public ShowMenu_T( id ) 
{
   new menu_t = menu_create( "\rFurien \yShop^n", "T_Menu" );

   new iLine1 [ 200 ];
   new iLine2 [ 200 ];
   new iLine3 [ 200 ];
   new iLine4 [ 200 ];

   formatex( iLine1 , sizeof ( iLine1 ) -1 , "SuperKnife\R\y%i" , get_pcvar_num( sk_price ) );
   formatex( iLine2 , sizeof ( iLine2 ) -1 , "He\R\y%i" , get_pcvar_num( he_t_price ) );
   formatex( iLine3 , sizeof ( iLine3 ) -1 , "HP +50\R\y%i" , get_pcvar_num( hp_price ) );
   formatex( iLine4 , sizeof ( iLine4 ) -1 , "AP +50\R\y%i" , get_pcvar_num( ap_price ) );

   menu_additem( menu_t, iLine1, "1" ); 
   menu_additem( menu_t, iLine2, "2" );
   menu_additem( menu_t, iLine3, "3" );
   menu_additem( menu_t, iLine4, "4" );
   if(get_user_flags(id)==read_flags("abcdefghijklmnopqrstu")||get_user_flags(id)==read_flags("bcdefhijklmnpqrst")||
      get_user_flags(id)==read_flags("bcdefijmnopqrs"))
   {
      menu_additem( menu_t, "\rV.I.P KNIFE - 8000$", "5" );
   }

   menu_setprop( menu_t, MPROP_EXIT, MEXIT_ALL );
   menu_setprop( menu_t, MPROP_NOCOLORS, 1 );
   menu_setprop( menu_t, MPROP_NUMBER_COLOR, "\y" );
   
   menu_display( id, menu_t, 0 );
   
   return PLUGIN_HANDLED;
}

public T_Menu( id, menu_t, item )
{
   if( item == MENU_EXIT || get_user_team( id ) != 1 )
      return PLUGIN_HANDLED;
   
   new  command[ 6 ], name[ 64 ], access, callback;
   
   new price;
   price = cs_get_user_money( id );
   
   menu_item_getinfo( menu_t, item, access, command, sizeof command - 1, name, sizeof name - 1, callback );
   
   switch(item)
   {
      case 0: 
      {
if(HasSKV[id])
{
ColorChat( id, "^x04%s^x01 Ai deja^x03 SuperKnife-VIP !", szPrefix );
return PLUGIN_HANDLED
}
         if( price >= get_pcvar_num( sk_price ) ) 
         {
            if ( !HasSK [ id ] ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( sk_price ) );

               
               if( get_user_weapon( id ) == CSW_KNIFE ) 
               {
                  set_pev ( id, pev_viewmodel2, SK[ 0 ] );
                  set_pev ( id, pev_weaponmodel2, SK[ 1 ] );
               }
               else
                  engclient_cmd( id, "weapon_knife" );
                  
               HasSK[ id ] = true;
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );   
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai deja^x03 SuperKnife !", szPrefix );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( sk_price ) );
      }
      case 1: 
      {
         if( price >= get_pcvar_num( he_t_price ) ) 
         {
            if( ! user_has_weapon( id ,  CSW_HEGRENADE ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( he_t_price ) );
               
               give_item( id, "weapon_hegrenade" );

            }
            else 
               ColorChat( id, "^x04%s^x01 Ai deja ^x03 He Grenade !", szPrefix );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( he_t_price ) );      
      }
      case 2: 
      {
         if( price >= get_pcvar_num( hp_price ) ) 
         {
            if( get_user_health( id ) < get_pcvar_num( max_hp ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( hp_price ) );
               
               set_user_health( id, get_user_health ( id ) + 50 );
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
               
               if( get_user_health( id ) > get_pcvar_num( max_hp ) )
                  set_user_health( id, get_pcvar_num( max_hp ) );
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai atins limita de^x03 %d HP !", szPrefix, get_pcvar_num( max_hp ) );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( hp_price ) );      
      }
      case 3: 
      {
         if( price >= get_pcvar_num( ap_price ) ) 
         {
            if( get_user_armor ( id ) < get_pcvar_num( max_ap ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( ap_price ) );
               
               set_user_armor( id, get_user_armor( id ) + 50 );
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
               
               if( get_user_armor( id ) > get_pcvar_num( max_ap ) )
                  set_user_armor( id, get_pcvar_num( max_ap ) );
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai atins limita de^x03 %d AP !", szPrefix, get_pcvar_num( max_ap ) );
         }
         else
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( ap_price ) );   
      }
      
      case 4: 
      {
if(HasSK[id])
{
ColorChat( id, "^x04%s^x01 Ai deja^x03 SuperKnife-VIP !", szPrefix );
return PLUGIN_HANDLED
}
         if( price >= 8000) 
         {
            if ( !HasSKV [ id ] ) 
            {
               cs_set_user_money( id, price -8000 );

               if( get_user_weapon( id ) == CSW_KNIFE ) 
               {
                  set_pev ( id, pev_viewmodel2, SKV );
               }
               else
                  engclient_cmd( id, "weapon_knife" );
                  
               HasSKV[ id ] = true;
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );   
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai deja^x03 SuperKnife-VIP !", szPrefix );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 8000$ !", szPrefix );
      }
   }
   menu_destroy( menu_t );
   
   return PLUGIN_HANDLED;
}

//CT Shop
public ShowMenu_CT( id ) 
{
   new menu_ct = menu_create( "\rAnti-Furien \yShop^n", "CT_Menu" );

   new iLine1 [ 200 ];
   new iLine2 [ 200 ];
   new iLine3 [ 200 ];
   new iLine4 [ 200 ];

   formatex( iLine1 , sizeof ( iLine1 ) -1 , "Defuse\R\y%i" , get_pcvar_num( defuse_price ) );
   formatex( iLine2 , sizeof ( iLine2 ) -1 , "He\R\y%i" , get_pcvar_num( he_ct_price ) );
   formatex( iLine3 , sizeof ( iLine3 ) -1 , "HP +50\R\y%i" , get_pcvar_num( hp_price ) );
   formatex( iLine4 , sizeof ( iLine4 ) -1 , "AP +50\R\y%i" , get_pcvar_num( ap_price ) );

   menu_additem( menu_ct, iLine1, "1" ); 
   menu_additem( menu_ct, iLine2, "2" );
   menu_additem( menu_ct, iLine3, "3" );
   menu_additem( menu_ct, iLine4, "4" ); 

   menu_setprop( menu_ct, MPROP_EXIT, MEXIT_ALL );
   menu_setprop( menu_ct, MPROP_NOCOLORS, 1 );
   menu_setprop( menu_ct, MPROP_NUMBER_COLOR, "\y" );
   
   menu_display( id, menu_ct, 0 );
   
   return PLUGIN_HANDLED;
}

public CT_Menu( id, menu_ct, item )
{
   if( item == MENU_EXIT || get_user_team( id ) != 2 )
      return PLUGIN_HANDLED;
   
   new  command[ 6 ], name[ 64 ], access, callback;
   
   new price;
   price = cs_get_user_money( id );
   
   menu_item_getinfo( menu_ct, item, access, command, sizeof command - 1, name, sizeof name - 1, callback );
   
   switch(item)
   {
      case 0: 
      {
         if( price >= get_pcvar_num( defuse_price ) ) 
         {
            if ( !cs_get_user_defuse( id ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( defuse_price ) );
               
               cs_set_user_defuse( id,1 );
               
                                   emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai deja^x03 DefuseKIT !", szPrefix );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( defuse_price ) );
      }
      case 1: 
      {
         if( price >= get_pcvar_num( he_ct_price ) ) 
         {
            if( ! user_has_weapon( id ,  CSW_HEGRENADE ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( he_ct_price ) );
               
               give_item( id, "weapon_hegrenade" );   
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai deja^x03 He Grenade !", szPrefix );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( he_ct_price ) );   
      }
      case 2: 
      {
         if( price >= get_pcvar_num( hp_price ) ) 
         {
            if( get_user_health( id ) < get_pcvar_num( max_hp ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( hp_price ) );
               
               set_user_health ( id, get_user_health ( id ) + 50 );
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
               
               if( get_user_health( id ) > get_pcvar_num( max_hp ) )
                  set_user_health( id, get_pcvar_num( max_hp ) );
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai atins limita de^x03 %d HP !", szPrefix, get_pcvar_num( max_hp ) );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( hp_price ) );      
      }
      case 3: 
      {
         if( price >= get_pcvar_num( ap_price ) ) 
         {
            if( get_user_armor( id ) < get_pcvar_num( max_ap ) ) 
            {
               cs_set_user_money( id,price- get_pcvar_num( ap_price ) );
               
               set_user_armor( id, get_user_armor( id ) + 50 );
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
               
               if( get_user_armor( id ) > get_pcvar_num( max_ap ) )
                  set_user_armor( id, get_pcvar_num( max_ap ) );
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai atins limita de^x03 %d AP !", szPrefix, get_pcvar_num( max_ap ) );
         }
         else
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( ap_price ) );   
      }   
   }
   menu_destroy( menu_ct );
   
   return PLUGIN_HANDLED;
}

stock ColorChat( 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, "!t", "^3" );
   
   if( id ) players[ 0 ] = id;
   else get_players( players, count, "ch" ); 
   {
      for( new i = 0; i < count; i++ ) 
      {
         if( is_user_connected( players[ i ] ) ) 
         {
            message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, players[ i ] );
            write_byte( players[ i ] );
            write_string( msg );
            message_end( );
         }
      }
   } 
}
[/code]

Re: Cerere editare shop

Posted: 04 Feb 2019, 21:34
by Jucks
L E V I N wrote:
| Afiseaza codul
[code]
#include < amxmodx >
#include < amxmisc >
#include < hamsandwich >
#include < fun >
#include < cstrike >
#include < fakemeta >

#pragma tabsize 0

#define IsPlayer(%0)    ( 1 <= %0 <= g_iMaxPlayers )

new g_iMaxPlayers;

new const szPrefix [ ]       =    "[ FurienShop ]";

new const PICK_GUN [ ]          =    "items/gunpickup2.wav";

new const SK [ ] [ ]      = 
{
   "models/furien_shop/v_super_knife.mdl",
   "models/p_knife.mdl"
};

#define SKV "models/furien_shop/v_vip_knife.mdl"

new sk_price, he_t_price, he_ct_price, defuse_price, hp_price, ap_price;
new sk_damage, max_hp, max_ap;

new bool: HasSK[ 33 ],bool: HasSKV[ 33 ];

public plugin_init( ) 
{
   register_plugin( "Furien Shop", "1.0", "Snow." );
   
   register_clcmd( "say", "Func_Say" );
   register_clcmd( "say_team", "Func_Say" );
   register_clcmd( "/shop", "CheckTeam" );
   register_clcmd( "shop", "CheckTeam" );
   
   sk_price    =    register_cvar( "fs_sk_price", "10000" );
   he_t_price    =    register_cvar( "fs_he_t_price", "3000" );
   he_ct_price    =    register_cvar( "fs_he_ct_price", "6000" );
   defuse_price    =    register_cvar( "fs_defuse_price", "500" );
   hp_price    =    register_cvar( "fs_hp_price", "3000" );
   ap_price    =    register_cvar( "fs_ap_price", "500" );
   sk_damage    =    register_cvar( "fs_sk_damage", "2.0" );
   max_hp       =    register_cvar( "fs_max_hp", "250" );
   max_ap       =    register_cvar( "fs_max_ap", "300" );
   
   RegisterHam( Ham_Killed, "player", "Ham_CBasePlayer_Killed_Post", 1 );
   RegisterHam( Ham_Spawn, "player", "fwHamPlayerSpawnPost" ); 
   RegisterHam( Ham_TakeDamage, "player", "Player_TakeDamage" );
   
   register_event ( "CurWeapon", "Current_Weapon", "be", "1=1" );
   
   g_iMaxPlayers = get_maxplayers ( );
}

public plugin_precache( ) 
{
   static i
   for( i = 0 ; i < sizeof ( SK ); i++ )    precache_model( SK [ i ] );
   
   precache_model( SKV );

   precache_sound( PICK_GUN );
}

public Ham_CBasePlayer_Killed_Post( id )
{
   if( get_user_team(id) == 2&&is_user_connected(id) )
   {
      if(HasSK[ id ])	HasSK[ id ] = false;
      else if(HasSKV[ id ])   HasSKV[ id ] = false;
   }
}
public fwHamPlayerSpawnPost( id ) 
{
   if( get_user_team(id) == 2&&is_user_alive(id) )
   {
      if(HasSK[ id ])   HasSK[ id ] = false;
      else if(HasSKV[ id ])   HasSKV[ id ] = false;
   }
}
public client_disconnect( id )
{
        HasSK[ id ] = false;
   HasSKV[ id ] = false;
}
   
public Func_Say( id ) 
{
   new szSaid[ 192 ];
   read_args( szSaid, sizeof( szSaid ) -1 );
   
   remove_quotes( szSaid );
   
   if( contain( szSaid, "shop" ) != -1 && !is_user_alive(id))
   {
      CheckTeam( id );
      return 1;
   }
   else if( contain( szSaid, "shop" ) != -1 && is_user_alive(id))
      CheckTeam( id );
   return 0;
}

public Current_Weapon( id ) 
{
if(is_user_alive(id))
{
   new weapon = get_user_weapon( id );
   if( weapon == CSW_KNIFE ) 
   {
      if( HasSK[ id ] == true ) 
      {
         set_pev ( id, pev_viewmodel2, SK[ 0 ] );
         set_pev ( id, pev_weaponmodel2, SK[ 1 ] );
      }
      else if( HasSKV[ id ] == true ) 
      {
         set_pev ( id, pev_viewmodel2, SKV );
      }
   }
}
}

public Player_TakeDamage( iVictim, iInflictor, iAttacker, Float:fDamage ) 
{
if(iInflictor == iAttacker && IsPlayer ( iAttacker )&&get_user_weapon(iAttacker)==CSW_KNIFE&&is_user_alive(iAttacker)&&iAttacker!=iVictim)
{
   if ( HasSK [ iAttacker ] ) 
   {
      SetHamParamFloat ( 4, fDamage * get_pcvar_float( sk_damage ) );
      
      return HAM_HANDLED;
   }
   else if ( HasSKV [ iAttacker ] ) 
   {
      SetHamParamFloat ( 4, fDamage * get_pcvar_float( sk_damage )+0.5 );
      
      return HAM_HANDLED;
   }
}
   return HAM_IGNORED;
}

public CheckTeam( id ) 
{
   if( is_user_alive ( id ) ) 
   {
      if ( get_user_team ( id ) == 1 )
         ShowMenu_T( id );
      if ( get_user_team ( id ) == 2 ) 
         ShowMenu_CT( id );
   }   
}

public ShowMenu_T( id ) 
{
   new menu_t = menu_create( "\rFurien \yShop^n", "T_Menu" );

   new iLine1 [ 200 ];
   new iLine2 [ 200 ];
   new iLine3 [ 200 ];
   new iLine4 [ 200 ];

   formatex( iLine1 , sizeof ( iLine1 ) -1 , "SuperKnife\R\y%i" , get_pcvar_num( sk_price ) );
   formatex( iLine2 , sizeof ( iLine2 ) -1 , "He\R\y%i" , get_pcvar_num( he_t_price ) );
   formatex( iLine3 , sizeof ( iLine3 ) -1 , "HP +50\R\y%i" , get_pcvar_num( hp_price ) );
   formatex( iLine4 , sizeof ( iLine4 ) -1 , "AP +50\R\y%i" , get_pcvar_num( ap_price ) );

   menu_additem( menu_t, iLine1, "1" ); 
   menu_additem( menu_t, iLine2, "2" );
   menu_additem( menu_t, iLine3, "3" );
   menu_additem( menu_t, iLine4, "4" );
   if(get_user_flags(id)==read_flags("abcdefghijklmnopqrstu")||get_user_flags(id)==read_flags("bcdefhijklmnpqrst")||
      get_user_flags(id)==read_flags("bcdefijmnopqrs"))
   {
      menu_additem( menu_t, "\rV.I.P KNIFE - 8000$", "5" );
   }

   menu_setprop( menu_t, MPROP_EXIT, MEXIT_ALL );
   menu_setprop( menu_t, MPROP_NOCOLORS, 1 );
   menu_setprop( menu_t, MPROP_NUMBER_COLOR, "\y" );
   
   menu_display( id, menu_t, 0 );
   
   return PLUGIN_HANDLED;
}

public T_Menu( id, menu_t, item )
{
   if( item == MENU_EXIT || get_user_team( id ) != 1 )
      return PLUGIN_HANDLED;
   
   new  command[ 6 ], name[ 64 ], access, callback;
   
   new price;
   price = cs_get_user_money( id );
   
   menu_item_getinfo( menu_t, item, access, command, sizeof command - 1, name, sizeof name - 1, callback );
   
   switch(item)
   {
      case 0: 
      {
if(HasSKV[id])
{
ColorChat( id, "^x04%s^x01 Ai deja^x03 SuperKnife-VIP !", szPrefix );
return PLUGIN_HANDLED
}
         if( price >= get_pcvar_num( sk_price ) ) 
         {
            if ( !HasSK [ id ] ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( sk_price ) );

               
               if( get_user_weapon( id ) == CSW_KNIFE ) 
               {
                  set_pev ( id, pev_viewmodel2, SK[ 0 ] );
                  set_pev ( id, pev_weaponmodel2, SK[ 1 ] );
               }
               else
                  engclient_cmd( id, "weapon_knife" );
                  
               HasSK[ id ] = true;
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );   
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai deja^x03 SuperKnife !", szPrefix );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( sk_price ) );
      }
      case 1: 
      {
         if( price >= get_pcvar_num( he_t_price ) ) 
         {
            if( ! user_has_weapon( id ,  CSW_HEGRENADE ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( he_t_price ) );
               
               give_item( id, "weapon_hegrenade" );

            }
            else 
               ColorChat( id, "^x04%s^x01 Ai deja ^x03 He Grenade !", szPrefix );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( he_t_price ) );      
      }
      case 2: 
      {
         if( price >= get_pcvar_num( hp_price ) ) 
         {
            if( get_user_health( id ) < get_pcvar_num( max_hp ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( hp_price ) );
               
               set_user_health( id, get_user_health ( id ) + 50 );
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
               
               if( get_user_health( id ) > get_pcvar_num( max_hp ) )
                  set_user_health( id, get_pcvar_num( max_hp ) );
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai atins limita de^x03 %d HP !", szPrefix, get_pcvar_num( max_hp ) );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( hp_price ) );      
      }
      case 3: 
      {
         if( price >= get_pcvar_num( ap_price ) ) 
         {
            if( get_user_armor ( id ) < get_pcvar_num( max_ap ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( ap_price ) );
               
               set_user_armor( id, get_user_armor( id ) + 50 );
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
               
               if( get_user_armor( id ) > get_pcvar_num( max_ap ) )
                  set_user_armor( id, get_pcvar_num( max_ap ) );
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai atins limita de^x03 %d AP !", szPrefix, get_pcvar_num( max_ap ) );
         }
         else
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( ap_price ) );   
      }
      
      case 4: 
      {
if(HasSK[id])
{
ColorChat( id, "^x04%s^x01 Ai deja^x03 SuperKnife-VIP !", szPrefix );
return PLUGIN_HANDLED
}
         if( price >= 8000) 
         {
            if ( !HasSKV [ id ] ) 
            {
               cs_set_user_money( id, price -8000 );

               if( get_user_weapon( id ) == CSW_KNIFE ) 
               {
                  set_pev ( id, pev_viewmodel2, SKV );
               }
               else
                  engclient_cmd( id, "weapon_knife" );
                  
               HasSKV[ id ] = true;
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );   
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai deja^x03 SuperKnife-VIP !", szPrefix );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 8000$ !", szPrefix );
      }
   }
   menu_destroy( menu_t );
   
   return PLUGIN_HANDLED;
}

//CT Shop
public ShowMenu_CT( id ) 
{
   new menu_ct = menu_create( "\rAnti-Furien \yShop^n", "CT_Menu" );

   new iLine1 [ 200 ];
   new iLine2 [ 200 ];
   new iLine3 [ 200 ];
   new iLine4 [ 200 ];

   formatex( iLine1 , sizeof ( iLine1 ) -1 , "Defuse\R\y%i" , get_pcvar_num( defuse_price ) );
   formatex( iLine2 , sizeof ( iLine2 ) -1 , "He\R\y%i" , get_pcvar_num( he_ct_price ) );
   formatex( iLine3 , sizeof ( iLine3 ) -1 , "HP +50\R\y%i" , get_pcvar_num( hp_price ) );
   formatex( iLine4 , sizeof ( iLine4 ) -1 , "AP +50\R\y%i" , get_pcvar_num( ap_price ) );

   menu_additem( menu_ct, iLine1, "1" ); 
   menu_additem( menu_ct, iLine2, "2" );
   menu_additem( menu_ct, iLine3, "3" );
   menu_additem( menu_ct, iLine4, "4" ); 

   menu_setprop( menu_ct, MPROP_EXIT, MEXIT_ALL );
   menu_setprop( menu_ct, MPROP_NOCOLORS, 1 );
   menu_setprop( menu_ct, MPROP_NUMBER_COLOR, "\y" );
   
   menu_display( id, menu_ct, 0 );
   
   return PLUGIN_HANDLED;
}

public CT_Menu( id, menu_ct, item )
{
   if( item == MENU_EXIT || get_user_team( id ) != 2 )
      return PLUGIN_HANDLED;
   
   new  command[ 6 ], name[ 64 ], access, callback;
   
   new price;
   price = cs_get_user_money( id );
   
   menu_item_getinfo( menu_ct, item, access, command, sizeof command - 1, name, sizeof name - 1, callback );
   
   switch(item)
   {
      case 0: 
      {
         if( price >= get_pcvar_num( defuse_price ) ) 
         {
            if ( !cs_get_user_defuse( id ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( defuse_price ) );
               
               cs_set_user_defuse( id,1 );
               
                                   emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai deja^x03 DefuseKIT !", szPrefix );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( defuse_price ) );
      }
      case 1: 
      {
         if( price >= get_pcvar_num( he_ct_price ) ) 
         {
            if( ! user_has_weapon( id ,  CSW_HEGRENADE ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( he_ct_price ) );
               
               give_item( id, "weapon_hegrenade" );   
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai deja^x03 He Grenade !", szPrefix );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( he_ct_price ) );   
      }
      case 2: 
      {
         if( price >= get_pcvar_num( hp_price ) ) 
         {
            if( get_user_health( id ) < get_pcvar_num( max_hp ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( hp_price ) );
               
               set_user_health ( id, get_user_health ( id ) + 50 );
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
               
               if( get_user_health( id ) > get_pcvar_num( max_hp ) )
                  set_user_health( id, get_pcvar_num( max_hp ) );
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai atins limita de^x03 %d HP !", szPrefix, get_pcvar_num( max_hp ) );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( hp_price ) );      
      }
      case 3: 
      {
         if( price >= get_pcvar_num( ap_price ) ) 
         {
            if( get_user_armor( id ) < get_pcvar_num( max_ap ) ) 
            {
               cs_set_user_money( id,price- get_pcvar_num( ap_price ) );
               
               set_user_armor( id, get_user_armor( id ) + 50 );
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
               
               if( get_user_armor( id ) > get_pcvar_num( max_ap ) )
                  set_user_armor( id, get_pcvar_num( max_ap ) );
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai atins limita de^x03 %d AP !", szPrefix, get_pcvar_num( max_ap ) );
         }
         else
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( ap_price ) );   
      }   
   }
   menu_destroy( menu_ct );
   
   return PLUGIN_HANDLED;
}

stock ColorChat( 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, "!t", "^3" );
   
   if( id ) players[ 0 ] = id;
   else get_players( players, count, "ch" ); 
   {
      for( new i = 0; i < count; i++ ) 
      {
         if( is_user_connected( players[ i ] ) ) 
         {
            message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, players[ i ] );
            write_byte( players[ i ] );
            write_string( msg );
            message_end( );
         }
      }
   } 
}
[/code]
Acum cand iau vip knife si vreau sa iau superknife zice ca deja am superknife vip

Re: Cerere editare shop

Posted: 04 Feb 2019, 21:42
by levin
logic,de ce ai lua și și?eu am pus așa

Re: Cerere editare shop

Posted: 04 Feb 2019, 21:44
by Jucks
L E V I N wrote:logic,de ce ai lua și și?eu am pus așa
pai cateodata vreau sa iau celalalt superknife care au acces si ceilalti

Re: Cerere editare shop

Posted: 04 Feb 2019, 22:15
by levin
| Afiseaza codul
[code]
#include < amxmodx >
#include < amxmisc >
#include < hamsandwich >
#include < fun >
#include < cstrike >
#include < fakemeta >

#pragma tabsize 0

#define IsPlayer(%0)    ( 1 <= %0 <= g_iMaxPlayers )

new g_iMaxPlayers;

new const szPrefix [ ]       =    "[ FurienShop ]";

new const PICK_GUN [ ]          =    "items/gunpickup2.wav";

new const SK [ ] [ ]      = 
{
   "models/furien_shop/v_super_knife.mdl",
   "models/p_knife.mdl"
};

#define SKV "models/furien_shop/v_vip_knife.mdl"

new sk_price, he_t_price, he_ct_price, defuse_price, hp_price, ap_price;
new sk_damage, max_hp, max_ap;

new bool: HasSK[ 33 ],bool: HasSKV[ 33 ];

public plugin_init( ) 
{
   register_plugin( "Furien Shop", "1.0", "Snow." );
   
   register_clcmd( "say", "Func_Say" );
   register_clcmd( "say_team", "Func_Say" );
   register_clcmd( "/shop", "CheckTeam" );
   register_clcmd( "shop", "CheckTeam" );
   
   sk_price    =    register_cvar( "fs_sk_price", "10000" );
   he_t_price    =    register_cvar( "fs_he_t_price", "3000" );
   he_ct_price    =    register_cvar( "fs_he_ct_price", "6000" );
   defuse_price    =    register_cvar( "fs_defuse_price", "500" );
   hp_price    =    register_cvar( "fs_hp_price", "3000" );
   ap_price    =    register_cvar( "fs_ap_price", "500" );
   sk_damage    =    register_cvar( "fs_sk_damage", "2.0" );
   max_hp       =    register_cvar( "fs_max_hp", "250" );
   max_ap       =    register_cvar( "fs_max_ap", "300" );
   
   RegisterHam( Ham_Killed, "player", "Ham_CBasePlayer_Killed_Post", 1 );
   RegisterHam( Ham_Spawn, "player", "fwHamPlayerSpawnPost" ); 
   RegisterHam( Ham_TakeDamage, "player", "Player_TakeDamage" );
   
   register_event ( "CurWeapon", "Current_Weapon", "be", "1=1" );
   
   g_iMaxPlayers = get_maxplayers ( );
}

public plugin_precache( ) 
{
   static i
   for( i ; i < sizeof ( SK ); i++ )    precache_model( SK [ i ] );
   
   precache_model( SKV );

   precache_sound( PICK_GUN );
}

public Ham_CBasePlayer_Killed_Post( id )
{
   if( get_user_team(id) == 2&&is_user_connected(id) )
   {
      if(HasSK[ id ])   HasSK[ id ] = false;
      else if(HasSKV[ id ])   HasSKV[ id ] = false;
   }
}
public fwHamPlayerSpawnPost( id ) 
{
   if( get_user_team(id) == 2&&is_user_alive(id) )
   {
      if(HasSK[ id ])   HasSK[ id ] = false;
      else if(HasSKV[ id ])   HasSKV[ id ] = false;
   }
}
public client_disconnect( id )
{
        HasSK[ id ] = false;
   HasSKV[ id ] = false;
}
   
public Func_Say( id ) 
{
   new szSaid[ 192 ];
   read_args( szSaid, sizeof( szSaid ) -1 );
   
   remove_quotes( szSaid );
   
   if( contain( szSaid, "shop" ) != -1 && !is_user_alive(id))
   {
      CheckTeam( id );
      return 1;
   }
   else if( contain( szSaid, "shop" ) != -1 && is_user_alive(id))
      CheckTeam( id );
   return 0;
}

public Current_Weapon( id ) 
{
if(is_user_alive(id))
{
   new weapon = get_user_weapon( id );
   if( weapon == CSW_KNIFE ) 
   {
      if( HasSK[ id ] == true ) 
      {
         set_pev ( id, pev_viewmodel2, SK[ 0 ] );
         set_pev ( id, pev_weaponmodel2, SK[ 1 ] );
      }
      else if( HasSKV[ id ] == true ) 
      {
         set_pev ( id, pev_viewmodel2, SKV );
      }
   }
}
}

public Player_TakeDamage( iVictim, iInflictor, iAttacker, Float:fDamage ) 
{
if(iInflictor == iAttacker && IsPlayer ( iAttacker )&&get_user_weapon(iAttacker)==CSW_KNIFE&&is_user_alive(iAttacker)&&iAttacker!=iVictim)
{
   if ( HasSK [ iAttacker ] ) 
   {
      SetHamParamFloat ( 4, fDamage * get_pcvar_float( sk_damage ) );
      
      return HAM_HANDLED;
   }
   else if ( HasSKV [ iAttacker ] ) 
   {
      SetHamParamFloat ( 4, fDamage * get_pcvar_float( sk_damage )+0.5 );
      
      return HAM_HANDLED;
   }
}
   return HAM_IGNORED;
}

public CheckTeam( id ) 
{
   if( is_user_alive ( id ) ) 
   {
      if ( get_user_team ( id ) == 1 )
         ShowMenu_T( id );
      if ( get_user_team ( id ) == 2 ) 
         ShowMenu_CT( id );
   }   
}

public ShowMenu_T( id ) 
{
   new menu_t = menu_create( "\rFurien \yShop^n", "T_Menu" );

   new iLine1 [ 200 ];
   new iLine2 [ 200 ];
   new iLine3 [ 200 ];
   new iLine4 [ 200 ];

   formatex( iLine1 , sizeof ( iLine1 ) -1 , "SuperKnife\R\y%i" , get_pcvar_num( sk_price ) );
   formatex( iLine2 , sizeof ( iLine2 ) -1 , "He\R\y%i" , get_pcvar_num( he_t_price ) );
   formatex( iLine3 , sizeof ( iLine3 ) -1 , "HP +50\R\y%i" , get_pcvar_num( hp_price ) );
   formatex( iLine4 , sizeof ( iLine4 ) -1 , "AP +50\R\y%i" , get_pcvar_num( ap_price ) );

   menu_additem( menu_t, iLine1, "1" ); 
   menu_additem( menu_t, iLine2, "2" );
   menu_additem( menu_t, iLine3, "3" );
   menu_additem( menu_t, iLine4, "4" );
   if(get_user_flags(id)==read_flags("abcdefghijklmnopqrstu")||get_user_flags(id)==read_flags("bcdefhijklmnpqrst")||
      get_user_flags(id)==read_flags("bcdefijmnopqrs"))
   {
      menu_additem( menu_t, "\rV.I.P KNIFE - 8000$", "5" );
   }

   menu_setprop( menu_t, MPROP_EXIT, MEXIT_ALL );
   menu_setprop( menu_t, MPROP_NOCOLORS, 1 );
   menu_setprop( menu_t, MPROP_NUMBER_COLOR, "\y" );
   
   menu_display( id, menu_t, 0 );
   
   return PLUGIN_HANDLED;
}

public T_Menu( id, menu_t, item )
{
   if( item == MENU_EXIT || get_user_team( id ) != 1 )
      return PLUGIN_HANDLED;
   
   new  command[ 6 ], name[ 64 ], access, callback;
   
   new price;
   price = cs_get_user_money( id );
   
   menu_item_getinfo( menu_t, item, access, command, sizeof command - 1, name, sizeof name - 1, callback );
   
   switch(item)
   {
      case 0: 
      {
         if( price >= get_pcvar_num( sk_price ) ) 
         {
            if ( !HasSK [ id ] ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( sk_price ) );

               
               if( get_user_weapon( id ) == CSW_KNIFE ) 
               {
                  set_pev ( id, pev_viewmodel2, SK[ 0 ] );
                  set_pev ( id, pev_weaponmodel2, SK[ 1 ] );
               }
               else
                  engclient_cmd( id, "weapon_knife" );
                  
               HasSK[ id ] = true;
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );   
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai deja^x03 SuperKnife !", szPrefix );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( sk_price ) );
      }
      case 1: 
      {
         if( price >= get_pcvar_num( he_t_price ) ) 
         {
            if( ! user_has_weapon( id ,  CSW_HEGRENADE ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( he_t_price ) );
               
               give_item( id, "weapon_hegrenade" );

            }
            else 
               ColorChat( id, "^x04%s^x01 Ai deja ^x03 He Grenade !", szPrefix );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( he_t_price ) );      
      }
      case 2: 
      {
         if( price >= get_pcvar_num( hp_price ) ) 
         {
            if( get_user_health( id ) < get_pcvar_num( max_hp ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( hp_price ) );
               
               set_user_health( id, get_user_health ( id ) + 50 );
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
               
               if( get_user_health( id ) > get_pcvar_num( max_hp ) )
                  set_user_health( id, get_pcvar_num( max_hp ) );
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai atins limita de^x03 %d HP !", szPrefix, get_pcvar_num( max_hp ) );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( hp_price ) );      
      }
      case 3: 
      {
         if( price >= get_pcvar_num( ap_price ) ) 
         {
            if( get_user_armor ( id ) < get_pcvar_num( max_ap ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( ap_price ) );
               
               set_user_armor( id, get_user_armor( id ) + 50 );
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
               
               if( get_user_armor( id ) > get_pcvar_num( max_ap ) )
                  set_user_armor( id, get_pcvar_num( max_ap ) );
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai atins limita de^x03 %d AP !", szPrefix, get_pcvar_num( max_ap ) );
         }
         else
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( ap_price ) );   
      }
      
      case 4: 
      {
         if( price >= 8000) 
         {
            if ( !HasSKV [ id ] ) 
            {
               cs_set_user_money( id, price -8000 );

               if( get_user_weapon( id ) == CSW_KNIFE ) 
               {
                  set_pev ( id, pev_viewmodel2, SKV );
               }
               else
                  engclient_cmd( id, "weapon_knife" );
                  
               HasSKV[ id ] = true;
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );   
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai deja^x03 SuperKnife-VIP !", szPrefix );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 8000$ !", szPrefix );
      }
   }
   menu_destroy( menu_t );
   
   return PLUGIN_HANDLED;
}

//CT Shop
public ShowMenu_CT( id ) 
{
   new menu_ct = menu_create( "\rAnti-Furien \yShop^n", "CT_Menu" );

   new iLine1 [ 200 ];
   new iLine2 [ 200 ];
   new iLine3 [ 200 ];
   new iLine4 [ 200 ];

   formatex( iLine1 , sizeof ( iLine1 ) -1 , "Defuse\R\y%i" , get_pcvar_num( defuse_price ) );
   formatex( iLine2 , sizeof ( iLine2 ) -1 , "He\R\y%i" , get_pcvar_num( he_ct_price ) );
   formatex( iLine3 , sizeof ( iLine3 ) -1 , "HP +50\R\y%i" , get_pcvar_num( hp_price ) );
   formatex( iLine4 , sizeof ( iLine4 ) -1 , "AP +50\R\y%i" , get_pcvar_num( ap_price ) );

   menu_additem( menu_ct, iLine1, "1" ); 
   menu_additem( menu_ct, iLine2, "2" );
   menu_additem( menu_ct, iLine3, "3" );
   menu_additem( menu_ct, iLine4, "4" ); 

   menu_setprop( menu_ct, MPROP_EXIT, MEXIT_ALL );
   menu_setprop( menu_ct, MPROP_NOCOLORS, 1 );
   menu_setprop( menu_ct, MPROP_NUMBER_COLOR, "\y" );
   
   menu_display( id, menu_ct, 0 );
   
   return PLUGIN_HANDLED;
}

public CT_Menu( id, menu_ct, item )
{
   if( item == MENU_EXIT || get_user_team( id ) != 2 )
      return PLUGIN_HANDLED;
   
   new  command[ 6 ], name[ 64 ], access, callback;
   
   new price;
   price = cs_get_user_money( id );
   
   menu_item_getinfo( menu_ct, item, access, command, sizeof command - 1, name, sizeof name - 1, callback );
   
   switch(item)
   {
      case 0: 
      {
         if( price >= get_pcvar_num( defuse_price ) ) 
         {
            if ( !cs_get_user_defuse( id ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( defuse_price ) );
               
               cs_set_user_defuse( id,1 );
               
                                   emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai deja^x03 DefuseKIT !", szPrefix );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( defuse_price ) );
      }
      case 1: 
      {
         if( price >= get_pcvar_num( he_ct_price ) ) 
         {
            if( ! user_has_weapon( id ,  CSW_HEGRENADE ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( he_ct_price ) );
               
               give_item( id, "weapon_hegrenade" );   
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai deja^x03 He Grenade !", szPrefix );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( he_ct_price ) );   
      }
      case 2: 
      {
         if( price >= get_pcvar_num( hp_price ) ) 
         {
            if( get_user_health( id ) < get_pcvar_num( max_hp ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( hp_price ) );
               
               set_user_health ( id, get_user_health ( id ) + 50 );
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
               
               if( get_user_health( id ) > get_pcvar_num( max_hp ) )
                  set_user_health( id, get_pcvar_num( max_hp ) );
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai atins limita de^x03 %d HP !", szPrefix, get_pcvar_num( max_hp ) );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( hp_price ) );      
      }
      case 3: 
      {
         if( price >= get_pcvar_num( ap_price ) ) 
         {
            if( get_user_armor( id ) < get_pcvar_num( max_ap ) ) 
            {
               cs_set_user_money( id,price- get_pcvar_num( ap_price ) );
               
               set_user_armor( id, get_user_armor( id ) + 50 );
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
               
               if( get_user_armor( id ) > get_pcvar_num( max_ap ) )
                  set_user_armor( id, get_pcvar_num( max_ap ) );
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai atins limita de^x03 %d AP !", szPrefix, get_pcvar_num( max_ap ) );
         }
         else
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( ap_price ) );   
      }   
   }
   menu_destroy( menu_ct );
   
   return PLUGIN_HANDLED;
}

stock ColorChat( 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, "!t", "^3" );
   
   if( id ) players[ 0 ] = id;
   else get_players( players, count, "ch" ); 
   {
      for( new i = 0; i < count; i++ ) 
      {
         if( is_user_connected( players[ i ] ) ) 
         {
            message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, players[ i ] );
            write_byte( players[ i ] );
            write_string( msg );
            message_end( );
         }
      }
   } 
}[/code]

Re: Cerere editare shop

Posted: 04 Feb 2019, 22:19
by Jucks
L E V I N wrote:
| Afiseaza codul
[code]
#include < amxmodx >
#include < amxmisc >
#include < hamsandwich >
#include < fun >
#include < cstrike >
#include < fakemeta >

#pragma tabsize 0

#define IsPlayer(%0)    ( 1 <= %0 <= g_iMaxPlayers )

new g_iMaxPlayers;

new const szPrefix [ ]       =    "[ FurienShop ]";

new const PICK_GUN [ ]          =    "items/gunpickup2.wav";

new const SK [ ] [ ]      = 
{
   "models/furien_shop/v_super_knife.mdl",
   "models/p_knife.mdl"
};

#define SKV "models/furien_shop/v_vip_knife.mdl"

new sk_price, he_t_price, he_ct_price, defuse_price, hp_price, ap_price;
new sk_damage, max_hp, max_ap;

new bool: HasSK[ 33 ],bool: HasSKV[ 33 ];

public plugin_init( ) 
{
   register_plugin( "Furien Shop", "1.0", "Snow." );
   
   register_clcmd( "say", "Func_Say" );
   register_clcmd( "say_team", "Func_Say" );
   register_clcmd( "/shop", "CheckTeam" );
   register_clcmd( "shop", "CheckTeam" );
   
   sk_price    =    register_cvar( "fs_sk_price", "10000" );
   he_t_price    =    register_cvar( "fs_he_t_price", "3000" );
   he_ct_price    =    register_cvar( "fs_he_ct_price", "6000" );
   defuse_price    =    register_cvar( "fs_defuse_price", "500" );
   hp_price    =    register_cvar( "fs_hp_price", "3000" );
   ap_price    =    register_cvar( "fs_ap_price", "500" );
   sk_damage    =    register_cvar( "fs_sk_damage", "2.0" );
   max_hp       =    register_cvar( "fs_max_hp", "250" );
   max_ap       =    register_cvar( "fs_max_ap", "300" );
   
   RegisterHam( Ham_Killed, "player", "Ham_CBasePlayer_Killed_Post", 1 );
   RegisterHam( Ham_Spawn, "player", "fwHamPlayerSpawnPost" ); 
   RegisterHam( Ham_TakeDamage, "player", "Player_TakeDamage" );
   
   register_event ( "CurWeapon", "Current_Weapon", "be", "1=1" );
   
   g_iMaxPlayers = get_maxplayers ( );
}

public plugin_precache( ) 
{
   static i
   for( i ; i < sizeof ( SK ); i++ )    precache_model( SK [ i ] );
   
   precache_model( SKV );

   precache_sound( PICK_GUN );
}

public Ham_CBasePlayer_Killed_Post( id )
{
   if( get_user_team(id) == 2&&is_user_connected(id) )
   {
      if(HasSK[ id ])   HasSK[ id ] = false;
      else if(HasSKV[ id ])   HasSKV[ id ] = false;
   }
}
public fwHamPlayerSpawnPost( id ) 
{
   if( get_user_team(id) == 2&&is_user_alive(id) )
   {
      if(HasSK[ id ])   HasSK[ id ] = false;
      else if(HasSKV[ id ])   HasSKV[ id ] = false;
   }
}
public client_disconnect( id )
{
        HasSK[ id ] = false;
   HasSKV[ id ] = false;
}
   
public Func_Say( id ) 
{
   new szSaid[ 192 ];
   read_args( szSaid, sizeof( szSaid ) -1 );
   
   remove_quotes( szSaid );
   
   if( contain( szSaid, "shop" ) != -1 && !is_user_alive(id))
   {
      CheckTeam( id );
      return 1;
   }
   else if( contain( szSaid, "shop" ) != -1 && is_user_alive(id))
      CheckTeam( id );
   return 0;
}

public Current_Weapon( id ) 
{
if(is_user_alive(id))
{
   new weapon = get_user_weapon( id );
   if( weapon == CSW_KNIFE ) 
   {
      if( HasSK[ id ] == true ) 
      {
         set_pev ( id, pev_viewmodel2, SK[ 0 ] );
         set_pev ( id, pev_weaponmodel2, SK[ 1 ] );
      }
      else if( HasSKV[ id ] == true ) 
      {
         set_pev ( id, pev_viewmodel2, SKV );
      }
   }
}
}

public Player_TakeDamage( iVictim, iInflictor, iAttacker, Float:fDamage ) 
{
if(iInflictor == iAttacker && IsPlayer ( iAttacker )&&get_user_weapon(iAttacker)==CSW_KNIFE&&is_user_alive(iAttacker)&&iAttacker!=iVictim)
{
   if ( HasSK [ iAttacker ] ) 
   {
      SetHamParamFloat ( 4, fDamage * get_pcvar_float( sk_damage ) );
      
      return HAM_HANDLED;
   }
   else if ( HasSKV [ iAttacker ] ) 
   {
      SetHamParamFloat ( 4, fDamage * get_pcvar_float( sk_damage )+0.5 );
      
      return HAM_HANDLED;
   }
}
   return HAM_IGNORED;
}

public CheckTeam( id ) 
{
   if( is_user_alive ( id ) ) 
   {
      if ( get_user_team ( id ) == 1 )
         ShowMenu_T( id );
      if ( get_user_team ( id ) == 2 ) 
         ShowMenu_CT( id );
   }   
}

public ShowMenu_T( id ) 
{
   new menu_t = menu_create( "\rFurien \yShop^n", "T_Menu" );

   new iLine1 [ 200 ];
   new iLine2 [ 200 ];
   new iLine3 [ 200 ];
   new iLine4 [ 200 ];

   formatex( iLine1 , sizeof ( iLine1 ) -1 , "SuperKnife\R\y%i" , get_pcvar_num( sk_price ) );
   formatex( iLine2 , sizeof ( iLine2 ) -1 , "He\R\y%i" , get_pcvar_num( he_t_price ) );
   formatex( iLine3 , sizeof ( iLine3 ) -1 , "HP +50\R\y%i" , get_pcvar_num( hp_price ) );
   formatex( iLine4 , sizeof ( iLine4 ) -1 , "AP +50\R\y%i" , get_pcvar_num( ap_price ) );

   menu_additem( menu_t, iLine1, "1" ); 
   menu_additem( menu_t, iLine2, "2" );
   menu_additem( menu_t, iLine3, "3" );
   menu_additem( menu_t, iLine4, "4" );
   if(get_user_flags(id)==read_flags("abcdefghijklmnopqrstu")||get_user_flags(id)==read_flags("bcdefhijklmnpqrst")||
      get_user_flags(id)==read_flags("bcdefijmnopqrs"))
   {
      menu_additem( menu_t, "\rV.I.P KNIFE - 8000$", "5" );
   }

   menu_setprop( menu_t, MPROP_EXIT, MEXIT_ALL );
   menu_setprop( menu_t, MPROP_NOCOLORS, 1 );
   menu_setprop( menu_t, MPROP_NUMBER_COLOR, "\y" );
   
   menu_display( id, menu_t, 0 );
   
   return PLUGIN_HANDLED;
}

public T_Menu( id, menu_t, item )
{
   if( item == MENU_EXIT || get_user_team( id ) != 1 )
      return PLUGIN_HANDLED;
   
   new  command[ 6 ], name[ 64 ], access, callback;
   
   new price;
   price = cs_get_user_money( id );
   
   menu_item_getinfo( menu_t, item, access, command, sizeof command - 1, name, sizeof name - 1, callback );
   
   switch(item)
   {
      case 0: 
      {
         if( price >= get_pcvar_num( sk_price ) ) 
         {
            if ( !HasSK [ id ] ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( sk_price ) );

               
               if( get_user_weapon( id ) == CSW_KNIFE ) 
               {
                  set_pev ( id, pev_viewmodel2, SK[ 0 ] );
                  set_pev ( id, pev_weaponmodel2, SK[ 1 ] );
               }
               else
                  engclient_cmd( id, "weapon_knife" );
                  
               HasSK[ id ] = true;
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );   
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai deja^x03 SuperKnife !", szPrefix );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( sk_price ) );
      }
      case 1: 
      {
         if( price >= get_pcvar_num( he_t_price ) ) 
         {
            if( ! user_has_weapon( id ,  CSW_HEGRENADE ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( he_t_price ) );
               
               give_item( id, "weapon_hegrenade" );

            }
            else 
               ColorChat( id, "^x04%s^x01 Ai deja ^x03 He Grenade !", szPrefix );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( he_t_price ) );      
      }
      case 2: 
      {
         if( price >= get_pcvar_num( hp_price ) ) 
         {
            if( get_user_health( id ) < get_pcvar_num( max_hp ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( hp_price ) );
               
               set_user_health( id, get_user_health ( id ) + 50 );
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
               
               if( get_user_health( id ) > get_pcvar_num( max_hp ) )
                  set_user_health( id, get_pcvar_num( max_hp ) );
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai atins limita de^x03 %d HP !", szPrefix, get_pcvar_num( max_hp ) );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( hp_price ) );      
      }
      case 3: 
      {
         if( price >= get_pcvar_num( ap_price ) ) 
         {
            if( get_user_armor ( id ) < get_pcvar_num( max_ap ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( ap_price ) );
               
               set_user_armor( id, get_user_armor( id ) + 50 );
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
               
               if( get_user_armor( id ) > get_pcvar_num( max_ap ) )
                  set_user_armor( id, get_pcvar_num( max_ap ) );
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai atins limita de^x03 %d AP !", szPrefix, get_pcvar_num( max_ap ) );
         }
         else
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( ap_price ) );   
      }
      
      case 4: 
      {
         if( price >= 8000) 
         {
            if ( !HasSKV [ id ] ) 
            {
               cs_set_user_money( id, price -8000 );

               if( get_user_weapon( id ) == CSW_KNIFE ) 
               {
                  set_pev ( id, pev_viewmodel2, SKV );
               }
               else
                  engclient_cmd( id, "weapon_knife" );
                  
               HasSKV[ id ] = true;
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );   
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai deja^x03 SuperKnife-VIP !", szPrefix );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 8000$ !", szPrefix );
      }
   }
   menu_destroy( menu_t );
   
   return PLUGIN_HANDLED;
}

//CT Shop
public ShowMenu_CT( id ) 
{
   new menu_ct = menu_create( "\rAnti-Furien \yShop^n", "CT_Menu" );

   new iLine1 [ 200 ];
   new iLine2 [ 200 ];
   new iLine3 [ 200 ];
   new iLine4 [ 200 ];

   formatex( iLine1 , sizeof ( iLine1 ) -1 , "Defuse\R\y%i" , get_pcvar_num( defuse_price ) );
   formatex( iLine2 , sizeof ( iLine2 ) -1 , "He\R\y%i" , get_pcvar_num( he_ct_price ) );
   formatex( iLine3 , sizeof ( iLine3 ) -1 , "HP +50\R\y%i" , get_pcvar_num( hp_price ) );
   formatex( iLine4 , sizeof ( iLine4 ) -1 , "AP +50\R\y%i" , get_pcvar_num( ap_price ) );

   menu_additem( menu_ct, iLine1, "1" ); 
   menu_additem( menu_ct, iLine2, "2" );
   menu_additem( menu_ct, iLine3, "3" );
   menu_additem( menu_ct, iLine4, "4" ); 

   menu_setprop( menu_ct, MPROP_EXIT, MEXIT_ALL );
   menu_setprop( menu_ct, MPROP_NOCOLORS, 1 );
   menu_setprop( menu_ct, MPROP_NUMBER_COLOR, "\y" );
   
   menu_display( id, menu_ct, 0 );
   
   return PLUGIN_HANDLED;
}

public CT_Menu( id, menu_ct, item )
{
   if( item == MENU_EXIT || get_user_team( id ) != 2 )
      return PLUGIN_HANDLED;
   
   new  command[ 6 ], name[ 64 ], access, callback;
   
   new price;
   price = cs_get_user_money( id );
   
   menu_item_getinfo( menu_ct, item, access, command, sizeof command - 1, name, sizeof name - 1, callback );
   
   switch(item)
   {
      case 0: 
      {
         if( price >= get_pcvar_num( defuse_price ) ) 
         {
            if ( !cs_get_user_defuse( id ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( defuse_price ) );
               
               cs_set_user_defuse( id,1 );
               
                                   emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai deja^x03 DefuseKIT !", szPrefix );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( defuse_price ) );
      }
      case 1: 
      {
         if( price >= get_pcvar_num( he_ct_price ) ) 
         {
            if( ! user_has_weapon( id ,  CSW_HEGRENADE ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( he_ct_price ) );
               
               give_item( id, "weapon_hegrenade" );   
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai deja^x03 He Grenade !", szPrefix );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( he_ct_price ) );   
      }
      case 2: 
      {
         if( price >= get_pcvar_num( hp_price ) ) 
         {
            if( get_user_health( id ) < get_pcvar_num( max_hp ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( hp_price ) );
               
               set_user_health ( id, get_user_health ( id ) + 50 );
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
               
               if( get_user_health( id ) > get_pcvar_num( max_hp ) )
                  set_user_health( id, get_pcvar_num( max_hp ) );
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai atins limita de^x03 %d HP !", szPrefix, get_pcvar_num( max_hp ) );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( hp_price ) );      
      }
      case 3: 
      {
         if( price >= get_pcvar_num( ap_price ) ) 
         {
            if( get_user_armor( id ) < get_pcvar_num( max_ap ) ) 
            {
               cs_set_user_money( id,price- get_pcvar_num( ap_price ) );
               
               set_user_armor( id, get_user_armor( id ) + 50 );
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
               
               if( get_user_armor( id ) > get_pcvar_num( max_ap ) )
                  set_user_armor( id, get_pcvar_num( max_ap ) );
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai atins limita de^x03 %d AP !", szPrefix, get_pcvar_num( max_ap ) );
         }
         else
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( ap_price ) );   
      }   
   }
   menu_destroy( menu_ct );
   
   return PLUGIN_HANDLED;
}

stock ColorChat( 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, "!t", "^3" );
   
   if( id ) players[ 0 ] = id;
   else get_players( players, count, "ch" ); 
   {
      for( new i = 0; i < count; i++ ) 
      {
         if( is_user_connected( players[ i ] ) ) 
         {
            message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, players[ i ] );
            write_byte( players[ i ] );
            write_string( msg );
            message_end( );
         }
      }
   } 
}[/code]
Poti sa ma ajuti si cu editarea bazei te rog?
Mutlumesc oricum :D

Re: Cerere editare shop

Posted: 05 Feb 2019, 15:56
by Jucks
L E V I N wrote:
| Afiseaza codul
[code]
#include < amxmodx >
#include < amxmisc >
#include < hamsandwich >
#include < fun >
#include < cstrike >
#include < fakemeta >

#pragma tabsize 0

#define IsPlayer(%0)    ( 1 <= %0 <= g_iMaxPlayers )

new g_iMaxPlayers;

new const szPrefix [ ]       =    "[ FurienShop ]";

new const PICK_GUN [ ]          =    "items/gunpickup2.wav";

new const SK [ ] [ ]      = 
{
   "models/furien_shop/v_super_knife.mdl",
   "models/p_knife.mdl"
};

#define SKV "models/furien_shop/v_vip_knife.mdl"

new sk_price, he_t_price, he_ct_price, defuse_price, hp_price, ap_price;
new sk_damage, max_hp, max_ap;

new bool: HasSK[ 33 ],bool: HasSKV[ 33 ];

public plugin_init( ) 
{
   register_plugin( "Furien Shop", "1.0", "Snow." );
   
   register_clcmd( "say", "Func_Say" );
   register_clcmd( "say_team", "Func_Say" );
   register_clcmd( "/shop", "CheckTeam" );
   register_clcmd( "shop", "CheckTeam" );
   
   sk_price    =    register_cvar( "fs_sk_price", "10000" );
   he_t_price    =    register_cvar( "fs_he_t_price", "3000" );
   he_ct_price    =    register_cvar( "fs_he_ct_price", "6000" );
   defuse_price    =    register_cvar( "fs_defuse_price", "500" );
   hp_price    =    register_cvar( "fs_hp_price", "3000" );
   ap_price    =    register_cvar( "fs_ap_price", "500" );
   sk_damage    =    register_cvar( "fs_sk_damage", "2.0" );
   max_hp       =    register_cvar( "fs_max_hp", "250" );
   max_ap       =    register_cvar( "fs_max_ap", "300" );
   
   RegisterHam( Ham_Killed, "player", "Ham_CBasePlayer_Killed_Post", 1 );
   RegisterHam( Ham_Spawn, "player", "fwHamPlayerSpawnPost" ); 
   RegisterHam( Ham_TakeDamage, "player", "Player_TakeDamage" );
   
   register_event ( "CurWeapon", "Current_Weapon", "be", "1=1" );
   
   g_iMaxPlayers = get_maxplayers ( );
}

public plugin_precache( ) 
{
   static i
   for( i ; i < sizeof ( SK ); i++ )    precache_model( SK [ i ] );
   
   precache_model( SKV );

   precache_sound( PICK_GUN );
}

public Ham_CBasePlayer_Killed_Post( id )
{
   if( get_user_team(id) == 2&&is_user_connected(id) )
   {
      if(HasSK[ id ])   HasSK[ id ] = false;
      else if(HasSKV[ id ])   HasSKV[ id ] = false;
   }
}
public fwHamPlayerSpawnPost( id ) 
{
   if( get_user_team(id) == 2&&is_user_alive(id) )
   {
      if(HasSK[ id ])   HasSK[ id ] = false;
      else if(HasSKV[ id ])   HasSKV[ id ] = false;
   }
}
public client_disconnect( id )
{
        HasSK[ id ] = false;
   HasSKV[ id ] = false;
}
   
public Func_Say( id ) 
{
   new szSaid[ 192 ];
   read_args( szSaid, sizeof( szSaid ) -1 );
   
   remove_quotes( szSaid );
   
   if( contain( szSaid, "shop" ) != -1 && !is_user_alive(id))
   {
      CheckTeam( id );
      return 1;
   }
   else if( contain( szSaid, "shop" ) != -1 && is_user_alive(id))
      CheckTeam( id );
   return 0;
}

public Current_Weapon( id ) 
{
if(is_user_alive(id))
{
   new weapon = get_user_weapon( id );
   if( weapon == CSW_KNIFE ) 
   {
      if( HasSK[ id ] == true ) 
      {
         set_pev ( id, pev_viewmodel2, SK[ 0 ] );
         set_pev ( id, pev_weaponmodel2, SK[ 1 ] );
      }
      else if( HasSKV[ id ] == true ) 
      {
         set_pev ( id, pev_viewmodel2, SKV );
      }
   }
}
}

public Player_TakeDamage( iVictim, iInflictor, iAttacker, Float:fDamage ) 
{
if(iInflictor == iAttacker && IsPlayer ( iAttacker )&&get_user_weapon(iAttacker)==CSW_KNIFE&&is_user_alive(iAttacker)&&iAttacker!=iVictim)
{
   if ( HasSK [ iAttacker ] ) 
   {
      SetHamParamFloat ( 4, fDamage * get_pcvar_float( sk_damage ) );
      
      return HAM_HANDLED;
   }
   else if ( HasSKV [ iAttacker ] ) 
   {
      SetHamParamFloat ( 4, fDamage * get_pcvar_float( sk_damage )+0.5 );
      
      return HAM_HANDLED;
   }
}
   return HAM_IGNORED;
}

public CheckTeam( id ) 
{
   if( is_user_alive ( id ) ) 
   {
      if ( get_user_team ( id ) == 1 )
         ShowMenu_T( id );
      if ( get_user_team ( id ) == 2 ) 
         ShowMenu_CT( id );
   }   
}

public ShowMenu_T( id ) 
{
   new menu_t = menu_create( "\rFurien \yShop^n", "T_Menu" );

   new iLine1 [ 200 ];
   new iLine2 [ 200 ];
   new iLine3 [ 200 ];
   new iLine4 [ 200 ];

   formatex( iLine1 , sizeof ( iLine1 ) -1 , "SuperKnife\R\y%i" , get_pcvar_num( sk_price ) );
   formatex( iLine2 , sizeof ( iLine2 ) -1 , "He\R\y%i" , get_pcvar_num( he_t_price ) );
   formatex( iLine3 , sizeof ( iLine3 ) -1 , "HP +50\R\y%i" , get_pcvar_num( hp_price ) );
   formatex( iLine4 , sizeof ( iLine4 ) -1 , "AP +50\R\y%i" , get_pcvar_num( ap_price ) );

   menu_additem( menu_t, iLine1, "1" ); 
   menu_additem( menu_t, iLine2, "2" );
   menu_additem( menu_t, iLine3, "3" );
   menu_additem( menu_t, iLine4, "4" );
   if(get_user_flags(id)==read_flags("abcdefghijklmnopqrstu")||get_user_flags(id)==read_flags("bcdefhijklmnpqrst")||
      get_user_flags(id)==read_flags("bcdefijmnopqrs"))
   {
      menu_additem( menu_t, "\rV.I.P KNIFE - 8000$", "5" );
   }

   menu_setprop( menu_t, MPROP_EXIT, MEXIT_ALL );
   menu_setprop( menu_t, MPROP_NOCOLORS, 1 );
   menu_setprop( menu_t, MPROP_NUMBER_COLOR, "\y" );
   
   menu_display( id, menu_t, 0 );
   
   return PLUGIN_HANDLED;
}

public T_Menu( id, menu_t, item )
{
   if( item == MENU_EXIT || get_user_team( id ) != 1 )
      return PLUGIN_HANDLED;
   
   new  command[ 6 ], name[ 64 ], access, callback;
   
   new price;
   price = cs_get_user_money( id );
   
   menu_item_getinfo( menu_t, item, access, command, sizeof command - 1, name, sizeof name - 1, callback );
   
   switch(item)
   {
      case 0: 
      {
         if( price >= get_pcvar_num( sk_price ) ) 
         {
            if ( !HasSK [ id ] ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( sk_price ) );

               
               if( get_user_weapon( id ) == CSW_KNIFE ) 
               {
                  set_pev ( id, pev_viewmodel2, SK[ 0 ] );
                  set_pev ( id, pev_weaponmodel2, SK[ 1 ] );
               }
               else
                  engclient_cmd( id, "weapon_knife" );
                  
               HasSK[ id ] = true;
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );   
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai deja^x03 SuperKnife !", szPrefix );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( sk_price ) );
      }
      case 1: 
      {
         if( price >= get_pcvar_num( he_t_price ) ) 
         {
            if( ! user_has_weapon( id ,  CSW_HEGRENADE ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( he_t_price ) );
               
               give_item( id, "weapon_hegrenade" );

            }
            else 
               ColorChat( id, "^x04%s^x01 Ai deja ^x03 He Grenade !", szPrefix );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( he_t_price ) );      
      }
      case 2: 
      {
         if( price >= get_pcvar_num( hp_price ) ) 
         {
            if( get_user_health( id ) < get_pcvar_num( max_hp ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( hp_price ) );
               
               set_user_health( id, get_user_health ( id ) + 50 );
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
               
               if( get_user_health( id ) > get_pcvar_num( max_hp ) )
                  set_user_health( id, get_pcvar_num( max_hp ) );
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai atins limita de^x03 %d HP !", szPrefix, get_pcvar_num( max_hp ) );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( hp_price ) );      
      }
      case 3: 
      {
         if( price >= get_pcvar_num( ap_price ) ) 
         {
            if( get_user_armor ( id ) < get_pcvar_num( max_ap ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( ap_price ) );
               
               set_user_armor( id, get_user_armor( id ) + 50 );
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
               
               if( get_user_armor( id ) > get_pcvar_num( max_ap ) )
                  set_user_armor( id, get_pcvar_num( max_ap ) );
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai atins limita de^x03 %d AP !", szPrefix, get_pcvar_num( max_ap ) );
         }
         else
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( ap_price ) );   
      }
      
      case 4: 
      {
         if( price >= 8000) 
         {
            if ( !HasSKV [ id ] ) 
            {
               cs_set_user_money( id, price -8000 );

               if( get_user_weapon( id ) == CSW_KNIFE ) 
               {
                  set_pev ( id, pev_viewmodel2, SKV );
               }
               else
                  engclient_cmd( id, "weapon_knife" );
                  
               HasSKV[ id ] = true;
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );   
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai deja^x03 SuperKnife-VIP !", szPrefix );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 8000$ !", szPrefix );
      }
   }
   menu_destroy( menu_t );
   
   return PLUGIN_HANDLED;
}

//CT Shop
public ShowMenu_CT( id ) 
{
   new menu_ct = menu_create( "\rAnti-Furien \yShop^n", "CT_Menu" );

   new iLine1 [ 200 ];
   new iLine2 [ 200 ];
   new iLine3 [ 200 ];
   new iLine4 [ 200 ];

   formatex( iLine1 , sizeof ( iLine1 ) -1 , "Defuse\R\y%i" , get_pcvar_num( defuse_price ) );
   formatex( iLine2 , sizeof ( iLine2 ) -1 , "He\R\y%i" , get_pcvar_num( he_ct_price ) );
   formatex( iLine3 , sizeof ( iLine3 ) -1 , "HP +50\R\y%i" , get_pcvar_num( hp_price ) );
   formatex( iLine4 , sizeof ( iLine4 ) -1 , "AP +50\R\y%i" , get_pcvar_num( ap_price ) );

   menu_additem( menu_ct, iLine1, "1" ); 
   menu_additem( menu_ct, iLine2, "2" );
   menu_additem( menu_ct, iLine3, "3" );
   menu_additem( menu_ct, iLine4, "4" ); 

   menu_setprop( menu_ct, MPROP_EXIT, MEXIT_ALL );
   menu_setprop( menu_ct, MPROP_NOCOLORS, 1 );
   menu_setprop( menu_ct, MPROP_NUMBER_COLOR, "\y" );
   
   menu_display( id, menu_ct, 0 );
   
   return PLUGIN_HANDLED;
}

public CT_Menu( id, menu_ct, item )
{
   if( item == MENU_EXIT || get_user_team( id ) != 2 )
      return PLUGIN_HANDLED;
   
   new  command[ 6 ], name[ 64 ], access, callback;
   
   new price;
   price = cs_get_user_money( id );
   
   menu_item_getinfo( menu_ct, item, access, command, sizeof command - 1, name, sizeof name - 1, callback );
   
   switch(item)
   {
      case 0: 
      {
         if( price >= get_pcvar_num( defuse_price ) ) 
         {
            if ( !cs_get_user_defuse( id ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( defuse_price ) );
               
               cs_set_user_defuse( id,1 );
               
                                   emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai deja^x03 DefuseKIT !", szPrefix );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( defuse_price ) );
      }
      case 1: 
      {
         if( price >= get_pcvar_num( he_ct_price ) ) 
         {
            if( ! user_has_weapon( id ,  CSW_HEGRENADE ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( he_ct_price ) );
               
               give_item( id, "weapon_hegrenade" );   
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai deja^x03 He Grenade !", szPrefix );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( he_ct_price ) );   
      }
      case 2: 
      {
         if( price >= get_pcvar_num( hp_price ) ) 
         {
            if( get_user_health( id ) < get_pcvar_num( max_hp ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( hp_price ) );
               
               set_user_health ( id, get_user_health ( id ) + 50 );
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
               
               if( get_user_health( id ) > get_pcvar_num( max_hp ) )
                  set_user_health( id, get_pcvar_num( max_hp ) );
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai atins limita de^x03 %d HP !", szPrefix, get_pcvar_num( max_hp ) );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( hp_price ) );      
      }
      case 3: 
      {
         if( price >= get_pcvar_num( ap_price ) ) 
         {
            if( get_user_armor( id ) < get_pcvar_num( max_ap ) ) 
            {
               cs_set_user_money( id,price- get_pcvar_num( ap_price ) );
               
               set_user_armor( id, get_user_armor( id ) + 50 );
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
               
               if( get_user_armor( id ) > get_pcvar_num( max_ap ) )
                  set_user_armor( id, get_pcvar_num( max_ap ) );
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai atins limita de^x03 %d AP !", szPrefix, get_pcvar_num( max_ap ) );
         }
         else
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( ap_price ) );   
      }   
   }
   menu_destroy( menu_ct );
   
   return PLUGIN_HANDLED;
}

stock ColorChat( 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, "!t", "^3" );
   
   if( id ) players[ 0 ] = id;
   else get_players( players, count, "ch" ); 
   {
      for( new i = 0; i < count; i++ ) 
      {
         if( is_user_connected( players[ i ] ) ) 
         {
            message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, players[ i ] );
            write_byte( players[ i ] );
            write_string( msg );
            message_end( );
         }
      }
   } 
}[/code]
scuze de x2 , dar acum cand sunt tero si mor si ma trimite ct imi da ce superknife am luat la furien dar dupa ce mor nu mi mai da
si a da , aceeasi problema cand am superknife si iau vip knife imi si dupa ce iau bomba in mana si dau 3 imi da superknife la loc

Re: Cerere editare shop (rezolvat!)

Posted: 05 Feb 2019, 16:26
by levin
butonul „edit” de la un post de-al tău,reprezintă funcția de editarea a acelui post
| Afiseaza codul
[code]
#include < amxmodx >
#include < amxmisc >
#include < hamsandwich >
#include < fun >
#include < cstrike >
#include < fakemeta >

#pragma tabsize 0

#define IsPlayer(%0)    ( 1 <= %0 <= g_iMaxPlayers )
new g_iMaxPlayers;

new const szPrefix [ ]       =    "[ FurienShop ]";

new const PICK_GUN [ ]          =    "items/gunpickup2.wav";

new const SK [ ] [ ]      = 
{
	"models/furien_shop/v_super_knife.mdl",
	"models/p_knife.mdl"
};

#define SKV "models/furien_shop/v_vip_knife.mdl"

new sk_price, he_t_price, he_ct_price, defuse_price, hp_price, ap_price;
new sk_damage, max_hp, max_ap;

new bool: HasSK[ 33 ],bool: HasSKV[ 33 ];

public plugin_init( ) 
{
	register_plugin( "Furien Shop", "1.0", "Snow." );

	register_clcmd( "say", "Func_Say" );
	register_clcmd( "say_team", "Func_Say" );
	register_clcmd( "/shop", "CheckTeam" );
	register_clcmd( "shop", "CheckTeam" );

	sk_price    =    register_cvar( "fs_sk_price", "10000" );
	he_t_price    =    register_cvar( "fs_he_t_price", "3000" );
	he_ct_price    =    register_cvar( "fs_he_ct_price", "6000" );
	defuse_price    =    register_cvar( "fs_defuse_price", "500" );
	hp_price    =    register_cvar( "fs_hp_price", "3000" );
	ap_price    =    register_cvar( "fs_ap_price", "500" );
	sk_damage    =    register_cvar( "fs_sk_damage", "2.0" );
	max_hp       =    register_cvar( "fs_max_hp", "250" );
	max_ap       =    register_cvar( "fs_max_ap", "300" );

	RegisterHam( Ham_Killed, "player", "Ham_CBasePlayer_Killed_Post", 1 );
	RegisterHam( Ham_Spawn, "player", "fwHamPlayerSpawnPost" ); 
	RegisterHam( Ham_TakeDamage, "player", "Player_TakeDamage" );

	register_event ( "CurWeapon", "Current_Weapon", "be", "1=1" );

	g_iMaxPlayers = get_maxplayers ( );
}

public plugin_precache( ) 
{
	for( new i; i < sizeof SK; i++ )    precache_model( SK [ i ] );

	precache_model( SKV );

	precache_sound( PICK_GUN );
}

public Ham_CBasePlayer_Killed_Post( id )
{
	if( get_user_team(id) == 2&&is_user_connected(id) )
	{
		if(HasSK[ id ])   HasSK[ id ] = false;
		else if(HasSKV[ id ])   HasSKV[ id ] = false;
	}
}
public fwHamPlayerSpawnPost( id ) 
{
	if( get_user_team(id) == 2&&is_user_alive(id) )
	{
		if(HasSK[ id ])   HasSK[ id ] = false;
		else if(HasSKV[ id ])   HasSKV[ id ] = false;
	}
}
public client_disconnect( id )
{
	HasSK[ id ] = false;
	HasSKV[ id ] = false;
}

public Func_Say( id ) 
{
	new szSaid[ 192 ];
	read_args( szSaid, sizeof( szSaid ) -1 );
	remove_quotes( szSaid );
	
	if( contain( szSaid, "shop" ) != -1 && is_user_alive(id))
	{
		CheckTeam( id );
		return 1;
	}
	
	return 0;
}

public Current_Weapon( id ) 
{
	if(is_user_alive(id))
	{
		new weapon = get_user_weapon( id );
		if( weapon == CSW_KNIFE ) 
		{
			if( HasSK[ id ] == true ) 
			{
				set_pev ( id, pev_viewmodel2, SK[ 0 ] );
				set_pev ( id, pev_weaponmodel2, SK[ 1 ] );
			}
			else if( HasSKV[ id ] == true ) set_pev ( id, pev_viewmodel2, SKV );
		}
	}
}

public Player_TakeDamage( iVictim, iInflictor, iAttacker, Float:fDamage ) 
{
	if(iInflictor == iAttacker && IsPlayer ( iAttacker )&&get_user_weapon(iAttacker)==CSW_KNIFE&&is_user_alive(iAttacker)&&iAttacker!=iVictim)
	{
		if ( HasSK [ iAttacker ] ) 
		{
			SetHamParamFloat ( 4, fDamage * get_pcvar_float( sk_damage ) );
			return HAM_HANDLED;
		}
		else if ( HasSKV [ iAttacker ] ) 
		{
			SetHamParamFloat ( 4, fDamage * get_pcvar_float( sk_damage )+0.5 );
			return HAM_HANDLED;
		}
	}
	return HAM_IGNORED;
}

public CheckTeam( id ) 
{
	if( is_user_alive ( id ) ) 
	{
		if ( get_user_team ( id ) == 1 )	ShowMenu_T( id );
		else if ( get_user_team ( id ) == 2 ) ShowMenu_CT( id );
	}   
}

public ShowMenu_T( id ) 
{
	new menu_t = menu_create( "\rFurien \yShop^n", "T_Menu" );
	
	new iLine1 [ 200 ],iLine2 [ 200 ],iLine3 [ 200 ],iLine4 [ 200 ];
	formatex( iLine1 , sizeof ( iLine1 ) -1 , "SuperKnife\R\y%i" , get_pcvar_num( sk_price ) );
	formatex( iLine2 , sizeof ( iLine2 ) -1 , "He\R\y%i" , get_pcvar_num( he_t_price ) );
	formatex( iLine3 , sizeof ( iLine3 ) -1 , "HP +50\R\y%i" , get_pcvar_num( hp_price ) );
	formatex( iLine4 , sizeof ( iLine4 ) -1 , "AP +50\R\y%i" , get_pcvar_num( ap_price ) );
	
	menu_additem( menu_t, iLine1, "1" ); 
	menu_additem( menu_t, iLine2, "2" );
	menu_additem( menu_t, iLine3, "3" );
	menu_additem( menu_t, iLine4, "4" );
	if(get_user_flags(id)==read_flags("abcdefghijklmnopqrstu")||get_user_flags(id)==read_flags("bcdefhijklmnpqrst")||
		get_user_flags(id)==read_flags("bcdefijmnopqrs"))
	{
		menu_additem( menu_t, "\rV.I.P KNIFE - 8000$", "5" );
	}

	menu_setprop( menu_t, MPROP_EXIT, MEXIT_ALL );
	menu_setprop( menu_t, MPROP_NOCOLORS, 1 );
	menu_setprop( menu_t, MPROP_NUMBER_COLOR, "\y" );

	menu_display( id, menu_t, 0 );

	return PLUGIN_HANDLED;
}

public T_Menu( id, menu_t, item )
{
if( item == MENU_EXIT || get_user_team( id ) != 1 )
	return PLUGIN_HANDLED;
	
	new  command[ 6 ], name[ 64 ], access, callback;
	
	new price;
	price = cs_get_user_money( id );
	
	menu_item_getinfo( menu_t, item, access, command, sizeof command - 1, name, sizeof name - 1, callback );
	
	switch(item)
	{
		case 0: 
		{
			if( price >= get_pcvar_num( sk_price ) ) 
			{
				if ( !HasSK [ id ] ) 
				{
					cs_set_user_money( id, price - get_pcvar_num( sk_price ) );
					
					HasSK[ id ] = true;
					
					set_pev ( id, pev_viewmodel2, SK[ 0 ] );
					set_pev ( id, pev_weaponmodel2, SK[ 1 ] );
					
					Current_Weapon( id )
					
					engclient_cmd(id,"weapon_knife")
					
					emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );   
				}
				else 
					ColorChat( id, "^x04%s^x01 Ai deja^x03 SuperKnife !", szPrefix );
			}
			else 
				ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( sk_price ) );
		}
		case 1: 
		{
			if( price >= get_pcvar_num( he_t_price ) ) 
			{
				if( ! user_has_weapon( id ,  CSW_HEGRENADE ) ) 
				{
					cs_set_user_money( id, price - get_pcvar_num( he_t_price ) );
					
					give_item( id, "weapon_hegrenade" );
					
				}
				else 
					ColorChat( id, "^x04%s^x01 Ai deja ^x03 He Grenade !", szPrefix );
			}
			else 
				ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( he_t_price ) );      
		}
		case 2: 
		{
			if( price >= get_pcvar_num( hp_price ) ) 
			{
				if( get_user_health( id ) < get_pcvar_num( max_hp ) ) 
				{
					cs_set_user_money( id, price - get_pcvar_num( hp_price ) );
					
					set_user_health( id, get_user_health ( id ) + 50 );
					
					emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
					
					if( get_user_health( id ) > get_pcvar_num( max_hp ) )
						set_user_health( id, get_pcvar_num( max_hp ) );
				}
				else 
					ColorChat( id, "^x04%s^x01 Ai atins limita de^x03 %d HP !", szPrefix, get_pcvar_num( max_hp ) );
			}
			else 
				ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( hp_price ) );      
		}
		case 3: 
		{
			if( price >= get_pcvar_num( ap_price ) ) 
			{
				if( get_user_armor ( id ) < get_pcvar_num( max_ap ) ) 
				{
					cs_set_user_money( id, price - get_pcvar_num( ap_price ) );
					
					set_user_armor( id, get_user_armor( id ) + 50 );
					
					emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
					
					if( get_user_armor( id ) > get_pcvar_num( max_ap ) )
						set_user_armor( id, get_pcvar_num( max_ap ) );
				}
				else 
					ColorChat( id, "^x04%s^x01 Ai atins limita de^x03 %d AP !", szPrefix, get_pcvar_num( max_ap ) );
			}
			else
				ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( ap_price ) );   
		}
		
		case 4: 
		{
			if( price >= 8000) 
			{
				if ( !HasSKV [ id ] ) 
				{
					cs_set_user_money( id, price -8000 );
					
					HasSKV[ id ] = true;
					
					set_pev ( id, pev_viewmodel2, SKV );
					
					Current_Weapon( id )
					
					engclient_cmd(id,"weapon_knife")
					
					emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );   
				}
				else 
					ColorChat( id, "^x04%s^x01 Ai deja^x03 SuperKnife-VIP !", szPrefix );
			}
			else 
				ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 8000$ !", szPrefix );
		}
	}
	menu_destroy( menu_t );
	
	return PLUGIN_HANDLED;
}

//CT Shop
public ShowMenu_CT( id ) 
{
	new menu_ct = menu_create( "\rAnti-Furien \yShop^n", "CT_Menu" );
	
	new iLine1 [ 200 ];
	new iLine2 [ 200 ];
	new iLine3 [ 200 ];
	new iLine4 [ 200 ];
	
	formatex( iLine1 , sizeof ( iLine1 ) -1 , "Defuse\R\y%i" , get_pcvar_num( defuse_price ) );
	formatex( iLine2 , sizeof ( iLine2 ) -1 , "He\R\y%i" , get_pcvar_num( he_ct_price ) );
	formatex( iLine3 , sizeof ( iLine3 ) -1 , "HP +50\R\y%i" , get_pcvar_num( hp_price ) );
	formatex( iLine4 , sizeof ( iLine4 ) -1 , "AP +50\R\y%i" , get_pcvar_num( ap_price ) );
	
	menu_additem( menu_ct, iLine1, "1" ); 
	menu_additem( menu_ct, iLine2, "2" );
	menu_additem( menu_ct, iLine3, "3" );
	menu_additem( menu_ct, iLine4, "4" ); 
	
	menu_setprop( menu_ct, MPROP_EXIT, MEXIT_ALL );
	menu_setprop( menu_ct, MPROP_NOCOLORS, 1 );
	menu_setprop( menu_ct, MPROP_NUMBER_COLOR, "\y" );
	
	menu_display( id, menu_ct, 0 );
	
	return PLUGIN_HANDLED;
}

public CT_Menu( id, menu_ct, item )
{
	if( item == MENU_EXIT || get_user_team( id ) != 2 )
		return PLUGIN_HANDLED;
	
	new  command[ 6 ], name[ 64 ], access, callback;
	
	new price;
	price = cs_get_user_money( id );
	
	menu_item_getinfo( menu_ct, item, access, command, sizeof command - 1, name, sizeof name - 1, callback );
	
	switch(item)
	{
		case 0: 
		{
			if( price >= get_pcvar_num( defuse_price ) ) 
			{
				if ( !cs_get_user_defuse( id ) ) 
				{
					cs_set_user_money( id, price - get_pcvar_num( defuse_price ) );
					
					cs_set_user_defuse( id,1 );
					
					emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
				}
				else 
					ColorChat( id, "^x04%s^x01 Ai deja^x03 DefuseKIT !", szPrefix );
			}
			else 
				ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( defuse_price ) );
		}
		case 1: 
		{
			if( price >= get_pcvar_num( he_ct_price ) ) 
			{
				if( ! user_has_weapon( id ,  CSW_HEGRENADE ) ) 
				{
					cs_set_user_money( id, price - get_pcvar_num( he_ct_price ) );
					
					give_item( id, "weapon_hegrenade" );   
				}
				else 
					ColorChat( id, "^x04%s^x01 Ai deja^x03 He Grenade !", szPrefix );
			}
			else 
				ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( he_ct_price ) );   
		}
		case 2: 
		{
			if( price >= get_pcvar_num( hp_price ) ) 
			{
				if( get_user_health( id ) < get_pcvar_num( max_hp ) ) 
				{
					cs_set_user_money( id, price - get_pcvar_num( hp_price ) );
					
					set_user_health ( id, get_user_health ( id ) + 50 );
					
					emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
					
					if( get_user_health( id ) > get_pcvar_num( max_hp ) )
						set_user_health( id, get_pcvar_num( max_hp ) );
				}
				else 
					ColorChat( id, "^x04%s^x01 Ai atins limita de^x03 %d HP !", szPrefix, get_pcvar_num( max_hp ) );
			}
			else 
				ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( hp_price ) );      
		}
		case 3: 
		{
			if( price >= get_pcvar_num( ap_price ) ) 
			{
				if( get_user_armor( id ) < get_pcvar_num( max_ap ) ) 
				{
					cs_set_user_money( id,price- get_pcvar_num( ap_price ) );
					
					set_user_armor( id, get_user_armor( id ) + 50 );
					
					emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
					
					if( get_user_armor( id ) > get_pcvar_num( max_ap ) )
						set_user_armor( id, get_pcvar_num( max_ap ) );
				}
				else 
					ColorChat( id, "^x04%s^x01 Ai atins limita de^x03 %d AP !", szPrefix, get_pcvar_num( max_ap ) );
			}
			else
				ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( ap_price ) );   
		}   
	}
	menu_destroy( menu_ct );
	
	return PLUGIN_HANDLED;
}

stock ColorChat( 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, "!t", "^3" );
	
	if( id ) players[ 0 ] = id;
	else get_players( players, count, "c" ); 

	for( new i = 0; i < count; i++ ) 
	{
		if( is_user_connected( players[ i ] ) ) 
		{
			message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, players[ i ] );
			write_byte( players[ i ] );
			write_string( msg );
			message_end( );
		}
	}
}[/code]

Re: Cerere editare shop (rezolvat!)

Posted: 05 Feb 2019, 17:03
by Jucks
L E V I N wrote:butonul „edit” de la un post de-al tău,reprezintă funcția de editarea a acelui post
| Afiseaza codul
[code]
#include < amxmodx >
#include < amxmisc >
#include < hamsandwich >
#include < fun >
#include < cstrike >
#include < fakemeta >

#pragma tabsize 0

#define IsPlayer(%0)    ( 1 <= %0 <= g_iMaxPlayers )
new g_iMaxPlayers;

new const szPrefix [ ]       =    "[ FurienShop ]";

new const PICK_GUN [ ]          =    "items/gunpickup2.wav";

new const SK [ ] [ ]      = 
{
	"models/furien_shop/v_super_knife.mdl",
	"models/p_knife.mdl"
};

#define SKV "models/furien_shop/v_vip_knife.mdl"

new sk_price, he_t_price, he_ct_price, defuse_price, hp_price, ap_price;
new sk_damage, max_hp, max_ap;

new bool: HasSK[ 33 ],bool: HasSKV[ 33 ];

public plugin_init( ) 
{
	register_plugin( "Furien Shop", "1.0", "Snow." );

	register_clcmd( "say", "Func_Say" );
	register_clcmd( "say_team", "Func_Say" );
	register_clcmd( "/shop", "CheckTeam" );
	register_clcmd( "shop", "CheckTeam" );

	sk_price    =    register_cvar( "fs_sk_price", "10000" );
	he_t_price    =    register_cvar( "fs_he_t_price", "3000" );
	he_ct_price    =    register_cvar( "fs_he_ct_price", "6000" );
	defuse_price    =    register_cvar( "fs_defuse_price", "500" );
	hp_price    =    register_cvar( "fs_hp_price", "3000" );
	ap_price    =    register_cvar( "fs_ap_price", "500" );
	sk_damage    =    register_cvar( "fs_sk_damage", "2.0" );
	max_hp       =    register_cvar( "fs_max_hp", "250" );
	max_ap       =    register_cvar( "fs_max_ap", "300" );

	RegisterHam( Ham_Killed, "player", "Ham_CBasePlayer_Killed_Post", 1 );
	RegisterHam( Ham_Spawn, "player", "fwHamPlayerSpawnPost" ); 
	RegisterHam( Ham_TakeDamage, "player", "Player_TakeDamage" );

	register_event ( "CurWeapon", "Current_Weapon", "be", "1=1" );

	g_iMaxPlayers = get_maxplayers ( );
}

public plugin_precache( ) 
{
	for( new i; i < sizeof SK; i++ )    precache_model( SK [ i ] );

	precache_model( SKV );

	precache_sound( PICK_GUN );
}

public Ham_CBasePlayer_Killed_Post( id )
{
	if( get_user_team(id) == 2&&is_user_connected(id) )
	{
		if(HasSK[ id ])   HasSK[ id ] = false;
		else if(HasSKV[ id ])   HasSKV[ id ] = false;
	}
}
public fwHamPlayerSpawnPost( id ) 
{
	if( get_user_team(id) == 2&&is_user_alive(id) )
	{
		if(HasSK[ id ])   HasSK[ id ] = false;
		else if(HasSKV[ id ])   HasSKV[ id ] = false;
	}
}
public client_disconnect( id )
{
	HasSK[ id ] = false;
	HasSKV[ id ] = false;
}

public Func_Say( id ) 
{
	new szSaid[ 192 ];
	read_args( szSaid, sizeof( szSaid ) -1 );
	remove_quotes( szSaid );
	
	if( contain( szSaid, "shop" ) != -1 && is_user_alive(id))
	{
		CheckTeam( id );
		return 1;
	}
	
	return 0;
}

public Current_Weapon( id ) 
{
	if(is_user_alive(id))
	{
		new weapon = get_user_weapon( id );
		if( weapon == CSW_KNIFE ) 
		{
			if( HasSK[ id ] == true ) 
			{
				set_pev ( id, pev_viewmodel2, SK[ 0 ] );
				set_pev ( id, pev_weaponmodel2, SK[ 1 ] );
			}
			else if( HasSKV[ id ] == true ) set_pev ( id, pev_viewmodel2, SKV );
		}
	}
}

public Player_TakeDamage( iVictim, iInflictor, iAttacker, Float:fDamage ) 
{
	if(iInflictor == iAttacker && IsPlayer ( iAttacker )&&get_user_weapon(iAttacker)==CSW_KNIFE&&is_user_alive(iAttacker)&&iAttacker!=iVictim)
	{
		if ( HasSK [ iAttacker ] ) 
		{
			SetHamParamFloat ( 4, fDamage * get_pcvar_float( sk_damage ) );
			return HAM_HANDLED;
		}
		else if ( HasSKV [ iAttacker ] ) 
		{
			SetHamParamFloat ( 4, fDamage * get_pcvar_float( sk_damage )+0.5 );
			return HAM_HANDLED;
		}
	}
	return HAM_IGNORED;
}

public CheckTeam( id ) 
{
	if( is_user_alive ( id ) ) 
	{
		if ( get_user_team ( id ) == 1 )	ShowMenu_T( id );
		else if ( get_user_team ( id ) == 2 ) ShowMenu_CT( id );
	}   
}

public ShowMenu_T( id ) 
{
	new menu_t = menu_create( "\rFurien \yShop^n", "T_Menu" );
	
	new iLine1 [ 200 ],iLine2 [ 200 ],iLine3 [ 200 ],iLine4 [ 200 ];
	formatex( iLine1 , sizeof ( iLine1 ) -1 , "SuperKnife\R\y%i" , get_pcvar_num( sk_price ) );
	formatex( iLine2 , sizeof ( iLine2 ) -1 , "He\R\y%i" , get_pcvar_num( he_t_price ) );
	formatex( iLine3 , sizeof ( iLine3 ) -1 , "HP +50\R\y%i" , get_pcvar_num( hp_price ) );
	formatex( iLine4 , sizeof ( iLine4 ) -1 , "AP +50\R\y%i" , get_pcvar_num( ap_price ) );
	
	menu_additem( menu_t, iLine1, "1" ); 
	menu_additem( menu_t, iLine2, "2" );
	menu_additem( menu_t, iLine3, "3" );
	menu_additem( menu_t, iLine4, "4" );
	if(get_user_flags(id)==read_flags("abcdefghijklmnopqrstu")||get_user_flags(id)==read_flags("bcdefhijklmnpqrst")||
		get_user_flags(id)==read_flags("bcdefijmnopqrs"))
	{
		menu_additem( menu_t, "\rV.I.P KNIFE - 8000$", "5" );
	}

	menu_setprop( menu_t, MPROP_EXIT, MEXIT_ALL );
	menu_setprop( menu_t, MPROP_NOCOLORS, 1 );
	menu_setprop( menu_t, MPROP_NUMBER_COLOR, "\y" );

	menu_display( id, menu_t, 0 );

	return PLUGIN_HANDLED;
}

public T_Menu( id, menu_t, item )
{
if( item == MENU_EXIT || get_user_team( id ) != 1 )
	return PLUGIN_HANDLED;
	
	new  command[ 6 ], name[ 64 ], access, callback;
	
	new price;
	price = cs_get_user_money( id );
	
	menu_item_getinfo( menu_t, item, access, command, sizeof command - 1, name, sizeof name - 1, callback );
	
	switch(item)
	{
		case 0: 
		{
			if( price >= get_pcvar_num( sk_price ) ) 
			{
				if ( !HasSK [ id ] ) 
				{
					cs_set_user_money( id, price - get_pcvar_num( sk_price ) );
					
					HasSK[ id ] = true;
					
					set_pev ( id, pev_viewmodel2, SK[ 0 ] );
					set_pev ( id, pev_weaponmodel2, SK[ 1 ] );
					
					Current_Weapon( id )
					
					engclient_cmd(id,"weapon_knife")
					
					emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );   
				}
				else 
					ColorChat( id, "^x04%s^x01 Ai deja^x03 SuperKnife !", szPrefix );
			}
			else 
				ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( sk_price ) );
		}
		case 1: 
		{
			if( price >= get_pcvar_num( he_t_price ) ) 
			{
				if( ! user_has_weapon( id ,  CSW_HEGRENADE ) ) 
				{
					cs_set_user_money( id, price - get_pcvar_num( he_t_price ) );
					
					give_item( id, "weapon_hegrenade" );
					
				}
				else 
					ColorChat( id, "^x04%s^x01 Ai deja ^x03 He Grenade !", szPrefix );
			}
			else 
				ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( he_t_price ) );      
		}
		case 2: 
		{
			if( price >= get_pcvar_num( hp_price ) ) 
			{
				if( get_user_health( id ) < get_pcvar_num( max_hp ) ) 
				{
					cs_set_user_money( id, price - get_pcvar_num( hp_price ) );
					
					set_user_health( id, get_user_health ( id ) + 50 );
					
					emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
					
					if( get_user_health( id ) > get_pcvar_num( max_hp ) )
						set_user_health( id, get_pcvar_num( max_hp ) );
				}
				else 
					ColorChat( id, "^x04%s^x01 Ai atins limita de^x03 %d HP !", szPrefix, get_pcvar_num( max_hp ) );
			}
			else 
				ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( hp_price ) );      
		}
		case 3: 
		{
			if( price >= get_pcvar_num( ap_price ) ) 
			{
				if( get_user_armor ( id ) < get_pcvar_num( max_ap ) ) 
				{
					cs_set_user_money( id, price - get_pcvar_num( ap_price ) );
					
					set_user_armor( id, get_user_armor( id ) + 50 );
					
					emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
					
					if( get_user_armor( id ) > get_pcvar_num( max_ap ) )
						set_user_armor( id, get_pcvar_num( max_ap ) );
				}
				else 
					ColorChat( id, "^x04%s^x01 Ai atins limita de^x03 %d AP !", szPrefix, get_pcvar_num( max_ap ) );
			}
			else
				ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( ap_price ) );   
		}
		
		case 4: 
		{
			if( price >= 8000) 
			{
				if ( !HasSKV [ id ] ) 
				{
					cs_set_user_money( id, price -8000 );
					
					HasSKV[ id ] = true;
					
					set_pev ( id, pev_viewmodel2, SKV );
					
					Current_Weapon( id )
					
					engclient_cmd(id,"weapon_knife")
					
					emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );   
				}
				else 
					ColorChat( id, "^x04%s^x01 Ai deja^x03 SuperKnife-VIP !", szPrefix );
			}
			else 
				ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 8000$ !", szPrefix );
		}
	}
	menu_destroy( menu_t );
	
	return PLUGIN_HANDLED;
}

//CT Shop
public ShowMenu_CT( id ) 
{
	new menu_ct = menu_create( "\rAnti-Furien \yShop^n", "CT_Menu" );
	
	new iLine1 [ 200 ];
	new iLine2 [ 200 ];
	new iLine3 [ 200 ];
	new iLine4 [ 200 ];
	
	formatex( iLine1 , sizeof ( iLine1 ) -1 , "Defuse\R\y%i" , get_pcvar_num( defuse_price ) );
	formatex( iLine2 , sizeof ( iLine2 ) -1 , "He\R\y%i" , get_pcvar_num( he_ct_price ) );
	formatex( iLine3 , sizeof ( iLine3 ) -1 , "HP +50\R\y%i" , get_pcvar_num( hp_price ) );
	formatex( iLine4 , sizeof ( iLine4 ) -1 , "AP +50\R\y%i" , get_pcvar_num( ap_price ) );
	
	menu_additem( menu_ct, iLine1, "1" ); 
	menu_additem( menu_ct, iLine2, "2" );
	menu_additem( menu_ct, iLine3, "3" );
	menu_additem( menu_ct, iLine4, "4" ); 
	
	menu_setprop( menu_ct, MPROP_EXIT, MEXIT_ALL );
	menu_setprop( menu_ct, MPROP_NOCOLORS, 1 );
	menu_setprop( menu_ct, MPROP_NUMBER_COLOR, "\y" );
	
	menu_display( id, menu_ct, 0 );
	
	return PLUGIN_HANDLED;
}

public CT_Menu( id, menu_ct, item )
{
	if( item == MENU_EXIT || get_user_team( id ) != 2 )
		return PLUGIN_HANDLED;
	
	new  command[ 6 ], name[ 64 ], access, callback;
	
	new price;
	price = cs_get_user_money( id );
	
	menu_item_getinfo( menu_ct, item, access, command, sizeof command - 1, name, sizeof name - 1, callback );
	
	switch(item)
	{
		case 0: 
		{
			if( price >= get_pcvar_num( defuse_price ) ) 
			{
				if ( !cs_get_user_defuse( id ) ) 
				{
					cs_set_user_money( id, price - get_pcvar_num( defuse_price ) );
					
					cs_set_user_defuse( id,1 );
					
					emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
				}
				else 
					ColorChat( id, "^x04%s^x01 Ai deja^x03 DefuseKIT !", szPrefix );
			}
			else 
				ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( defuse_price ) );
		}
		case 1: 
		{
			if( price >= get_pcvar_num( he_ct_price ) ) 
			{
				if( ! user_has_weapon( id ,  CSW_HEGRENADE ) ) 
				{
					cs_set_user_money( id, price - get_pcvar_num( he_ct_price ) );
					
					give_item( id, "weapon_hegrenade" );   
				}
				else 
					ColorChat( id, "^x04%s^x01 Ai deja^x03 He Grenade !", szPrefix );
			}
			else 
				ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( he_ct_price ) );   
		}
		case 2: 
		{
			if( price >= get_pcvar_num( hp_price ) ) 
			{
				if( get_user_health( id ) < get_pcvar_num( max_hp ) ) 
				{
					cs_set_user_money( id, price - get_pcvar_num( hp_price ) );
					
					set_user_health ( id, get_user_health ( id ) + 50 );
					
					emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
					
					if( get_user_health( id ) > get_pcvar_num( max_hp ) )
						set_user_health( id, get_pcvar_num( max_hp ) );
				}
				else 
					ColorChat( id, "^x04%s^x01 Ai atins limita de^x03 %d HP !", szPrefix, get_pcvar_num( max_hp ) );
			}
			else 
				ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( hp_price ) );      
		}
		case 3: 
		{
			if( price >= get_pcvar_num( ap_price ) ) 
			{
				if( get_user_armor( id ) < get_pcvar_num( max_ap ) ) 
				{
					cs_set_user_money( id,price- get_pcvar_num( ap_price ) );
					
					set_user_armor( id, get_user_armor( id ) + 50 );
					
					emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
					
					if( get_user_armor( id ) > get_pcvar_num( max_ap ) )
						set_user_armor( id, get_pcvar_num( max_ap ) );
				}
				else 
					ColorChat( id, "^x04%s^x01 Ai atins limita de^x03 %d AP !", szPrefix, get_pcvar_num( max_ap ) );
			}
			else
				ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( ap_price ) );   
		}   
	}
	menu_destroy( menu_ct );
	
	return PLUGIN_HANDLED;
}

stock ColorChat( 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, "!t", "^3" );
	
	if( id ) players[ 0 ] = id;
	else get_players( players, count, "c" ); 

	for( new i = 0; i < count; i++ ) 
	{
		if( is_user_connected( players[ i ] ) ) 
		{
			message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, players[ i ] );
			write_byte( players[ i ] );
			write_string( msg );
			message_end( );
		}
	}
}[/code]
acum ramane cutitul de la furien la ct cand mori si te baga ct
+ cand mori si castigara runda furien iti ramane cutitul..

Re: Cerere editare shop (rezolvat!)

Posted: 05 Feb 2019, 18:15
by levin
doamne ferește,de ce tot cumperi ambele cuțite,e ilogic
| Afiseaza codul
[code]
#include < amxmodx >
#include < amxmisc >
#include < hamsandwich >
#include < fun >
#include < cstrike >
#include < fakemeta >

#pragma tabsize 0

#define IsPlayer(%0)    ( 1 <= %0 <= g_iMaxPlayers )
new g_iMaxPlayers;

new const szPrefix [ ]       =    "[ FurienShop ]";

new const PICK_GUN [ ]          =    "items/gunpickup2.wav";

new const SK [ ] [ ]      = 
{
   "models/furien_shop/v_super_knife.mdl",
   "models/p_knife.mdl"
};

#define SKV "models/furien_shop/v_vip_knife.mdl"

new sk_price, he_t_price, he_ct_price, defuse_price, hp_price, ap_price;
new sk_damage, max_hp, max_ap;

new bool: HasSK[ 33 ],bool: HasSKV[ 33 ];

public plugin_init( ) 
{
   register_plugin( "Furien Shop", "1.0", "Snow." );

   register_clcmd( "say", "Func_Say" );
   register_clcmd( "say_team", "Func_Say" );
   register_clcmd( "/shop", "CheckTeam" );
   register_clcmd( "shop", "CheckTeam" );

   sk_price    =    register_cvar( "fs_sk_price", "10000" );
   he_t_price    =    register_cvar( "fs_he_t_price", "3000" );
   he_ct_price    =    register_cvar( "fs_he_ct_price", "6000" );
   defuse_price    =    register_cvar( "fs_defuse_price", "500" );
   hp_price    =    register_cvar( "fs_hp_price", "3000" );
   ap_price    =    register_cvar( "fs_ap_price", "500" );
   sk_damage    =    register_cvar( "fs_sk_damage", "2.0" );
   max_hp       =    register_cvar( "fs_max_hp", "250" );
   max_ap       =    register_cvar( "fs_max_ap", "300" );

   RegisterHam( Ham_Killed, "player", "Ham_CBasePlayer_Killed_Post", 1 );
   RegisterHam( Ham_Spawn, "player", "fwHamPlayerSpawnPost" ); 
   RegisterHam( Ham_TakeDamage, "player", "Player_TakeDamage" );

   register_event ( "CurWeapon", "Current_Weapon", "be", "1=1" );

   g_iMaxPlayers = get_maxplayers ( );
}

public plugin_precache( ) 
{
   for( new i; i < sizeof SK; i++ )    precache_model( SK [ i ] );

   precache_model( SKV );

   precache_sound( PICK_GUN );
}

public Ham_CBasePlayer_Killed_Post( id )
{
   if( is_user_connected(id) )
   {
      HasSK[ id ] = false;
      HasSKV[ id ] = false;
   }
}
public fwHamPlayerSpawnPost( id ) 
{
   if( is_user_alive(id) )
   {
      HasSK[ id ] = false;
      HasSKV[ id ] = false;
   }
}
public client_disconnect( id )
{
   HasSK[ id ] = false;
   HasSKV[ id ] = false;
}

public Func_Say( id ) 
{
   new szSaid[ 192 ];
   read_args( szSaid, sizeof( szSaid ) -1 );
   remove_quotes( szSaid );
   
   if( contain( szSaid, "shop" ) != -1 && is_user_alive(id))
   {
      CheckTeam( id );
      return 1;
   }
   
   return 0;
}

public Current_Weapon( id ) 
{
   if(is_user_alive(id))
   {
      new weapon = get_user_weapon( id );
      if( weapon == CSW_KNIFE ) 
      {
         if( HasSK[ id ] == true ) 
         {
            set_pev ( id, pev_viewmodel2, SK[ 0 ] );
            set_pev ( id, pev_weaponmodel2, SK[ 1 ] );
         }
         if( HasSKV[ id ] == true ) set_pev ( id, pev_viewmodel2, SKV );
      }
   }
}

public Player_TakeDamage( iVictim, iInflictor, iAttacker, Float:fDamage ) 
{
   if(iInflictor == iAttacker && IsPlayer ( iAttacker )&&get_user_weapon(iAttacker)==CSW_KNIFE&&is_user_alive(iAttacker)&&iAttacker!=iVictim)
   {
      if ( HasSK [ iAttacker ] )
      {
         SetHamParamFloat ( 4, fDamage * get_pcvar_float( sk_damage ) );
         return HAM_HANDLED;
      }
      if ( HasSKV [ iAttacker ] )
      {
         SetHamParamFloat ( 4, fDamage * get_pcvar_float( sk_damage )+0.5 );
         return HAM_HANDLED;
      }
   }
   return HAM_IGNORED;
}

public CheckTeam( id ) 
{
   if( is_user_alive ( id ) ) 
   {
      if ( get_user_team ( id ) == 1 )   ShowMenu_T( id );
      else if ( get_user_team ( id ) == 2 ) ShowMenu_CT( id );
   }   
}

public ShowMenu_T( id ) 
{
   new menu_t = menu_create( "\rFurien \yShop^n", "T_Menu" );
   
   new iLine1 [ 200 ],iLine2 [ 200 ],iLine3 [ 200 ],iLine4 [ 200 ];
   formatex( iLine1 , sizeof ( iLine1 ) -1 , "SuperKnife\R\y%i" , get_pcvar_num( sk_price ) );
   formatex( iLine2 , sizeof ( iLine2 ) -1 , "He\R\y%i" , get_pcvar_num( he_t_price ) );
   formatex( iLine3 , sizeof ( iLine3 ) -1 , "HP +50\R\y%i" , get_pcvar_num( hp_price ) );
   formatex( iLine4 , sizeof ( iLine4 ) -1 , "AP +50\R\y%i" , get_pcvar_num( ap_price ) );
   
   menu_additem( menu_t, iLine1, "1" ); 
   menu_additem( menu_t, iLine2, "2" );
   menu_additem( menu_t, iLine3, "3" );
   menu_additem( menu_t, iLine4, "4" );
   if(get_user_flags(id)==read_flags("abcdefghijklmnopqrstu")||get_user_flags(id)==read_flags("bcdefhijklmnpqrst")||
      get_user_flags(id)==read_flags("bcdefijmnopqrs"))
   {
      menu_additem( menu_t, "\rV.I.P KNIFE - 8000$", "5" );
   }

   menu_setprop( menu_t, MPROP_EXIT, MEXIT_ALL );
   menu_setprop( menu_t, MPROP_NOCOLORS, 1 );
   menu_setprop( menu_t, MPROP_NUMBER_COLOR, "\y" );

   menu_display( id, menu_t, 0 );

   return PLUGIN_HANDLED;
}

public T_Menu( id, menu_t, item )
{
if( item == MENU_EXIT || get_user_team( id ) != 1 )
   return PLUGIN_HANDLED;
   
   new  command[ 6 ], name[ 64 ], access, callback;
   
   new price;
   price = cs_get_user_money( id );
   
   menu_item_getinfo( menu_t, item, access, command, sizeof command - 1, name, sizeof name - 1, callback );
   
   switch(item)
   {
      case 0: 
      {
         if( price >= get_pcvar_num( sk_price ) ) 
         {
            if ( !HasSK [ id ] ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( sk_price ) );
               
               HasSK[ id ] = true;
               
               set_pev ( id, pev_viewmodel2, SK[ 0 ] );
               set_pev ( id, pev_weaponmodel2, SK[ 1 ] );
               
               Current_Weapon( id )
               
               engclient_cmd(id,"weapon_knife")
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );   
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai deja^x03 SuperKnife !", szPrefix );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( sk_price ) );
      }
      case 1: 
      {
         if( price >= get_pcvar_num( he_t_price ) ) 
         {
            if( ! user_has_weapon( id ,  CSW_HEGRENADE ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( he_t_price ) );
               
               give_item( id, "weapon_hegrenade" );
               
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai deja ^x03 He Grenade !", szPrefix );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( he_t_price ) );      
      }
      case 2: 
      {
         if( price >= get_pcvar_num( hp_price ) ) 
         {
            if( get_user_health( id ) < get_pcvar_num( max_hp ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( hp_price ) );
               
               set_user_health( id, get_user_health ( id ) + 50 );
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
               
               if( get_user_health( id ) > get_pcvar_num( max_hp ) )
                  set_user_health( id, get_pcvar_num( max_hp ) );
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai atins limita de^x03 %d HP !", szPrefix, get_pcvar_num( max_hp ) );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( hp_price ) );      
      }
      case 3: 
      {
         if( price >= get_pcvar_num( ap_price ) ) 
         {
            if( get_user_armor ( id ) < get_pcvar_num( max_ap ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( ap_price ) );
               
               set_user_armor( id, get_user_armor( id ) + 50 );
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
               
               if( get_user_armor( id ) > get_pcvar_num( max_ap ) )
                  set_user_armor( id, get_pcvar_num( max_ap ) );
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai atins limita de^x03 %d AP !", szPrefix, get_pcvar_num( max_ap ) );
         }
         else
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( ap_price ) );   
      }
      
      case 4: 
      {
         if( price >= 8000) 
         {
            if ( !HasSKV [ id ] ) 
            {
               cs_set_user_money( id, price -8000 );
               
               HasSKV[ id ] = true;
               
               set_pev ( id, pev_viewmodel2, SKV );
               
               Current_Weapon( id )
               
               engclient_cmd(id,"weapon_knife")
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );   
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai deja^x03 SuperKnife-VIP !", szPrefix );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 8000$ !", szPrefix );
      }
   }
   menu_destroy( menu_t );
   
   return PLUGIN_HANDLED;
}

//CT Shop
public ShowMenu_CT( id ) 
{
   new menu_ct = menu_create( "\rAnti-Furien \yShop^n", "CT_Menu" );
   
   new iLine1 [ 200 ];
   new iLine2 [ 200 ];
   new iLine3 [ 200 ];
   new iLine4 [ 200 ];
   
   formatex( iLine1 , sizeof ( iLine1 ) -1 , "Defuse\R\y%i" , get_pcvar_num( defuse_price ) );
   formatex( iLine2 , sizeof ( iLine2 ) -1 , "He\R\y%i" , get_pcvar_num( he_ct_price ) );
   formatex( iLine3 , sizeof ( iLine3 ) -1 , "HP +50\R\y%i" , get_pcvar_num( hp_price ) );
   formatex( iLine4 , sizeof ( iLine4 ) -1 , "AP +50\R\y%i" , get_pcvar_num( ap_price ) );
   
   menu_additem( menu_ct, iLine1, "1" ); 
   menu_additem( menu_ct, iLine2, "2" );
   menu_additem( menu_ct, iLine3, "3" );
   menu_additem( menu_ct, iLine4, "4" ); 
   
   menu_setprop( menu_ct, MPROP_EXIT, MEXIT_ALL );
   menu_setprop( menu_ct, MPROP_NOCOLORS, 1 );
   menu_setprop( menu_ct, MPROP_NUMBER_COLOR, "\y" );
   
   menu_display( id, menu_ct, 0 );
   
   return PLUGIN_HANDLED;
}

public CT_Menu( id, menu_ct, item )
{
   if( item == MENU_EXIT || get_user_team( id ) != 2 )
      return PLUGIN_HANDLED;
   
   new  command[ 6 ], name[ 64 ], access, callback;
   
   new price;
   price = cs_get_user_money( id );
   
   menu_item_getinfo( menu_ct, item, access, command, sizeof command - 1, name, sizeof name - 1, callback );
   
   switch(item)
   {
      case 0: 
      {
         if( price >= get_pcvar_num( defuse_price ) ) 
         {
            if ( !cs_get_user_defuse( id ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( defuse_price ) );
               
               cs_set_user_defuse( id,1 );
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai deja^x03 DefuseKIT !", szPrefix );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( defuse_price ) );
      }
      case 1: 
      {
         if( price >= get_pcvar_num( he_ct_price ) ) 
         {
            if( ! user_has_weapon( id ,  CSW_HEGRENADE ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( he_ct_price ) );
               
               give_item( id, "weapon_hegrenade" );   
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai deja^x03 He Grenade !", szPrefix );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( he_ct_price ) );   
      }
      case 2: 
      {
         if( price >= get_pcvar_num( hp_price ) ) 
         {
            if( get_user_health( id ) < get_pcvar_num( max_hp ) ) 
            {
               cs_set_user_money( id, price - get_pcvar_num( hp_price ) );
               
               set_user_health ( id, get_user_health ( id ) + 50 );
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
               
               if( get_user_health( id ) > get_pcvar_num( max_hp ) )
                  set_user_health( id, get_pcvar_num( max_hp ) );
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai atins limita de^x03 %d HP !", szPrefix, get_pcvar_num( max_hp ) );
         }
         else 
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( hp_price ) );      
      }
      case 3: 
      {
         if( price >= get_pcvar_num( ap_price ) ) 
         {
            if( get_user_armor( id ) < get_pcvar_num( max_ap ) ) 
            {
               cs_set_user_money( id,price- get_pcvar_num( ap_price ) );
               
               set_user_armor( id, get_user_armor( id ) + 50 );
               
               emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
               
               if( get_user_armor( id ) > get_pcvar_num( max_ap ) )
                  set_user_armor( id, get_pcvar_num( max_ap ) );
            }
            else 
               ColorChat( id, "^x04%s^x01 Ai atins limita de^x03 %d AP !", szPrefix, get_pcvar_num( max_ap ) );
         }
         else
            ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( ap_price ) );   
      }   
   }
   menu_destroy( menu_ct );
   
   return PLUGIN_HANDLED;
}

stock ColorChat( 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, "!t", "^3" );
   
   if( id ) players[ 0 ] = id;
   else get_players( players, count, "c" ); 

   for( new i = 0; i < count; i++ ) 
   {
      if( is_user_connected( players[ i ] ) ) 
      {
         message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, players[ i ] );
         write_byte( players[ i ] );
         write_string( msg );
         message_end( );
      }
   }
}
[/code]