Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
6.7 kB
3
Indexable
Never
acum e complet am uitat ceva de la pev


#include <amxmodx>
#include <hamsandwich>
#include <fakemeta_util>
#include <cstrike>
#include <crxranks>
#include <ze_vip>
 
#define is_player(%1)  (1 <= %1 <= 32)
 
new g_iKnifeID
 
new const knife_list[][] =
{
    "Default Hammer", // default knife
    "Chain Hammer",
    "Buff Hammer",
    "Spooky Hammer"
}

new const Knives[][] =
{
"models/knives/v_hammer1.mdl",
"models/knives/p_hammer1.mdl",
"models/knives/v_hammer2.mdl",
"models/knives/p_hammer2.mdl",
"models/knives/v_hammer3.mdl",
"models/knives/p_hammer3.mdl",
"models/knives/v_scare.mdl",
"models/knives/p_scare.mdl",
"models/knives/v_hammeradmin.mdl",
"models/knives/p_hammeradmin.mdl",
"models/knives/v_vipknife.mdl",
"models/knives/p_vipknife.mdl",
"models/knives/v_lk.mdl",
"models/knives/p_lk.mdl"
}
 
public plugin_init() 
{
    RegisterHam(Ham_Item_Deploy, "weapon_knife", "OnItemDeployPost", 1)
    register_clcmd("say /knife", "knife_menu")
}


public plugin_precache() 
{  
	precache_model("models/knives/v_hammer1.mdl")  
	precache_model("models/knives/v_hammer2.mdl")  
	precache_model("models/knives/v_hammer3.mdl") 
	precache_model("models/knives/v_scare.mdl") 
	precache_model("models/knives/v_hammeradmin.mdl") 
	precache_model("models/knives/v_vipknife.mdl") 
	precache_model("models/knives/v_lk.mdl") 
	precache_model("models/knives/p_hammer1.mdl")  
	precache_model("models/knives/p_hammer2.mdl")  
	precache_model("models/knives/p_hammer3.mdl") 
	precache_model("models/knives/p_scare.mdl") 
	precache_model("models/knives/p_hammeradmin.mdl") 
	precache_model("models/knives/p_vipknife.mdl") 
	precache_model("models/knives/p_lk.mdl") 	
}

 
public knife_menu(id)
{
    new buff[256], menu
    
    formatex(buff, charsmax(buff), "[ZEX] Knife Menu:")
    menu = menu_create(buff, "Main_Menu")
    
    formatex(buff, charsmax(buff), "%s", knife_list[0])
    menu_additem(menu, buff, "", 0)
    
    formatex(buff, charsmax(buff), "%s %s", knife_list[1], crxranks_get_user_level(id) == 10 ? "" : "\y[\yLevel 10\y]")
    menu_additem(menu, buff, "", 0)
    
    formatex(buff, charsmax(buff), "%s %s", knife_list[2], crxranks_get_user_level(id) == 20 ? "" : "\y[\yLevel 20\y]")
    menu_additem(menu, buff, "", 0)
    
    formatex(buff, charsmax(buff), "%s %s", knife_list[3], crxranks_get_user_level(id) == 30 ? "" : "\y[\yLevel 30\y]")
    menu_additem(menu, buff, "", 0)
    
    formatex(buff, charsmax(buff), "%s %s", knife_list[4], crxranks_get_user_level(id) == 40 ? "" : "\y[\yLevel 40\y]")
    menu_additem(menu, buff, "", 0)
    
}

public Main_Menu(id, item) 
{
     ColorChat(id, "You Choosed The ^4%s^1 Knife.", g_KnifeNames[item]);
    new gun = get_user_weapon(id)
    switch(gun)
    {
        case CSW_KNIFE:
        {
                case 0:
                {
		      if (crxranks_get_user_level(id) >  9)
		      {
                        set_pev(id, pev_viewmodel2, Knives[0]);
                        set_pev(id, pev_weaponmodel2, Knives[1]);\
		      } 
		      else if (crxranks_get_user_level(id) <  10)
		      {
		      ColorChat(id, "You Don't Have Enoungh ^4Level^1!");
		      }
		      
                }
                case 1:
                {
		      if (crxranks_get_user_level(id) >  14)
		      {
                        set_pev(id, pev_viewmodel2, Knives[2]);
                        set_pev(id, pev_weaponmodel2, Knives[3]);
		      }
		      else if (crxranks_get_user_level(id) <  15)
		      {
		      ColorChat(id, "You Don't Have Enoungh ^4Level^1!");
		      }
                }
                case 2:
                {
		      if (crxranks_get_user_level(id) >  29)
		      {	
                        set_pev(id, pev_viewmodel2, Knives[4]);
                        set_pev(id, pev_weaponmodel2, Knives[5]);
		      }
		      else if (crxranks_get_user_level(id) <  30)
		      {
		      ColorChat(id, "You Don't Have Enoungh ^4Level^1!");
		      }
                }
                case 3:
                {
		      if (crxranks_get_user_level(id) >  44)
		      {	
                        set_pev(id, pev_viewmodel2, Knives[6]);
                        set_pev(id, pev_weaponmodel2, Knives[7]);
		      }
		      else if (crxranks_get_user_level(id) <  45)
		      {
		      ColorChat(id, "You Don't Have Enoungh ^4Level^1!");
		      }
                }
                case 4:
                {
		      if (get_user_flags(id) & ADMIN_BAN)
		      {	
                        set_pev(id, pev_viewmodel2, Knives[8]);
                        set_pev(id, pev_weaponmodel2, Knives[9]);
		      }
                        else
		      {
		      ColorChat(id, "You Are Not ^4Admin^1!");
		      }
	       }
                case 5:
                {
		      if (ze_get_vip_flags(id) & VIP_A)
		      {	
                        set_pev(id, pev_viewmodel2, Knives[10]);
                        set_pev(id, pev_weaponmodel2, Knives[11]); 
		      }
		      else
		      {
		      ColorChat(id, "You Are Not ^4VIP^1!");
		      }
	       }
	       case 6:
                {
		      if (get_user_flags(id) & ADMIN_RCON)
		      {	
                        set_pev(id, pev_viewmodel2, Knives[12]);
                        set_pev(id, pev_weaponmodel2, Knives[13]);	
		      }
		      else
		      {
		      ColorChat(id, "You Are Not ^4Head Admin^1!");
		      }
	       }
        }
}

public OnItemDeployPost(id)
{
    new gun = get_user_weapon(id)
    if(!pev_valid(id)) return
    if(!is_player(id)) return
    
    switch(gun)
    {
        case CSW_KNIFE:
        {
            if(g_iKnifeID == 0)
            {
                set_pev(id, pev_viewmodel2, "models/v_knife.mdl")
            }
            
            else if(g_iKnifeID == 1)
            {
                set_pev(id, pev_viewmodel2, "models/v_knife.mdl")
            }
            
            else if(g_iKnifeID == 2)
            {
                set_pev(id, pev_viewmodel2, "models/v_knife.mdl")
            }
            else if(g_iKnifeID == 3)
            {
                set_pev(id, pev_viewmodel2, "models/v_knife.mdl")
            }
        }
        
    }
}

stock ColorChat( const id, const string[ ], { Float, Sql, Resul, _ } : ... )
{
new msg[ 191 ], players[ 32 ], count = 1;

static len;
len = formatex( msg, charsmax( msg ), "^x04[^x04ZEX^x04]^x01 " );
vformat( msg[ len ], charsmax( msg ) - len, string, 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( );
   }
}}