worest Дата: Вторник, 10.02.2015, 14:07 | Сообщение # 1
Сообщения: 10
Награды: 0
Замечания:
Хотел сделать для мода war3ft rc 13 shopmenu3.Вещи работают,но когда пишу say /shopmenu3 сервер падает,без ошибок.Логи чисты. Думаю из-за меню,код выложу.Если не из-за этого,скажите что можно исправить. Писать типа:Скачать cssb 2.3 и не парся и т.д. не надо.
public menu_Item_Options(id) { new pos = 0, menu_body[512] new keys = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<8)|(1<<9) new szMenuItemShopOption1[64]; new szMenuItemShopOption2[64]; new szMenuItemShopOption3[64]; new szMenuItemShopInfo1[64]; new szMenuItemShopInfo2[64]; new szMenuItemShopInfo3[64]; formatex(szMenuItemShopOption1,charsmax(szMenuItemShopOption1),"\w%L",LANG_PLAYER,"SHOPMENU1_OPTION") formatex(szMenuItemShopOption2,charsmax(szMenuItemShopOption2),"\w%L",LANG_PLAYER,"SHOPMENU2_OPTION") formatex(szMenuItemShopOption3,charsmax(szMenuItemShopOption3),"\w%L",LANG_PLAYER,"SHOPMENU3_OPTION") formatex(szMenuItemShopInfo1,charsmax(szMenuItemShopInfo1),"\w%L",LANG_PLAYER,"SHOW_SHOPMENU1_INFO") formatex(szMenuItemShopInfo2,charsmax(szMenuItemShopInfo2),"\w%L",LANG_PLAYER,"SHOW_SHOPMENU2_INFO") formatex(szMenuItemShopInfo3,charsmax(szMenuItemShopInfo3),"\w%L",LANG_PLAYER,"SHOW_SHOPMENU3_INFO") pos += formatex(menu_body[pos], charsmax(menu_body)-pos, "%L^n^n",LANG_PLAYER,"MENU_ITEM_OPTIONS") pos += formatex(menu_body[pos], charsmax(menu_body)-pos, "\w1. %s^n",szMenuItemShopOption1) pos += formatex(menu_body[pos], charsmax(menu_body)-pos, "\w2. %s^n",szMenuItemShopOption2) pos += formatex(menu_body[pos], charsmax(menu_body)-pos, "\w3. %s^n",szMenuItemShopOption3) pos += formatex(menu_body[pos], charsmax(menu_body)-pos, "\w4. %s^n",szMenuItemShopInfo1) pos += formatex(menu_body[pos], charsmax(menu_body)-pos, "\w5. %s^n",szMenuItemShopInfo2) pos += formatex(menu_body[pos], charsmax(menu_body)-pos, "\w6. %s^n",szMenuItemShopInfo3) pos += formatex(menu_body[pos], charsmax(menu_body)-pos, "^n^n\d9. %L",LANG_PLAYER,"BACK_STRING") pos += formatex(menu_body[pos], charsmax(menu_body)-pos, "^n\d0. %L",LANG_PLAYER,"WORD_EXIT") show_menu(id,keys,menu_body,-1) return PLUGIN_CONTINUE } public _menu_Item_Options(id,key) { if ( !WC3_Check() ) { return PLUGIN_HANDLED; } switch (key) { case 0: MENU_Shopmenu( id, 0 ); case 1: MENU_Shopmenu( id, 9 ); case 2: MENU_Shopmenu( id, 18 ); case 3: MOTD_ItemsInfo( id, 0 ); case 4: MOTD_ItemsInfo( id, 9 ); case 5: MOTD_ItemsInfo( id, 18 ); case 8: MENU_War3Menu(id); default: return PLUGIN_HANDLED; } return PLUGIN_HANDLED; }
public MENU_Shopmenu( id, iStart ) { if ( !ITEM_MenuCanBuyCheck( id ) ) { return; } // Shopmenu2 can't display if we don't have the correct number of races! if ( iStart == MAX_PAGE_ITEMS && get_pcvar_num( CVAR_wc3_races ) <= 4 ) { return; } new szMenu[512], szItemName[64], pos = 0, i, iItemID; new iKeys = (1<<9); // Add the header if ( iStart == 0 ) { pos += format( szMenu[pos], charsmax(szMenu)-pos, "%L", LANG_PLAYER, "MENU_BUY_ITEM" ); } // "Shopmenu 2" if ( iStart == MAX_PAGE_ITEMS ) { pos += format( szMenu[pos], charsmax(szMenu)-pos, "%L", LANG_PLAYER, "MENU_BUY_ITEM2" ); } // "Shopmenu 3" if ( iStart == 18 ) { pos += format( szMenu[pos], charsmax(szMenu)-pos, "%L", LANG_PLAYER, "MENU_BUY_ITEM3" ); } // Lets add the items to the menu! for ( i = 0; i < MAX_PAGE_ITEMS; i++ ) { iItemID = iStart + i; LANG_GetItemName( iItemID, id, szItemName,charsmax(szItemName)); new iItemMoney = ITEM_Cost( id, iItemID ); new iUserMoney = SHARED_GetUserMoney( id ); if(iUserMoney < iItemMoney) pos += format( szMenu[pos], charsmax(szMenu)-pos, "\d%d. %s\R%d^n", i + 1, szItemName, ITEM_Cost( id, iItemID ) ); else pos += format( szMenu[pos], charsmax(szMenu)-pos, "\y%d. %s\r\R%d^n", i + 1, szItemName, ITEM_Cost( id, iItemID ) ); iKeys |= (1<<i); } pos += format( szMenu[pos], charsmax(szMenu)-pos, "^n\d0. %L", LANG_PLAYER, "WORD_EXIT" ); show_menu( id, iKeys, szMenu, -1 ); } //Для shopmenu1 public _MENU_Shopmenu1( id, iKey ) { if ( !WC3_Check() || iKey == 9 ) { return PLUGIN_HANDLED; } new iItemMoney = ITEM_Cost( id, iKey ); new iUserMoney = SHARED_GetUserMoney( id ); if(iUserMoney < iItemMoney) MENU_Shopmenu( id, 0 ); ITEM_Buy( id, iKey ); return PLUGIN_HANDLED; } //Для shopmenu2 public _MENU_Shopmenu2( id, iKey ) { if ( !WC3_Check() || iKey == 9 ) { return PLUGIN_HANDLED; } iKey += MAX_PAGE_ITEMS; new iItemMoney = ITEM_Cost( id, iKey ); new iUserMoney = SHARED_GetUserMoney( id ); if(iUserMoney < iItemMoney) MENU_Shopmenu( id, 9 ); ITEM_Buy( id, iKey ); return PLUGIN_HANDLED; } //Для shopmenu3 public _MENU_Shopmenu3( id, iKey ) { if ( !WC3_Check() || iKey == 9 ) return PLUGIN_HANDLED; iKey += 18; new iItemMoney = ITEM_Cost( id, iKey ); new iUserMoney = SHARED_GetUserMoney( id ); if(iUserMoney < iItemMoney) MENU_Shopmenu( id, 18 ); ITEM_Buy( id, iKey ); return PLUGIN_HANDLED; }
Shopmenu1 и Shopmenu2 работают.В ланг-файл все прописывал.
Сообщение отредактировал worest - Вторник, 10.02.2015, 14:08