Gordel
|
Дата: Вторник, 11.07.2017, 15:38 | Сообщение # 1
|
Новичок
Группа: Пользователь
Сообщений: 1
Статус: Не в сети
|
Вот код:
Код #include <amxmodx> #include <amxmisc> #include <cstrike> #include <fun> #include <colorchat>
#define PLUGIN "Weapon Menu" #define VERSION "0.1" #define AUTHOR "Subb98"
new g_iKey[33] new g_iMenuPosition[33] new g_iMenuPlayers[33][32] new g_iRoundCounter new g_pChatInfo new cmdWeaponMenu
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_event("TextMsg", "eventTextMsg", "a", "2=#Game_will_restart_in", "2=#Game_Commencing") register_event("HLTV", "eventHLTV", "a", "1=0", "2=0") register_clcmd("weaponmenu", "cmdWeaponMenu", ADMIN_MENU, "- show weapon menu") register_clcmd("say /weapon", "cmdWeaponMenu", ADMIN_MENU, "- show weapon menu") register_clcmd("say_team /weapon", "cmdWeaponMenu", ADMIN_MENU, "- show weapon menu") register_menucmd(register_menuid("Weapon Menu"), 1023, "handleWeaponMenu") register_menucmd(register_menuid("Player Menu"), 1023, "handlePlayerMenu") g_pChatInfo = register_cvar("wm_chatinfo", "1") }
public eventTextMsg() g_iRoundCounter = 0
public eventHLTV() g_iRoundCounter++
public cmdWeaponMenu(id, level, cid) { if(cmd_access(id, level, cid, 0)) { if(g_iRoundCounter >= 3) showWeaponMenu(id) else ColorChat(id, NORMAL, "^1[^4WeaponMenu^1] Извините, но эта команда доступна с^3 3-го ^1раунда.") } }
showWeaponMenu(id) { new szMenu[512], iKeys = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8|1<<9) formatex(szMenu, 511, "\rОружейная\w^n^n") add(szMenu, 511, "\r1. \wAK47^n") add(szMenu, 511, "\r2. \wM4A1^n") add(szMenu, 511, "\r3. \wFamas^n") add(szMenu, 511, "\r4. \wScout^n") add(szMenu, 511, "\r5. \wAWP^n") add(szMenu, 511, "\r6. \wDeagle^n^n") add(szMenu, 511, "\r7. \wВсе гранаты^n") add(szMenu, 511, "\r8. \wБроня и шлем^n") add(szMenu, 511, "\r9. \wНабор сапера^n^n") add(szMenu, 511, "\r0. \wВыход") show_menu(id, iKeys, szMenu, -1, "Weapon Menu") }
public handleWeaponMenu(id, iKey) { if(iKey == 9) return else { g_iKey [id]= iKey showPlayerMenu(id, g_iMenuPosition [id]= 0) } }
showPlayerMenu(id, iPos) { if(iPos < 0) return new iTotalPlayersNum get_players(g_iMenuPlayers[id], iTotalPlayersNum) new szMenu[512], szName[32] new i, b = 0, iStart = iPos * 7 if(iStart >= iTotalPlayersNum) iStart = iPos = g_iMenuPosition [id]= 0 new iLen = formatex(szMenu, 511, "\rВыберите игрока \w[%d/%d]:\w^n^n", iPos + 1, (iTotalPlayersNum / 7 + ((iTotalPlayersNum % 7) ? 1 : 0))) new iEnd = iStart + 7, iKeys = MENU_KEY_0|MENU_KEY_8 if(iEnd > iTotalPlayersNum) iEnd = iTotalPlayersNum for(new a = iStart; a < iEnd; ++a) { i = g_iMenuPlayers[id] [a]get_user_name(i, szName, 31) iKeys |= (1<<b) if(i == id) iLen += formatex(szMenu[iLen], 511 - iLen, "\r%d. \y%s^n", ++b, szName) else iLen += formatex(szMenu[iLen], 511 - iLen, "\r%d. \w%s^n", ++b, szName) } if(iEnd != iTotalPlayersNum) { formatex(szMenu[iLen], 511 - iLen, "^n\r9. \wДалее^n\r0. \wНазад") iKeys |= MENU_KEY_9 } else formatex(szMenu[iLen], 511 - iLen, "^n\r0. \wНазад") show_menu(id, iKeys, szMenu, -1, "Player Menu") }
public handlePlayerMenu(id, iKey) { switch(iKey) { case 8: showPlayerMenu(id, ++g_iMenuPosition[id]) case 9: { if(g_iMenuPosition[id]) showPlayerMenu(id, --g_iMenuPosition[id]) else showWeaponMenu(id) } default: { new g_iPlayer = g_iMenuPlayers[id][g_iMenuPosition [id]* 7 + iKey] giveItem(id, g_iPlayer) showPlayerMenu(id, g_iMenuPosition[id]) } } }
giveItem(id, g_iPlayer) { new szAdmName[32], szUsrName[32] get_user_name(id, szAdmName, 31) get_user_name(g_iPlayer, szUsrName, 31) new iChatInfo = get_pcvar_num(g_pChatInfo) switch(g_iKey[id]) { case 0: { give_item(g_iPlayer, "weapon_ak47") cs_set_user_bpammo(g_iPlayer, CSW_AK47, 90) if(iChatInfo) ColorChat(0, NORMAL, "^1[^4WeaponMenu^1] Админ ^3%s ^1выдал ^4AK47 ^1игроку ^3%s^1.", szAdmName, szUsrName) } case 1: { give_item(g_iPlayer, "weapon_m4a1") cs_set_user_bpammo(g_iPlayer, CSW_M4A1, 90) if(iChatInfo) ColorChat(0, NORMAL, "^1[^4WeaponMenu^1] Админ ^3%s ^1выдал ^4M4A1 ^1игроку ^3%s^1.", szAdmName, szUsrName) } case 2: { give_item(g_iPlayer, "weapon_famas") cs_set_user_bpammo(g_iPlayer, CSW_FAMAS, 90) if(iChatInfo) ColorChat(0, NORMAL, "^1[^4WeaponMenu^1] Админ ^3%s ^1выдал ^4Famas ^1игроку ^3%s^1.", szAdmName, szUsrName) } case 3: { give_item(g_iPlayer, "weapon_scout") cs_set_user_bpammo(g_iPlayer, CSW_SCOUT, 90) if(iChatInfo) ColorChat(0, NORMAL, "^1[^4WeaponMenu^1] Админ ^3%s ^1выдал ^4Scout ^1игроку ^3%s^1.", szAdmName, szUsrName) } case 4: { give_item(g_iPlayer, "weapon_awp") cs_set_user_bpammo(g_iPlayer, CSW_AWP, 30) if(iChatInfo) ColorChat(0, NORMAL, "^1[^4WeaponMenu^1] Админ ^3%s ^1выдал ^4AWP ^1игроку ^3%s^1.", szAdmName, szUsrName) } case 5: { give_item(g_iPlayer, "weapon_deagle") cs_set_user_bpammo(g_iPlayer, CSW_DEAGLE, 35) if(iChatInfo) ColorChat(0, NORMAL, "^1[^4WeaponMenu^1] Админ ^3%s ^1выдал ^4Deagle ^1игроку ^3%s^1.", szAdmName, szUsrName) } case 6: { give_item(g_iPlayer, "weapon_hegrenade") give_item(g_iPlayer, "weapon_flashbang") give_item(g_iPlayer, "weapon_smokegrenade") cs_set_user_bpammo(g_iPlayer, CSW_FLASHBANG, 2) if(iChatInfo) ColorChat(0, NORMAL, "^1[^4WeaponMenu^1] Админ ^3%s ^1выдал ^4набор гранат ^1игроку ^3%s^1.", szAdmName, szUsrName) } case 7: { cs_set_user_armor(g_iPlayer, 100, CS_ARMOR_VESTHELM) if(iChatInfo) ColorChat(0, NORMAL, "^1[^4WeaponMenu^1] Админ ^3%s ^1выдал ^4броню и шлем ^1игроку ^3%s^1.", szAdmName, szUsrName) } case 8: { if(get_user_team(g_iPlayer) == 2) { cs_set_user_defuse(g_iPlayer, 1) if(iChatInfo) ColorChat(0, NORMAL, "^1[^4WeaponMenu^1] Админ ^3%s ^1выдал ^4набор сапера ^1игроку ^3%s^1.", szAdmName, szUsrName) } else ColorChat(id, NORMAL, "^1[^4WeaponMenu^1] Извините, но набор сапера доступен только команде ^3Counter-Terrorist^1.") } } }
А ошибка такая: "Error: Symbol already defined: "cmdWeaponMenu" on line 41"
|
|
|
|