// Var main const TYPE_WPN = 4 const MAX_WPN = 40 new HAS_WEAPON[33] new g_wpn_name[MAX_WPN][32] new g_wpn_model[MAX_WPN][32] new g_wpn_change[MAX_WPN] new g_wpn_sprites_exp[MAX_WPN][100] new g_wpn_sound_exp[MAX_WPN][100] new g_wpn_cmdbuy[MAX_WPN][32] new name_class_weapon[MAX_WPN][32] new Name_WpnChange[MAX_WPN][32]
new current_select[33] new crWeapon[33]
// Models new P_MODEL[MAX_WPN][64] new V_MODEL[MAX_WPN][64] new W_MODEL[MAX_WPN][64]
// Cvar new cvar_dmg_name[MAX_WPN][64] new cvar_cost_name[MAX_WPN][64] new cvar_time_sound_name[MAX_WPN][64]
new cvar_dmgmultiplier[MAX_WPN] new cvar_cost[MAX_WPN] new cvar_time_sound[MAX_WPN] new cvar_buy
// Sprites new gSpriteIndex[MAX_WPN] new ent_user[500][2] #define is_valid_player(%1) (1 <= %1 <= 32)
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR)
// Human Death public zp_user_infected_post(id) { if (zp_get_user_zombie(id) && HAS_WEAPON[id]) { create_w_class(id, 0) HAS_WEAPON[id] = 0 } } public Death() { new id = read_data(2) if(HAS_WEAPON[id]) { create_w_class(id, 0) HAS_WEAPON[id] = 0 return PLUGIN_HANDLED }
return PLUGIN_CONTINUE } // End Human Death
// Menu Wpn public menu_wpn(id) { if (!g_wpn_change[1]) return PLUGIN_HANDLED
new mHandleID = menu_create("[NST Wpn] Menu He Smoke:", "menu_wpn_handler") new i = 1, check_value = 1 while(check_value && i<MAX_WPN) { if (g_wpn_change[i] <= 0) check_value = 0 if (check_value) { new wpn_cost = get_pcvar_num(cvar_cost[i]) new item_name[150], idwpn[32] format(item_name, 149, "%s: %i$", g_wpn_name[i], wpn_cost) format(idwpn, 31, "%i", i)
return FMRES_IGNORED; } public grenade_throw(id,iGren,wid) { new CURENT_WEAPON = HAS_WEAPON[id] new CHANGE_WEAPON = g_wpn_change[CURENT_WEAPON]
// check if grenade isn't a HeGrenade if(wid != CHANGE_WEAPON) return PLUGIN_CONTINUE;
// check if Grenade entity isn't a valid entity if(!pev_valid(iGren)) return PLUGIN_CONTINUE;
if (HAS_WEAPON[id]) { new id_ent if (iGren < sizeof ent_user) id_ent = iGren else id_ent = 0 ent_user[id_ent][0] = id ent_user[id_ent][1] = gSpriteIndex[CURENT_WEAPON]
// set a new classname to HeGrenade set_pev(iGren,pev_classname,"fake_hegren")
// Make it to explode after 1.6 seconds set_task(1.6, "gre_explode", iGren) set_task(get_pcvar_float(cvar_time_sound[CURENT_WEAPON]),"sound_explode", iGren) }
return PLUGIN_CONTINUE; } public sound_explode(ent) { new id_ent if (ent < sizeof ent_user) id_ent = ent else id_ent = 0
new id = ent_user[id_ent][0] client_cmd(id, "spk %s", g_wpn_sound_exp[HAS_WEAPON[id]]) HAS_WEAPON[id] = 0 } public gre_explode(ent) { new id_ent if (ent < sizeof ent_user) id_ent = ent else id_ent = 0 new sprites = ent_user[id_ent][1]
// check if entity isn't valid if(!pev_valid(ent)) return;
// new variable for origin and get origin of entity static Float:origin[3]; pev(ent,pev_origin,origin);
message_begin(MSG_BROADCAST,SVC_TEMPENTITY); write_byte(TE_EXPLOSION); // TE_EXPLOSION write_coord(floatround(origin[0])); // origin x write_coord(floatround(origin[1])); // origin y write_coord(floatround(origin[2])); // origin z write_short(sprites); // sprites write_byte(40); // scale in 0.1's write_byte(30); // framerate write_byte(TE_EXPLFLAG_NONE); // flags message_end(); // message end
//client_print(0, print_chat, "[%i]", ent) } // End Change Sprites Explode
// Control Damage public fw_TakeDamage(victim, inflictor, attacker, Float:damage) { new CURENT_WEAPON = HAS_WEAPON[attacker] new CHANGE_WEAPON = g_wpn_change[CURENT_WEAPON]
if ( is_valid_player( attacker ) && get_user_weapon(attacker) == CHANGE_WEAPON && HAS_WEAPON[attacker] ) { SetHamParamFloat(4, damage * get_pcvar_float( cvar_dmgmultiplier[CURENT_WEAPON] ) ) } } // End Control Damage
// Buy Weapon public buy_weapon_cvar(id) { new models[62] get_pcvar_string(cvar_buy, models, 61)
new buyzone = cs_get_user_buyzone(id) new mod_runing = nst_get_mod_runing() if (mod_runing == 1 || mod_runing == 2 || mod_runing == 3) buyzone = 1
if (buyzone == 0) client_print(id, print_chat, "[NST Wpn] Ban khong the mua Vu khi o vi tri nay") else { new plrClip, plrAmmo get_user_weapon(id, plrClip , plrAmmo)
new user_money = cs_get_user_money(id) new wp_cost = get_pcvar_num(cvar_cost[idwpn])
if (zp_get_user_zombie(id)) { client_print(id, print_chat, "[NST Wpn] Ban dang la Zombie nen khong the mua %s", g_wpn_name[idwpn]) } else if(!is_user_alive(id)) { client_print(id, print_chat, "[NST Wpn] Ban chi co the mua duoc %s khi con song", g_wpn_name[idwpn]); } else if(user_money < wp_cost) { client_print(id, print_chat, "[NST Wpn] Ban khong du tien de mua"); } else if(HAS_WEAPON[id] == idwpn) { client_print(id, print_chat, "[NST Wpn] Ban da co %s roi", g_wpn_name[idwpn]) } else { if (HAS_WEAPON[id]) create_w_class(id, 1) current_select[id] = idwpn HAS_WEAPON[id] = idwpn give_weapon(id, 1) cs_set_user_money(id, user_money-wp_cost) checkModel(id) client_print(id, print_chat, "[NST Wpn] Ban da mua %s", g_wpn_name[idwpn]) } }
} // End Buy Weapon
// Set W Model public fw_SetModel(entity) { new id = pev(entity,pev_owner) new CURENT_WEAPON = HAS_WEAPON[id] new CHANGE_WEAPON = g_wpn_change[CURENT_WEAPON]
// Other Public public client_connect(id) { HAS_WEAPON[id] = 0 } public client_disconnect(id) { HAS_WEAPON[id] = 0 } public event_start_freezetime() { remove_class_wpn() } // End Other Public
// Drop Weapon public create_w_class(id, type) { new CURENT_WEAPON = HAS_WEAPON[id] //new CHANGE_WEAPON = g_wpn_change[CURENT_WEAPON]
new Float:Aim[3],Float:origin[3] VelocityByAim(id, 64, Aim) entity_get_vector(id,EV_VEC_origin,origin)
entity_set_int(nst_cre_class,EV_INT_movetype,6) entity_set_int(nst_cre_class, EV_INT_iuser2, 1) entity_set_vector(nst_cre_class,EV_VEC_origin,origin) remowegun(id) } public remowegun(id) { new CURENT_WEAPON = HAS_WEAPON[id] new CHANGE_WEAPON = g_wpn_change[CURENT_WEAPON] new wpnList[32] new number get_user_weapons(id,wpnList,number) for (new i = 0;i < number ;i++) { if (wpnList[i] == CHANGE_WEAPON) { fm_strip_user_gun(id, wpnList[i]) } } } // End Drop Weapon
// Remove Class Wepaons in new round public remove_class_wpn() { new i = 1, check_value = 1 while(check_value && i<MAX_WPN) { if (g_wpn_change[i] <= 0) check_value = 0 new nextitem = find_ent_by_class(-1,name_class_weapon[i]) while(nextitem) { remove_entity(nextitem) nextitem = find_ent_by_class(-1,name_class_weapon[i]) } i++ } return PLUGIN_CONTINUE } // End Remove Class Wepaons in new round
// Weapon Pickup public pfn_touch(ptr, ptd) {
new i = 1, check_value = 1 while(check_value && i<MAX_WPN) { if (g_wpn_change[i] <= 0) check_value = 0 if(is_valid_ent(ptr)) { new classname[32] entity_get_string(ptr,EV_SZ_classname,classname,31) if(equal(classname, name_class_weapon[i])) { if(is_valid_ent(ptd)) { new id = ptd if(id > 0 && id < 34) { if (!check_has_wpn(id) && is_user_alive(id) && !(zp_get_user_zombie(id))) { HAS_WEAPON[id] = i give_weapon(id, 1) remove_entity(ptr) } } } } } i++ } }
check_has_wpn(id) { new weapons[32], num, has_wpn = 0 get_user_weapons(id, weapons, num) new type_wpn_cr = TYPE_WPN
for (new i = 0; i < num; i++) { new type_wpn = nst_get_weapon_type(weapons[i]) if (type_wpn == type_wpn_cr) has_wpn = 1
}
return has_wpn } // End Weapon Pickup /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1034\\ f0\\ fs16 \n\\ par } */
Добавлено (01.05.2012, 10:38) --------------------------------------------- nst_wpn.ini nst_wpn_l.ini nst_mywpn.ini сюда добавлял толку переделал меню нифига не получаеться , пишет что нету модели в My weapon хотя туда добавлял тоже