Shopmenu3

Read log files for errors! If this fails, come here for help

Moderator: Forum Moderator

Post Reply
Bonqe
Peon
Posts: 2
Joined: Fri Feb 10, 2012 10:29 am

Shopmenu3

Post by Bonqe » Sat Feb 11, 2012 9:02 am

Where do i have to put this code to have /shopmenu3?

Code: Select all

    /*----------------------------------------Shopmenu 3 Globális változók----------------------------------------*/
    new TotalPrice;
    new const g_Shopmenu3[] = "[Shopmenu3]";

    #define MAX_DUPLAZO_LVL 10

    new ItemAr[9] =
    {
       3000,   // Bunny
       2500,   // Ultimate
       8000,   // XP duplázó
       6500,   // Végtelen lõszer
       2000,   // Fagyos Gránát
       5500,   // No Flash
       6000,   // Item visszateremtõ
       12000,   // Mérgezés
       9000   // Sebzés csökkentõ
    };

    new Shop3ItemTul[9][] =
    {
       "A Bunny Hop segitsegevel olyan ugyessegel tudsz ugralni mint a nyul.",                                 // Bunny
       "Az Ultimate Csokkento segitsegevel megfelezed az ultimated hasznalhatosaganak az idejet.",                  // Ultimate
       "Az XP Duplazo segitsegevel minden esemenyert dupla XP jar.",                                       // XP duplázó
       "A Vegtelen Loszer segitsegevel a masodlagos loszered sose fogy el.",                                 // Végtelen lõszer
       "A Fagyos Granat segitsegevel 10 masodpercenkent kapsz egy fagyaszto granatot.",                        // Fagyos Gránát
       "Az Anti Flash segitsegevel immunis leszel a vakitogranatra.",                                       // No Flash
       "A Targy Visszateremto segitsegevel visszakapod a kov. kor elejen a shopmenu 1 es 2 targyadat.",            // Item visszateremtõ
       "A Halalos Mergezes segitsegevel van ra eselyed, hogy atvaltoztasd es megbenitsd az ellenfelet.",            // Mérgezés
       "A Kemeny Pancel segitsegevel van ra eselyed, hogy visszasebzel a tamadonak es a korulotte levo tarsainak is."   // Sebzés csökkentõ
    };

    /*------------------------------------------------------------------------------------------------------------*/

    public MENU_Shopmenu3( id )
    {
       static pos, szMenu[1024], keys;
       keys = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9);
       pos = 0;

       // Add the title
       pos += formatex( szMenu[pos], 1023-pos, "\yShopmenu 3\R$  Ar^n^n" );

       // Add the actual options to the menu
       for ( new i = 0; i < MAX_PAGE_ITEMS; i++ )
          pos += formatex( szMenu[pos], 1023-pos, "\w%d. %s\y\R%d^n", i + 1, Shop3ItemName[i], ITEM_PRICE( id, i ) );

       pos += formatex( szMenu[pos], 1023-pos, "^n\r0. Kilepes" );

       // Display the menu
       show_menu( id, keys, szMenu, -1, "Shopmenu3" );

       return PLUGIN_CONTINUE;
    }

    public _MENU_Shopmenu3(id, key)
    {
       switch(key)
       {
          case 0: TARGY_ELLENORZO( id, 0);
          case 1: TARGY_ELLENORZO( id, 1);
          case 2: TARGY_ELLENORZO( id, 2);
          case 3: TARGY_ELLENORZO( id, 3);
          case 4: TARGY_ELLENORZO( id, 4);
          case 5: TARGY_ELLENORZO( id, 5);
          case 6: TARGY_ELLENORZO( id, 6);
          case 7: TARGY_ELLENORZO( id, 7);
          case 8: TARGY_ELLENORZO( id, 8);
          case 9: return PLUGIN_HANDLED;
       }
       
       return PLUGIN_CONTINUE;
    }

    // Shopmenu Leírás
    public Shopmenu3Leiras( id )
    {
       static motd[2048], header[128], len;
       len = 0;
       
       len += formatex(motd[len], sizeof( motd ) - 1 - len, "<body bgcolor=^"#000000^"><font color=^"#FF0505^"><center>WarCraft3 Frozen Throne - Shopmenu3 Leiras</font></center><br><br><font color=^"#808080^">");
       formatex(header, sizeof header - 1,"Shopmenu3 Leiras")
          
       for( new i = 0; i < MAX_ITEMS_PAGE; i++ )
          len += formatex(motd[len], sizeof( motd ) - 1 - len, "<b>- %s [$ %d]</b><br>Leiras: <i>%s</i><br><br>", Shop3ItemName[i], ItemAr[i], Shop3ItemTul[i]);

       len += formatex(motd[len], sizeof( motd ) - 1 - len, "</font></body>");
          
       show_motd(id, motd, header);
    }

    // Item ára szint szerint
    ITEM_PRICE( id, itemID )
    {
       new Float:fInc = ( 1.0 - ITEM_COST_RATIO ) / float( MAX_LEVELS );
       new Float:fRatio = (float( p_data[id][P_LEVEL] ) * fInc) + ITEM_COST_RATIO;

       if( p_data[id][P_RACE] != RACE_NONE )
          TotalPrice = floatround( float( ItemAr[itemID] ) * fRatio);
       
       return TotalPrice;
    }

    // Tárgy eltávolitó
    TARGY_REMOVE( id, itemID )
    {
       switch( itemID )
       {
          case 0: BunnyEnable[id]     = false;
          case 1: ShopmenuUltimate[id] = false;
          case 2: ShopmenuXP[id]        = false;
          case 3: UnlimitedAmmo[id]     = false;
          case 4: FrostNade[id]       = false;
          case 5: AntiFlash[id]        = false;
          case 6: ItemVissza[id]       = false;
          case 7: Mergezes[id]       = false;
          case 8: KemenyPancel[id]    = false;
       }   
    }

    // Megveheti e?
    TARGY_ELLENORZO( id, itemID )
    {
       if( p_data[id][P_RACE] == RACE_NONE )
       {
          client_print(id, print_chat, "%s Bocsi, de eloszor fajt kell valasztanod, hogy targyat vegyel!", g_Shopmenu3);
          return PLUGIN_HANDLED;
       }
       
       if( cs_get_user_money( id ) < ITEM_PRICE( id, itemID ) )
       {
          client_print(id, print_chat, "%s Bocsi, de nincs eleg penzed, hogy megvehesd ezt a targyat!", g_Shopmenu3);
          return PLUGIN_HANDLED;
       }
       
       if( !is_user_alive( id ) && itemID != 6 )
       {
          client_print(id, print_chat, "%s Bocsi, de hullakent nem veheted meg ezt a targyat!", g_Shopmenu3);
          return PLUGIN_HANDLED;
       }
       
       if( bonusItem[id] == itemID )
       {
          client_print(id, print_chat, "%s Bocsi, de mar rendelkezel ezzel a targyal!", g_Shopmenu3);
          return PLUGIN_HANDLED;
       }
       
       if( bonusItem[id] == itemID )
       {
          client_print(id, print_chat, "%s Bocsi, de mar rendelkezel ezzel a targyal!", g_Shopmenu3);
          return PLUGIN_HANDLED;
       }
       
       if( p_data[id][P_RACE] == RACE_UNDEAD && itemID == 0 )
       {
          client_print(id, print_chat, "%s Bocsi, de eloholt vagy, ezert nem vehetsz Bunny Hoppot!", g_Shopmenu3);
          return PLUGIN_HANDLED;
       }
       
       if( p_data[id][P_LEVEL] < MIN_ULT_LEVEL && itemID == 1 )
       {
          client_print(id, print_chat, "%s Bocsi, de Te meg nem rendelkezel specialis kepessegel! Ultimate lvl %d-tol van.", g_Shopmenu3, MIN_ULT_LEVEL);
          return PLUGIN_HANDLED;
       }
       
       if( p_data[id][P_LEVEL] > MAX_DUPLAZO_LVL && itemID == 2 )
       {
          client_print(id, print_chat, "%s Bocsi, de Te mar tul nagy vagy, hogy XP Duplazot vegyel! %d-s szintig vehetsz.", g_Shopmenu3, MAX_DUPLAZO_LVL);
          return PLUGIN_HANDLED;
       }
       
       if( itemID == 6 && ITEM_Has( id, ITEM_MOLE ) > ITEM_NONE)
       {
          client_print(id, print_chat, "%s Bocsi, de ha vakondal rendelkezel nem vehetsz item ujrateremtot!", g_Shopmenu3);
          return PLUGIN_HANDLED;
       }
       
       if( p_data[id][P_RACE] == RACE_SHADOW && itemID == 7 )
       {
          client_print(id, print_chat, "%s Bocsi, de Te olyan fajjal vagy ami mar rendelkezik ilyen kepessegekkel!", g_Shopmenu3);
          return PLUGIN_HANDLED;
       }
       
       if( p_data[id][P_RACE] == RACE_ELF && p_data[id][P_RACE] == RACE_SHADOW && itemID == 8 )
       {
          client_print(id, print_chat, "%s Bocsi, de Te olyan fajjal vagy ami mar rendelkezik ilyen kepessegekkel!", g_Shopmenu3);
          return PLUGIN_HANDLED;
       }
       
       if( ITEM_Has( id, ITEM_GLOVES ) > ITEM_NONE && itemID == 4 )
       {
          client_print(id, print_chat, "%s Bocsi, de Te mar rendelkezel langolo kesztyuvel!", g_Shopmenu3);
          return PLUGIN_HANDLED;
       }
       
       // Remove user's money
       new iNewMoney = SHARED_GetUserMoney( id ) - ITEM_PRICE( id, itemID );
       SHARED_SetUserMoney( id, iNewMoney );
       
       // Play sound
       emit_sound( id, CHAN_STATIC, g_szSounds[SOUND_PICKUPITEM], 1.0, ATTN_NORM, 0, PITCH_NORM );
       
       // Give Item
       if( bonusItem[id] == -1 || bonusItem[id] == 9)
       {
          client_print(id, print_chat, "%s %s", g_Shopmenu3, Shop3ItemTul[itemID]);
          bonusItem[id] = itemID;
       }
       else
       {
          client_print(id, print_chat, "%s Lecserelted a(z) %s targyat erre: %s!", g_Shopmenu3, Shop3ItemName[bonusItem[id]], Shop3ItemName[itemID]);
          TARGY_REMOVE( id, bonusItem[id] );
          bonusItem[id] = itemID;
       }
       
       switch( itemID )
       {
          case 0: BunnyEnable[id]     = true;
          case 1: ShopmenuUltimate[id] = true;
          case 2: ShopmenuXP[id]        = true;
          case 3: UnlimitedAmmo[id]     = true;
          case 4:
          {
                FrostNade[id]       = true;
                ITEM_Gloves( id );
          }
          case 5: AntiFlash[id]        = true;
          case 6: ItemVissza[id]       = true;
          case 7: Mergezes[id]       = true;
          case 8: KemenyPancel[id]    = true;
       }
       
       // We want to update the user's HUD
       WC3_ShowBar( id );
       
       return PLUGIN_CONTINUE;
    }

PhotoKiller
Peon
Posts: 3
Joined: Sat May 24, 2014 9:58 am

Re: Shopmenu3

Post by PhotoKiller » Sat May 24, 2014 10:55 am

Use AMXX Studio - final version, create a .sma file and compile .sma file and result - .amxx file.

Post Reply