Multumesc
[Buton]
- | Afiseaza codul
/* Plugin generated by AMXX-Studio */ #include < amxmodx > #include < amxmisc > #include < hamsandwich > #include < fun > #include < cstrike > #include < fakemeta > //Like in C ;) #pragma semicolon 1 //Take Damage #define IsPlayer(%0) ( 1 <= %0 <= g_iMaxPlayers ) new g_iMaxPlayers; //Prefix new const szPrefix [ ] = "[ Furien Shop ]"; //Sound new const PICK_GUN [ ] = "items/gunpickup2.wav"; //SK Models new const SK [ ] [ ] = { "models/baioneta.mdl", "models/baioneta.mdl" }; //Cvar's new sk_price, he_t_price, he_ct_price, defuse_price, hp_price, ap_price; new sk_damage, max_hp, max_ap; //Bools new bool: HasSK[ 33 ]; //Init public plugin_init( ) { register_plugin( "Furien Shop", "1.0", "Snow." ); //Open Shop register_clcmd( "say", "Func_Say" ); register_clcmd( "say_team", "Func_Say" ); register_clcmd( "/shop", "CheckTeam" ); register_clcmd( "shop", "CheckTeam" ); //Cvar's 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", "3000" ); defuse_price = register_cvar( "fs_defuse_price", "500" ); hp_price = register_cvar( "fs_hp_price", "2000" ); ap_price = register_cvar( "fs_ap_price", "1000" ); sk_damage = register_cvar( "fs_sk_damage", "2.0" ); max_hp = register_cvar( "fs_max_hp", "250" ); max_ap = register_cvar( "fs_max_ap", "200" ); //Ham's RegisterHam( Ham_Killed, "player", "Ham_CBasePlayer_Killed_Post", true ); RegisterHam( Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1 ); RegisterHam( Ham_TakeDamage, "player", "Player_TakeDamage" ); //Curent Weapon register_event ( "CurWeapon", "Current_Weapon", "be", "1=1" ); //Max Players g_iMaxPlayers = get_maxplayers ( ); } //Precache public plugin_precache( ) { static i; for( i = 0 ; i < sizeof ( SK ); i++ ) precache_model( SK [ i ] ); precache_sound( PICK_GUN ); return PLUGIN_CONTINUE; } //Killed public Ham_CBasePlayer_Killed_Post( id ) HasSK[ id ] = false; //Spawn public fwHamPlayerSpawnPost( id ) { if( get_user_team(id) == 2 ) HasSK[ id ] = false; } //Put in Server public client_putinserver( id ) HasSK[ id ] = false; //Open Shop 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; } //Show Model 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 ] ); } } } //Damage 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; } return HAM_IGNORED; } //Check Team Shop 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 ); } } //T Shop 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" ); 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 ] ) { //Get Money cs_set_user_money( id, price - get_pcvar_num( sk_price ) ); //Pev SuperKnife 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" ); //Give SuperKnife HasSK[ id ] = true; //Sound 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 ) ) { //Get Money cs_set_user_money( id, price - get_pcvar_num( he_t_price ) ); //Give He 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 ) ) { //Get Money cs_set_user_money( id, price - get_pcvar_num( hp_price ) ); //Give Health set_user_health( id, get_user_health ( id ) + 50 ); //Sound emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM ); //Verify 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 ) ) { //Get Money cs_set_user_money( id, price - get_pcvar_num( ap_price ) ); //Give AP set_user_armor( id, get_user_armor( id ) + 50 ); //Sound emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM ); //Verify 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_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 ) ) { //Get Money cs_set_user_money( id, price - get_pcvar_num( defuse_price ) ); //Give DefuseKit cs_set_user_defuse( id,1 ); //Sound 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 ) ) { //Get Money cs_set_user_money( id, price - get_pcvar_num( he_ct_price ) ); //Give He 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 ) ) { //Get Money cs_set_user_money( id, price - get_pcvar_num( hp_price ) ); //Give Health set_user_health ( id, get_user_health ( id ) + 50 ); //Sound emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM ); //Verify 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 ) ) { //Get Money cs_set_user_money( id,price- get_pcvar_num( ap_price ) ); //Give AP set_user_armor( id, get_user_armor( id ) + 50 ); //Sound emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM ); //Verify 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 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( ); } } } } [/Buton]