|
Senior Member
Join Date: Feb 2011
Location: Limbo City
|

04-30-2012
, 17:58
[ZP] duda con la restricción de armas 4.3
|
#1
|
Hola a todos  bueno yo uso la versión 4.3 Fix5a mi duda/problema es que saqué las restricciones de armas por niveles del zombie anihilation porque el metodo que existe para la version 4.2 no me funciona y puse el del zp de L// que es version 4.3 el problema es porque cuando entro al server al elegir un arma aparecen todas "Min lvl 1"
ejemplo:
Code:
Arma primaria [1-7]
1. Schmidt TMP [Min Lvl: 1]
2. ES P90 [Min Lvl: 1]
3. XM1014 M4 [Min Lvl: 1]
4. Ingram MAC-10 [Min Lvl: 1]
5. Steyr AUG A1 [Min Lvl: 1]
6. AK-47 Kalashnikov [Min Lvl: 1]
7. MP5 Navy [Min Lvl: 1]
8. Recordar Selección [Deshabilitado]
9. Siguiente/Anterior
0. Salir.
PHP Code:
// Buy Menu 1 public show_menu_buy1(taskid) { // Get player's id static id (taskid > g_maxplayers) ? (id = ID_SPAWN) : (id = taskid); // Player dead? if (!g_isalive[id]) return; // Zombies, survivors or snipers get no guns if (g_zombie[id] || g_survivor[id] || g_sniper[id]) return; // Bots pick their weapons randomly / Random weapons setting enabled if (get_pcvar_num(cvar_randweapons) || g_isbot[id]) { buy_primary_weapon(id, random_num(0, ArraySize(g_primary_items) - 1)) menu_buy2(id, random_num(0, ArraySize(g_secondary_items) - 1)) return; } // Automatic selection enabled for player and menu called on spawn event if (WPN_AUTO_ON && taskid > g_maxplayers) { buy_primary_weapon(id, WPN_AUTO_PRI) menu_buy2(id, WPN_AUTO_SEC) buy_all_weapon(id) return; } static menu[300], len, weap, maxloops, weap_level len = 0 maxloops = min(WPN_STARTID+7, WPN_MAXIDS) // Title len += formatex(menu[len], charsmax(menu) - len, "\y%L \r[%d-%d]^n^n", id, "MENU_BUY1_TITLE", WPN_STARTID+1, min(WPN_STARTID+7, WPN_MAXIDS)) // 1-7. Weapon List for (weap = WPN_STARTID; weap < maxloops; weap++) { weap_level = ArrayGetCell(g_primary_level, weap) if (g_level[id] < weap_level) len += formatex(menu[len], charsmax(menu) - len, "\d%d. %s (\rMin Lvl \w%d\d)^n", weap-WPN_STARTID+1, WEAPONNAMES[ArrayGetCell(g_primary_weaponids, weap)], weap_level) else len += formatex(menu[len], charsmax(menu) - len, "\r%d.\w %s \d(\yMin Lvl \w%d\d)^n", weap-WPN_STARTID+1, WEAPONNAMES[ArrayGetCell(g_primary_weaponids, weap)], weap_level) } // 8. Auto Select len += formatex(menu[len], charsmax(menu) - len, "^n\r8.\w %L \y[%L]", id, "MENU_AUTOSELECT", id, (WPN_AUTO_ON) ? "MOTD_ENABLED" : "MOTD_DISABLED") // 9. Next/Back - 0. Exit len += formatex(menu[len], charsmax(menu) - len, "^n^n\r9.\w %L/%L^n^n\r0.\w %L", id, "MENU_NEXT", id, "MENU_BACK", id, "MENU_EXIT") // Fix for AMXX custom menus if (pev_valid(id) == PDATA_SAFE) set_pdata_int(id, OFFSET_CSMENUCODE, 0, OFFSET_LINUX) show_menu(id, KEYSMENU, menu, -1, "Buy Menu 1") }
// Buy Menu 2 show_menu_buy2(id) { // Player dead? if (!g_isalive[id]) return; static menu[250], len, weap, maxloops, weap_level len = 0 maxloops = ArraySize(g_secondary_items) // Title len += formatex(menu[len], charsmax(menu) - len, "\y%L^n", id, "MENU_BUY2_TITLE") // 1-6. Weapon List for (weap = 0; weap < maxloops; weap++) { weap_level = ArrayGetCell(g_secondary_level, weap)
if (g_level[id] < weap_level) len += formatex(menu[len], charsmax(menu) - len, "\d%d. %s (\rMin Lvl \w%d\d)^n", weap+1, WEAPONNAMES[ArrayGetCell(g_secondary_weaponids, weap)], weap_level) else len += formatex(menu[len], charsmax(menu) - len, "\r%d.\w %s \d(\yMin Lvl \w%d\d)^n", weap+1, WEAPONNAMES[ArrayGetCell(g_secondary_weaponids, weap)], weap_level) } // 8. Auto Select len += formatex(menu[len], charsmax(menu) - len, "^n^n\r8.\w %L \y[%L]", id, "MENU_AUTOSELECT", id, (WPN_AUTO_ON) ? "MOTD_ENABLED" : "MOTD_DISABLED") // 0. Exit len += formatex(menu[len], charsmax(menu) - len, "^n^n\r0.\w %L", id, "MENU_EXIT") // Fix for AMXX custom menus if (pev_valid(id) == PDATA_SAFE) set_pdata_int(id, OFFSET_CSMENUCODE, 0, OFFSET_LINUX) show_menu(id, KEYSMENU, menu, -1, "Buy Menu 2") }
PHP Code:
// Buy Menu 1 public menu_buy1(id, key) { // Player dead? if (!g_isalive[id]) return PLUGIN_HANDLED; // Zombies, survivors or snipers get no guns if (g_zombie[id] || g_survivor[id] || g_sniper[id]) return PLUGIN_HANDLED; // Special keys / weapon list exceeded if (key >= MENU_KEY_AUTOSELECT || WPN_SELECTION >= WPN_MAXIDS) { switch (key) { case MENU_KEY_AUTOSELECT: // toggle auto select { WPN_AUTO_ON = 1 - WPN_AUTO_ON } case MENU_KEY_NEXT: // next/back { if (WPN_STARTID+7 < WPN_MAXIDS) WPN_STARTID += 7 else WPN_STARTID = 0 } case MENU_KEY_EXIT: // exit { return PLUGIN_HANDLED; } } // Show buy menu again show_menu_buy1(id) return PLUGIN_HANDLED; } new weap_level = ArrayGetCell(g_primary_level, WPN_SELECTION) if (weap_level && (g_level[id] < weap_level)) { zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT_LEVEL", weap_level)
// Show buy menu again show_menu_buy1(id) return PLUGIN_HANDLED; } // Store selected weapon id WPN_AUTO_PRI = WPN_SELECTION // Buy primary weapon buy_primary_weapon(id, WPN_AUTO_PRI) // Show pistols menu show_menu_buy2(id) return PLUGIN_HANDLED; }
// Buy Menu 2 public menu_buy2(id, key) { // Player dead? if (!g_isalive[id]) return PLUGIN_HANDLED; // Zombies, survivors or snipers get no guns if (g_zombie[id] || g_survivor[id] || g_sniper[id]) return PLUGIN_HANDLED; // Special keys / weapon list exceeded if (key >= ArraySize(g_secondary_items)) { // Toggle autoselect if (key == MENU_KEY_AUTOSELECT) WPN_AUTO_ON = 1 - WPN_AUTO_ON // Reshow menu unless user exited if (key != MENU_KEY_EXIT) show_menu_buy2(id) return PLUGIN_HANDLED; } new weap_level = ArrayGetCell(g_secondary_level, key) if (weap_level && (g_level[id] < weap_level)) { zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT_LEVEL", weap_level)
// Show buy menu again show_menu_buy2(id) return PLUGIN_HANDLED; } // Store selected weapon WPN_AUTO_SEC = key // Drop secondary gun again, in case we picked another (bugfix) drop_weapons(id, 2) // Get weapon's id static weaponid, wname[32] weaponid = ArrayGetCell(g_secondary_weaponids, key) ArrayGetString(g_secondary_items, key, wname, charsmax(wname)) // Give the new weapon and full ammo fm_give_item(id, wname) ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[weaponid], AMMOTYPE[weaponid], MAXBPAMMO[weaponid]) show_menu_buy3(id) return PLUGIN_HANDLED; }
en esta parte tengo la duda por que al cambiar el valor 1 a 2 todas las armas se restringen a lvl 2
PHP Code:
case SECTION_BUY_MENU_WEAPONS: { if (equal(key, "PRIMARY")) { // Set up some vars to hold parsing info new weap_ent_name[32], level[5] // Parse weapons while (value[0] != 0 && strtok(value, key, charsmax(key), value, charsmax(value), ',')) { // Trim spaces trim(key) trim(value) strtok(key, weap_ent_name, charsmax(weap_ent_name), level, charsmax(level), ':')
if (level[0]) { trim(level) ArrayPushCell(g_primary_level, str_to_num(level)) } else ArrayPushCell(g_primary_level, 1) // Esta es la Línea... // Trim spaces trim(weap_ent_name)
// Add to weapons array ArrayPushString(g_primary_items, weap_ent_name) ArrayPushCell(g_primary_weaponids, cs_weapon_name_to_id(weap_ent_name)) } } else if (equal(key, "SECONDARY")) { // Set up some vars to hold parsing info new weap_ent_name[32], level[5] // Parse weapons while (value[0] != 0 && strtok(value, key, charsmax(key), value, charsmax(value), ',')) { // Trim spaces trim(key) trim(value) strtok(key, weap_ent_name, charsmax(weap_ent_name), level, charsmax(level), ':') if (level[0]) { trim(level) ArrayPushCell(g_secondary_level, str_to_num(level)) } else ArrayPushCell(g_secondary_level, 1) // Esta es la Línea... // Trim spaces trim(weap_ent_name)
// Add to weapons array ArrayPushString(g_secondary_items, weap_ent_name) ArrayPushCell(g_secondary_weaponids, cs_weapon_name_to_id(weap_ent_name)) } } }
lo que quiero saber es como puedo restringir las armas con valores diferentes...
ejemplo:
Code:
Arma primaria [1-7]
1. Schmidt TMP [Min Lvl: 1]
2. ES P90 [Min Lvl: 5]
3. XM1014 M4 [Min Lvl: 8]
4. Ingram MAC-10 [Min Lvl: 10]
5. Steyr AUG A1 [Min Lvl: 13]
6. AK-47 Kalashnikov [Min Lvl: 17]
7. MP5 Navy [Min Lvl: 20]
8. Recordar Selección [Deshabilitado]
9. Siguiente/Anterior
0. Salir.
estuve tratando de editar el zombieplague.ini pero no logré nada...
Gracias de antemano
__________________
[IMG]http://img839.**************/img839/1879/dmcdanteprofile.png[/IMG]
Last edited by Sidix; 04-30-2012 at 18:12.
|
|