Spoiler
#include < amxmodx > #include < zombieplague > #include < hamsandwich > #include < fakemeta > #include <amx_settings_api> #include <zp50_core> #include <zp50_class_nemesis> #include <zp50_class_assassin> #define PLUGIN "[ZP] Hands" #define VERSION "1.2" #define AUTHOR "Weltgericht" new Array:zm_hands new nemesis_hands[64], assassin_hands[64]; public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) RegisterHam(Ham_Item_Deploy, "weapon_hegrenade", "Grenade_Deploy_Post", 1) RegisterHam(Ham_Item_Deploy, "weapon_flashbang", "Grenade_Deploy_Post", 1) RegisterHam(Ham_Item_Deploy, "weapon_smokegrenade", "Grenade_Deploy_Post", 1) } public plugin_precache() { zm_hands = ArrayCreate(64, 1) load_zombie_data() for(new i = 0; i < ArraySize(zm_hands); i++) { new item[128], model[64] ArrayGetString(zm_hands, i, model, charsmax(model)) formatex(item, charsmax(item), "models/zombie_plague/%s.mdl", model) precache_model(item) } new precache[128] formatex(precache, charsmax(precache), "models/zombie_plague/%s.mdl", nemesis_hands) precache_model(precache) } public Grenade_Deploy_Post(weapon) { new id = get_pdata_cbase(weapon, 41); new item[128], hands[64]; if(!is_user_alive(id)) return PLUGIN_CONTINUE if(zp_core_is_zombie(id)) { if(zp_class_nemesis_get(id)) { formatex(item, charsmax(item), "models/zombie_plague/%s.mdl", nemesis_hands) set_pev(id, pev_viewmodel2, item); return PLUGIN_CONTINUE } else if(zp_class_assassin_get(id)) { formatex(item, charsmax(item), "models/zombie_plague/%s.mdl", assassin_hands) set_pev(id, pev_viewmodel2, item); return PLUGIN_CONTINUE } else { ArrayGetString(zm_hands, zp_class_zombie_get_current(id), hands, charsmax(hands)) formatex(item, charsmax(item), "models/zombie_plague/%s.mdl", hands) set_pev(id, pev_viewmodel2, item); } } return PLUGIN_CONTINUE } load_zombie_data() { if(!amx_load_setting_string("zombieplague.ini", "Weapon Models", "V_KNIFE NEMESIS", nemesis_hands, charsmax(nemesis_hands))) amx_save_setting_string("zombieplague.ini", "Weapon Models", "V_KNIFE NEMESIS", nemesis_hands) if(!amx_load_setting_string("zombieplague.ini", "Weapon Models", "V_KNIFE ASSASSIN", assassin_hands, charsmax(assassin_hands))) amx_save_setting_string("zombieplague.ini", "Weapon Models", "V_KNIFE ASSASSIN", assassin_hands) replace(nemesis_hands, charsmax(nemesis_hands), "models/zombie_plague/", ""); replace(nemesis_hands[strlen(nemesis_hands)-4], charsmax(nemesis_hands), ".mdl", ""); replace(assassin_hands, charsmax(assassin_hands), "models/zombie_plague/", ""); replace(assassin_hands[strlen(assassin_hands)-4], charsmax(assassin_hands), ".mdl", ""); new path[64] get_configsdir(path, charsmax(path)) format(path, charsmax(path), "%s/zp_hands.ini", path) if (!file_exists(path)) { new error[100] formatex(error, charsmax(error), "Cannot load customization file %s!", path) set_fail_state(error) return; } new linedata[1024], key[64], value[960] new file = fopen(path, "rt") while (file && !feof(file)) { fgets(file, linedata, charsmax(linedata)) replace(linedata, charsmax(linedata), "^n", "") if (!linedata[0] || linedata[0] == ';') continue; strtok(linedata, key, charsmax(key), value, charsmax(value), '=') trim(key) trim(value) if (equal(key, "ZOMBIE HANDS")) { while (value[0] != 0 && strtok(value, key, charsmax(key), value, charsmax(value), ',')) { trim(key) trim(value) ArrayPushString(zm_hands, key) } } } if (file) { fclose(file) } } stock get_configsdir(name[],len) { return get_localinfo("amxx_configsdir",name,len); }
Teoretycznie ten kod, tylko lekko zmodyfikowany przeze mnie, powinien dodawać do każdej klasy zombie inny model rąk do bomby.
1. Zamiast innego modelu rąk dla każdej klasy, wszystkie klasy mają ten sam model bomby. Dlaczego ? Co w tym kodzie jest nie tak ?
2. Czy ten plugin zadziałałby na jakiś inny model granata niż jump bomb do którego został przygotowany ?