ja
dione: [spoiler]Kód: #include <amxmodx> #include <engine> #include <fakemeta> #include <hamsandwich>
#define DIONE_CLASSNAME "dione"
new dione_model_id new const dione_model[] = "models/dione/dione.mdl" new const skill_posion[2][] = { "models/dione/ef_poison01.mdl", // Start "models/dione/ef_poison02.mdl" // End } new const skill_swing[] = "models/dione/ef_swing.mdl" new const skill_tentacle[][] = { "models/dione/ef_tentacle_sign.mdl", "models/dione/tentacle.mdl", "models/dione/ef_tentacle.mdl" }
new const skill_bite_sound[] = "dione/zbs_attack_bite.wav" new const skill_posion_sound[] = "dione/zbs_attack_poison1.wav" new const skill_swing_sound[] = "dione/boss_swing.wav" new const skill_rolling_sound[] = "dione/zbs_rolling2.wav" new const escape_sound[] = "dione/exit1.wav"
new Float:g_origin[3], ent_id, Float:g_angles[3], Float:g_v_angles[3] new Float:g_poison_touch[33], g_rolling, g_can_do_skill, g_doing_skill new g_reg, m_iBlood[2], g_can_bite
public plugin_init() { register_plugin("[Dias's NPC] Dione", "1.0", "Dias") register_touch("poison", "*", "fw_poison_touch") register_touch("poison2", "*", "fw_poison2_touch") register_touch("tentacle2", "*", "fw_tentacle_touch") register_touch(DIONE_CLASSNAME, "*", "fw_dione_touch") register_think(DIONE_CLASSNAME, "fw_dione_think") register_clcmd("say /get_origin", "get_origin_first") register_clcmd("say /make", "dione_appear") register_clcmd("say /skill_swing", "dione_do_skill") register_clcmd("say /skill_poison", "dione_do_skill2") register_clcmd("say /skill_rolling", "dione_do_skill3") register_clcmd("say /skill_bite", "dione_do_skill4") register_clcmd("say /skill_tentacle", "dione_do_skill5") }
public plugin_precache() { dione_model_id = engfunc(EngFunc_PrecacheModel, dione_model) engfunc(EngFunc_PrecacheModel, skill_swing) for(new i = 0; i < sizeof(skill_posion); i++) { engfunc(EngFunc_PrecacheModel, skill_posion[i]) } for(new i = 0; i < sizeof(skill_tentacle); i++) { engfunc(EngFunc_PrecacheModel, skill_tentacle[i]) } engfunc(EngFunc_PrecacheSound, skill_bite_sound) engfunc(EngFunc_PrecacheSound, skill_posion_sound) engfunc(EngFunc_PrecacheSound, skill_swing_sound) engfunc(EngFunc_PrecacheSound, skill_rolling_sound) engfunc(EngFunc_PrecacheSound, escape_sound) m_iBlood[0] = precache_model("sprites/blood.spr") m_iBlood[1] = precache_model("sprites/bloodspray.spr") }
public get_origin_first(id) { pev(id, pev_origin, g_origin) pev(id, pev_angles, g_angles) pev(id, pev_v_angle, g_v_angles) }
public dione_appear(id) { new ent = create_entity("info_target") ent_id = ent entity_set_origin(ent, g_origin) entity_set_vector(ent, EV_VEC_angles, g_angles) entity_set_vector(ent, EV_VEC_v_angle, g_v_angles) entity_set_float(ent, EV_FL_takedamage, 1.0) entity_set_float(ent, EV_FL_health, 500.0) entity_set_string(ent,EV_SZ_classname, DIONE_CLASSNAME) entity_set_model(ent, dione_model) entity_set_int(ent, EV_INT_solid, SOLID_SLIDEBOX) entity_set_int(ent, EV_INT_movetype, MOVETYPE_STEP) new Float:maxs[3] = {50.0,50.0, 50.0} new Float:mins[3] = {-50.0, -50.0,-30.0} entity_set_size(ent, mins, maxs) entity_set_int(ent, EV_INT_modelindex, dione_model_id) entity_set_float(ent, EV_FL_animtime, get_gametime()) entity_set_float(ent, EV_FL_framerate, 1.0) entity_set_int(ent, EV_INT_sequence, 4) entity_set_float(ent, EV_FL_nextthink, halflife_time() + 0.01)
if(!g_reg) { RegisterHamFromEntity(Ham_TakeDamage, ent, "fw_takedmg") RegisterHamFromEntity(Ham_Killed, ent, "fw_killed") g_reg = 1 } g_can_bite = 0 g_rolling = 0 g_can_do_skill = 1 drop_to_floor(ent) }
public dione_do_skill() { g_doing_skill = 1 dione_swing() }
public dione_do_skill2() { g_doing_skill = 1 dione_poison() }
public dione_do_skill3() { g_doing_skill = 1 dione_rolling() }
public dione_do_skill4() { g_can_bite = 1 }
public dione_do_skill5() { g_doing_skill = 1 dione_tentacle() }
public fw_dione_think(ent) { if(!is_valid_ent(ent)) return FMRES_IGNORED if(!g_doing_skill && g_can_bite) { static victim static Float:Origin[3], Float:VicOrigin[3], Float:distance victim = FindClosesEnemy(ent) pev(ent, pev_origin, Origin) pev(victim, pev_origin, VicOrigin) distance = get_distance_f(Origin, VicOrigin) if(is_user_alive(victim)) { if(distance <= 300.0) { if(!is_valid_ent(ent)) return FMRES_IGNORED new Float:Ent_Origin[3], Float:Vic_Origin[3] pev(ent, pev_origin, Ent_Origin) pev(victim, pev_origin, Vic_Origin) npc_turntotarget(ent, Ent_Origin, victim, Vic_Origin) entity_set_float(ent, EV_FL_animtime, get_gametime()) entity_set_float(ent, EV_FL_framerate, 1.0) entity_set_int(ent, EV_INT_sequence, 8) emit_sound(victim, CHAN_BODY, skill_bite_sound, 1.0, ATTN_NORM, 0, PITCH_NORM) static arg[2] arg[0] = ent arg[1] = victim set_task(0.5, "dione_attack", _, arg, sizeof(arg)) set_task(1.0, "dione_attack2", victim) entity_set_float(ent, EV_FL_nextthink, get_gametime() + 3.0) } else { if(pev(ent, pev_sequence) != 5) { entity_set_float(ent, EV_FL_animtime, get_gametime()) entity_set_float(ent, EV_FL_framerate, 1.0) entity_set_int(ent, EV_INT_sequence, 5) } new Float:Ent_Origin[3], Float:Vic_Origin[3] pev(ent, pev_origin, Ent_Origin) pev(victim, pev_origin, Vic_Origin) npc_turntotarget(ent, Ent_Origin, victim, Vic_Origin) hook_ent(ent, victim) entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.5) } } else { if(pev(ent, pev_sequence) != 4) { entity_set_float(ent, EV_FL_animtime, get_gametime()) entity_set_float(ent, EV_FL_framerate, 1.0) entity_set_int(ent, EV_INT_sequence, 4) } entity_set_float(ent, EV_FL_nextthink, get_gametime() + 1.0) } } else { entity_set_float(ent, EV_FL_nextthink, get_gametime() + 2.0) } return FMRES_HANDLED }
public dione_attack(arg[]) { static ent, victim ent = arg[0] victim = arg[1] ExecuteHam(Ham_TakeDamage, victim, 0, victim, random_float(15.0, 30.0), DMG_BLAST) set_task(1.5, "stop_attack", ent) }
public dione_attack2(victim) { ExecuteHam(Ham_TakeDamage, victim, 0, victim, random_float(15.0, 30.0), DMG_BLAST) }
public stop_attack(ent) { entity_set_float(ent, EV_FL_animtime, get_gametime()) entity_set_float(ent, EV_FL_framerate, 1.0) entity_set_int(ent, EV_INT_sequence, 4) }
public fw_takedmg(victim, inflictor, attacker, Float:damage, damagebits) { static Float:Origin[3] pev(victim, pev_origin, Origin) create_blood(Origin) }
public fw_killed(ent2, attacker) { static ent ent = create_entity("info_target") static Float:Origin[3], Float:Angles[3] pev(ent2, pev_origin, Origin) pev(ent2, pev_angles, Angles) entity_set_origin(ent, Origin) entity_set_vector(ent, EV_VEC_angles, Angles) entity_set_string(ent, EV_SZ_classname, "temp_zb") entity_set_model(ent, dione_model) new Float:maxs[3] = {50.0,50.0, 50.0} new Float:mins[3] = {-50.0, -50.0,-30.0} entity_set_size(ent, mins, maxs) entity_set_float(ent, EV_FL_animtime, get_gametime()) entity_set_float(ent, EV_FL_framerate, 1.0) entity_set_int(ent, EV_INT_sequence, 16) set_task(5.0, "set_dione_run", ent) set_task(10.0, "remove_temp_zb", ent) emit_sound(ent, CHAN_BODY, escape_sound, 1.0, ATTN_NORM, 0, PITCH_NORM) drop_to_floor(ent) }
public set_dione_run(ent) { entity_set_float(ent, EV_FL_animtime, get_gametime()) entity_set_float(ent, EV_FL_framerate, 1.0) entity_set_int(ent, EV_INT_sequence, 17) }
public remove_temp_zb(ent) { remove_entity(ent) }
// ====================== TENTACLE SKILL ============================== public dione_tentacle() { if(!g_can_do_skill) return PLUGIN_HANDLED static ent ent = ent_id g_doing_skill = 1 entity_set_float(ent, EV_FL_animtime, get_gametime()) entity_set_float(ent, EV_FL_framerate, 1.0) entity_set_int(ent, EV_INT_sequence, 9) set_task(2.5, "make_hole_tentacle", ent) return PLUGIN_CONTINUE }
public make_hole_tentacle(ent) { static Float:Origin[3], Float:beam_origin[30][3], Float:Angles[3] entity_get_vector(ent, EV_VEC_origin, Origin) entity_get_vector(ent, EV_VEC_v_angle, Angles)
// 1st beam_origin[0][0] = Origin[0] beam_origin[0][1] = Origin[1] + 100.0 beam_origin[0][2] = Origin[2] // 2nd beam_origin[1][0] = Origin[0] beam_origin[1][1] = Origin[1] + 200.0 beam_origin[1][2] = Origin[2]
// 3rd beam_origin[2][0] = Origin[0] beam_origin[2][1] = Origin[1] + 300.0 beam_origin[2][2] = Origin[2]
// 4th beam_origin[3][0] = Origin[0] beam_origin[3][1] = Origin[1] + 400.0 beam_origin[3][2] = Origin[2]
// 5th beam_origin[4][0] = Origin[0] beam_origin[4][1] = Origin[1] + 500.0 beam_origin[4][2] = Origin[2]
// 6th beam_origin[5][0] = Origin[0] + 100.0 beam_origin[5][1] = Origin[1] + 100.0 beam_origin[5][2] = Origin[2]
// 7th beam_origin[6][0] = Origin[0] + 200.0 beam_origin[6][1] = Origin[1] + 200.0 beam_origin[6][2] = Origin[2]
// 8th beam_origin[7][0] = Origin[0] + 300.0 beam_origin[7][1] = Origin[1] + 300.0 beam_origin[7][2] = Origin[2] // 9th beam_origin[8][0] = Origin[0] + 400.0 beam_origin[8][1] = Origin[1] + 400.0 beam_origin[8][2] = Origin[2] // 10th beam_origin[9][0] = Origin[0] + 500.0 beam_origin[9][1] = Origin[1] + 500.0 beam_origin[9][2] = Origin[2] // 11th beam_origin[10][0] = Origin[0] - 100.0 beam_origin[10][1] = Origin[1] + 100.0 beam_origin[10][2] = Origin[2]
// 12th beam_origin[11][0] = Origin[0] - 200.0 beam_origin[11][1] = Origin[1] + 200.0 beam_origin[11][2] = Origin[2]
// 13th beam_origin[12][0] = Origin[0] - 300.0 beam_origin[12][1] = Origin[1] + 300.0 beam_origin[12][2] = Origin[2]
// 14th beam_origin[13][0] = Origin[0] - 400.0 beam_origin[13][1] = Origin[1] + 400.0 beam_origin[13][2] = Origin[2] // 15th beam_origin[14][0] = Origin[0] - 500.0 beam_origin[14][1] = Origin[1] + 500.0 beam_origin[14][2] = Origin[2] // II // 1st beam_origin[15][0] = Origin[0] beam_origin[15][1] = Origin[1] - 100.0 beam_origin[15][2] = Origin[2] // 2nd beam_origin[16][0] = Origin[0] beam_origin[16][1] = Origin[1] - 200.0 beam_origin[16][2] = Origin[2]
// 3rd beam_origin[17][0] = Origin[0] beam_origin[17][1] = Origin[1] - 300.0 beam_origin[17][2] = Origin[2]
// 4th beam_origin[18][0] = Origin[0] beam_origin[18][1] = Origin[1] - 400.0 beam_origin[18][2] = Origin[2]
// 5th beam_origin[19][0] = Origin[0] beam_origin[19][1] = Origin[1] - 500.0 beam_origin[19][2] = Origin[2]
// 6th beam_origin[20][0] = Origin[0] - 100.0 beam_origin[20][1] = Origin[1] - 100.0 beam_origin[20][2] = Origin[2]
// 7th beam_origin[21][0] = Origin[0] - 200.0 beam_origin[21][1] = Origin[1] - 200.0 beam_origin[21][2] = Origin[2]
// 8th beam_origin[22][0] = Origin[0] - 300.0 beam_origin[22][1] = Origin[1] - 300.0 beam_origin[22][2] = Origin[2] // 9th beam_origin[23][0] = Origin[0] - 400.0 beam_origin[23][1] = Origin[1] - 400.0 beam_origin[23][2] = Origin[2] // 10th beam_origin[24][0] = Origin[0] - 500.0 beam_origin[24][1] = Origin[1] - 500.0 beam_origin[24][2] = Origin[2] // 11th beam_origin[25][0] = Origin[0] + 100.0 beam_origin[25][1] = Origin[1] - 100.0 beam_origin[25][2] = Origin[2]
// 12th beam_origin[26][0] = Origin[0] + 200.0 beam_origin[26][1] = Origin[1] - 200.0 beam_origin[26][2] = Origin[2]
// 13th beam_origin[27][0] = Origin[0] + 300.0 beam_origin[27][1] = Origin[1] - 300.0 beam_origin[27][2] = Origin[2]
// 14th beam_origin[28][0] = Origin[0] + 400.0 beam_origin[28][1] = Origin[1] - 400.0 beam_origin[28][2] = Origin[2] // 15th beam_origin[29][0] = Origin[0] + 500.0 beam_origin[29][1] = Origin[1] - 500.0 beam_origin[29][2] = Origin[2] for(new i; i < 30; i++) { make_tentacle(beam_origin[i], Angles) } set_task(8.0, "set_default_anim", ent) }
public make_tentacle(Float:Origin[3], Float:Angles[3]) { new ent = create_entity("info_target")
Origin[2] += 5.0 entity_set_origin(ent, Origin) entity_set_vector(ent, EV_VEC_v_angle, Angles) entity_set_string(ent,EV_SZ_classname, "tentacle") entity_set_model(ent, skill_tentacle[0]) entity_set_int(ent, EV_INT_solid, SOLID_SLIDEBOX) entity_set_int(ent, EV_INT_movetype, MOVETYPE_NONE) new Float:maxs[3] = {1.0,1.0,1.0} new Float:mins[3] = {-1.0,-1.0,-1.0} entity_set_size(ent, mins, maxs) entity_set_float(ent, EV_FL_animtime, get_gametime()) entity_set_float(ent, EV_FL_framerate, 1.0) entity_set_int(ent, EV_INT_sequence, 0) set_pev(ent, pev_rendermode, kRenderTransAdd) set_pev(ent, pev_renderamt, 255.0) set_task(4.0, "tentacle_change", ent) //drop_to_floor(ent) }
public tentacle_change(ent) { entity_set_model(ent, skill_tentacle[1]) entity_set_string(ent,EV_SZ_classname, "tentacle2") new Float:maxs[3] = {26.0,26.0,36.0} new Float:mins[3] = {-26.0,-26.0,-36.0} entity_set_size(ent, mins, maxs) entity_set_float(ent, EV_FL_animtime, get_gametime()) entity_set_float(ent, EV_FL_framerate, 1.0) entity_set_int(ent, EV_INT_sequence, 0) set_pev(ent, pev_rendermode, kRenderNormal) set_pev(ent, pev_renderamt, 255.0) set_task(1.0, "tentacle_change2", ent) }
public tentacle_change2(ent) { entity_set_model(ent, skill_tentacle[2]) entity_set_string(ent,EV_SZ_classname, "tentacle") new Float:maxs[3] = {1.0,1.0,1.0} new Float:mins[3] = {-1.0,-1.0,-1.0} entity_set_size(ent, mins, maxs) entity_set_float(ent, EV_FL_animtime, get_gametime()) entity_set_float(ent, EV_FL_framerate, 1.0) entity_set_int(ent, EV_INT_sequence, 0) set_pev(ent, pev_rendermode, kRenderTransAdd) set_pev(ent, pev_renderamt, 255.0) set_task(3.0, "remove_tentacle", ent) }
public remove_tentacle(ent) { remove_entity(ent) g_doing_skill = 0 }
public set_default_anim(ent) { entity_set_float(ent, EV_FL_animtime, get_gametime()) entity_set_float(ent, EV_FL_framerate, 1.0) entity_set_int(ent, EV_INT_sequence, 4) }
public fw_tentacle_touch(tentacle, touch) { if(is_user_alive(touch)) { static Float:CurTime CurTime = get_gametime() if(CurTime - 0.1 > g_poison_touch[touch]) { static ent ent = find_ent_by_owner(-1, "weapon_knife", touch) ExecuteHamB(Ham_TakeDamage, touch, ent, touch, 5.0, DMG_BLAST) g_poison_touch[touch] = CurTime } } }
// ====================== ROLLING SKILL ============================== public dione_rolling() { if(!g_can_do_skill) return PLUGIN_HANDLED static ent ent = ent_id g_doing_skill = 1 entity_set_float(ent, EV_FL_animtime, get_gametime()) entity_set_float(ent, EV_FL_framerate, 1.0) entity_set_int(ent, EV_INT_sequence, 13) set_task(0.75, "do_rolling", ent) set_task(2.0, "stop_rolling", ent) return PLUGIN_CONTINUE }
public do_rolling(ent) { g_rolling = 1 entity_set_float(ent, EV_FL_animtime, get_gametime()) entity_set_float(ent, EV_FL_framerate, 1.0) entity_set_int(ent, EV_INT_sequence, 14) emit_sound(ent, CHAN_BODY, skill_rolling_sound, 1.0, ATTN_NORM, 0, PITCH_NORM) static Float:Velocity[3] velocity_by_aim(ent, 1250, Velocity) entity_set_vector(ent, EV_VEC_velocity, Velocity) for(new i = 1; i < get_maxplayers(); i++) { if(is_user_alive(i) && entity_range(i, ent) <= 500.0) { message_begin(MSG_ONE, get_user_msgid("ScreenShake"),{0,0,0}, i) write_short(1<<14) write_short(1<<13) write_short(1<<13) message_end() } } drop_to_floor(ent) }
public stop_rolling(ent) { entity_set_float(ent, EV_FL_animtime, get_gametime()) entity_set_float(ent, EV_FL_framerate, 1.0) entity_set_int(ent, EV_INT_sequence, 15) static Float:Velocity[3] velocity_by_aim(ent, 0, Velocity) entity_set_vector(ent, EV_VEC_velocity, Velocity) drop_to_floor(ent) g_rolling = 0 set_task(1.0, "restart_rolling", ent) }
public restart_rolling(ent) { entity_set_float(ent, EV_FL_animtime, get_gametime()) entity_set_float(ent, EV_FL_framerate, 1.0) entity_set_int(ent, EV_INT_sequence, 4)
g_doing_skill = 0 drop_to_floor(ent) }
public fw_dione_touch(dione, touch) { if(!g_rolling) return FMRES_IGNORED if(is_user_alive(touch)) { user_kill(touch) } return FMRES_HANDLED }
// ====================== SWING SKILL ============================== public dione_swing() { if(!g_can_do_skill) return PLUGIN_HANDLED static ent ent = ent_id g_doing_skill = 1 entity_set_float(ent, EV_FL_animtime, get_gametime()) entity_set_float(ent, EV_FL_framerate, 1.0) entity_set_int(ent, EV_INT_sequence, 7) emit_sound(ent, CHAN_BODY, skill_swing_sound, 1.0, ATTN_NORM, 0, PITCH_NORM) set_task(1.0, "attack_swing", ent) set_task(1.5, "remove_swing_model", ent) set_task(2.0, "stop_swing", ent)
return PLUGIN_CONTINUE }
public attack_swing(dione) { new ent = create_entity("info_target")
static Float:Origin[3] entity_get_vector(dione, EV_VEC_origin, Origin) Origin[2] -= 30.0 entity_set_origin(ent, Origin) entity_set_string(ent,EV_SZ_classname, "swing") entity_set_model(ent, skill_swing) entity_set_int(ent, EV_INT_solid, SOLID_SLIDEBOX) entity_set_int(ent, EV_INT_movetype, MOVETYPE_NONE) new Float:maxs[3] = {16.0,16.0,36.0} new Float:mins[3] = {-16.0,-16.0,-36.0} entity_set_size(ent, mins, maxs) set_pev(ent, pev_rendermode, kRenderTransAdd) set_pev(ent, pev_renderamt, 255.0) entity_set_float(ent, EV_FL_animtime, get_gametime()) entity_set_float(ent, EV_FL_framerate, 1.0) entity_set_int(ent, EV_INT_sequence, 0) for(new i = 1; i < get_maxplayers(); i++) { if(is_user_alive(i) && entity_range(i, dione) <= 300.0) { message_begin(MSG_ONE, get_user_msgid("ScreenShake"),{0,0,0}, i) write_short(1<<14) write_short(1<<13) write_short(1<<13) message_end() ExecuteHamB(Ham_TakeDamage, i, 0, i, 15.0, DMG_BLAST) new wpn, wpnname[32] wpn = get_user_weapon(i) if(get_weaponname(wpn, wpnname, charsmax(wpnname))) { engclient_cmd(i, "drop", wpnname) } } } drop_to_floor(ent) }
public remove_swing_model(ent) { static ent2 ent2 = find_ent_by_class(-1, "swing") remove_entity(ent2) }
public stop_swing(ent) { entity_set_float(ent, EV_FL_animtime, get_gametime()) entity_set_float(ent, EV_FL_framerate, 1.0) entity_set_int(ent, EV_INT_sequence, 4) g_doing_skill = 0 }
// ====================== POISON SKILL ============================== public dione_poison() { if(!g_can_do_skill) return PLUGIN_HANDLED static ent ent = ent_id g_doing_skill = 1 emit_sound(ent, CHAN_BODY, skill_posion_sound, 1.0, ATTN_NORM, 0, PITCH_NORM) entity_set_float(ent, EV_FL_animtime, get_gametime()) entity_set_float(ent, EV_FL_framerate, 1.0) entity_set_int(ent, EV_INT_sequence, random_num(11, 12)) set_task(3.5, "attack_poison", ent) return PLUGIN_CONTINUE }
public attack_poison(dione) { static Float:Velocity[3], Float:Origin[3], Float:Angles[3], Float:V_Angles[3]
engfunc(EngFunc_GetAttachment, dione, 0, Origin, Angles) //entity_get_vector(dione, EV_VEC_origin, Origin) entity_get_vector(dione, EV_VEC_angles, Angles) entity_get_vector(dione, EV_VEC_v_angle, V_Angles) new ent = create_entity("info_target")
entity_set_origin(ent, Origin) entity_set_vector(ent, EV_VEC_angles, Angles) entity_set_vector(ent, EV_VEC_v_angle, V_Angles) entity_set_string(ent,EV_SZ_classname, "poison") entity_set_model(ent, skill_posion[0]) entity_set_int(ent, EV_INT_solid, SOLID_SLIDEBOX) entity_set_int(ent, EV_INT_movetype, MOVETYPE_FLY) new Float:maxs[3] = {16.0,16.0,36.0} new Float:mins[3] = {-16.0,-16.0,-36.0} entity_set_size(ent, mins, maxs) velocity_by_aim(dione, 1500, Velocity) entity_set_vector(ent, EV_VEC_velocity, Velocity) entity_set_float(dione, EV_FL_animtime, get_gametime()) entity_set_float(dione, EV_FL_framerate, 1.0) entity_set_int(dione, EV_INT_sequence, 4) }
public fw_poison_touch(poison, touch) { entity_set_int(poison, EV_INT_movetype, MOVETYPE_NONE) static Float:Origin[3], Float:beam_origin[8][3] entity_get_vector(poison, EV_VEC_origin, Origin)
// 1st beam_origin[0][0] = Origin[0] + 100.0 beam_origin[0][1] = Origin[1] + 50.0 beam_origin[0][2] = Origin[2] // 2nd beam_origin[1][0] = Origin[0] + 100.0 beam_origin[1][1] = Origin[1] - 50.0 beam_origin[1][2] = Origin[2]
// 3rd beam_origin[2][0] = Origin[0] - 100.0 beam_origin[2][1] = Origin[1] - 50.0 beam_origin[2][2] = Origin[2]
// 4th beam_origin[3][0] = Origin[0] - 100.0 beam_origin[3][1] = Origin[1] + 50.0 beam_origin[3][2] = Origin[2]
// 5th beam_origin[4][0] = Origin[0] + 50.0 beam_origin[4][1] = Origin[1] + 100.0 beam_origin[4][2] = Origin[2]
// 6th beam_origin[5][0] = Origin[0] + 50.0 beam_origin[5][1] = Origin[1] - 100.0 beam_origin[5][2] = Origin[2]
// 7th beam_origin[6][0] = Origin[0] - 50.0 beam_origin[6][1] = Origin[1] - 100.0 beam_origin[6][2] = Origin[2]
// 8th beam_origin[7][0] = Origin[0] - 50.0 beam_origin[7][1] = Origin[1] + 100.0 beam_origin[7][2] = Origin[2] Origin[2] -= 35.0 make_acid(Origin) for(new i; i < 8; i++) { make_acid(beam_origin[i]) } new Float:remove_origin[3] = {999999.9,999999.9,999999.0} entity_set_origin(poison, remove_origin) }
public fw_poison2_touch(poison, touch) { if(is_user_alive(touch)) { static Float:CurTime CurTime = get_gametime() if(CurTime - 1.0 > g_poison_touch[touch]) { static ent ent = find_ent_by_owner(-1, "weapon_knife", touch) ExecuteHamB(Ham_TakeDamage, touch, ent, touch, 10.0, DMG_BLAST) g_poison_touch[touch] = CurTime } } }
public remove_poison(ent) { remove_entity(ent) g_doing_skill = 0 }
public make_acid(Float:Origin[3]) { new ent = create_entity("info_target") entity_set_origin(ent, Origin)
set_pev(ent, pev_rendermode, kRenderTransAdd) set_pev(ent, pev_renderamt, 150.0) entity_set_string(ent,EV_SZ_classname, "poison2") entity_set_model(ent, skill_posion[1]) entity_set_int(ent, EV_INT_solid, SOLID_BBOX) entity_set_int(ent, EV_INT_movetype, MOVETYPE_NONE) new Float:maxs[3] = {40.0, 40.0, 1.0} new Float:mins[3] = {-40.0, -40.0, -1.0} entity_set_size(ent, mins, maxs) drop_to_floor(ent) set_task(5.0, "remove_poison", ent) }
public FindClosesEnemy(entid) { new Float:Dist new Float:maxdistance=4000.0 new indexid=0 for(new i=1;i<=get_maxplayers();i++){ if(is_user_alive(i) && is_valid_ent(i) && can_see_fm(entid, i)) { Dist = entity_range(entid, i) if(Dist <= maxdistance) { maxdistance=Dist indexid=i return indexid } } } return 0 }
public npc_turntotarget(ent, Float:Ent_Origin[3], target, Float:Vic_Origin[3]) { if(target) { new Float:newAngle[3] entity_get_vector(ent, EV_VEC_angles, newAngle) new Float:x = Vic_Origin[0] - Ent_Origin[0] new Float:z = Vic_Origin[1] - Ent_Origin[1]
new Float:radians = floatatan(z/x, radian) newAngle[1] = radians * (180 / 3.14) if (Vic_Origin[0] < Ent_Origin[0]) newAngle[1] -= 180.0 entity_set_vector(ent, EV_VEC_angles, newAngle) } }
public bool:can_see_fm(entindex1, entindex2) { if (!entindex1 || !entindex2) return false
if (pev_valid(entindex1) && pev_valid(entindex1)) { new flags = pev(entindex1, pev_flags) if (flags & EF_NODRAW || flags & FL_NOTARGET) { return false }
new Float:lookerOrig[3] new Float:targetBaseOrig[3] new Float:targetOrig[3] new Float:temp[3]
pev(entindex1, pev_origin, lookerOrig) pev(entindex1, pev_view_ofs, temp) lookerOrig[0] += temp[0] lookerOrig[1] += temp[1] lookerOrig[2] += temp[2]
pev(entindex2, pev_origin, targetBaseOrig) pev(entindex2, pev_view_ofs, temp) targetOrig[0] = targetBaseOrig [0] + temp[0] targetOrig[1] = targetBaseOrig [1] + temp[1] targetOrig[2] = targetBaseOrig [2] + temp[2]
engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0) // checks the had of seen player if (get_tr2(0, TraceResult:TR_InOpen) && get_tr2(0, TraceResult:TR_InWater)) { return false } else { new Float:flFraction get_tr2(0, TraceResult:TR_flFraction, flFraction) if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2)) { return true } else { targetOrig[0] = targetBaseOrig [0] targetOrig[1] = targetBaseOrig [1] targetOrig[2] = targetBaseOrig [2] engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0) // checks the body of seen player get_tr2(0, TraceResult:TR_flFraction, flFraction) if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2)) { return true } else { targetOrig[0] = targetBaseOrig [0] targetOrig[1] = targetBaseOrig [1] targetOrig[2] = targetBaseOrig [2] - 17.0 engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0) // checks the legs of seen player get_tr2(0, TraceResult:TR_flFraction, flFraction) if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2)) { return true } } } } } return false }
public hook_ent(ent, victim) { static Float:fl_Velocity[3] static Float:VicOrigin[3], Float:EntOrigin[3]
pev(ent, pev_origin, EntOrigin) pev(victim, pev_origin, VicOrigin) static Float:distance_f distance_f = get_distance_f(EntOrigin, VicOrigin)
if (distance_f > 60.0) { new Float:fl_Time = distance_f / 250.0
fl_Velocity[0] = (VicOrigin[0] - EntOrigin[0]) / fl_Time fl_Velocity[1] = (VicOrigin[1] - EntOrigin[1]) / fl_Time fl_Velocity[2] = (VicOrigin[2] - EntOrigin[2]) / fl_Time } else { fl_Velocity[0] = 0.0 fl_Velocity[1] = 0.0 fl_Velocity[2] = 0.0 }
entity_set_vector(ent, EV_VEC_velocity, fl_Velocity) }
public create_blood(const Float:origin[3]) { // Show some blood :) message_begin(MSG_BROADCAST, SVC_TEMPENTITY) write_byte(TE_BLOODSPRITE) engfunc(EngFunc_WriteCoord, origin[0]) engfunc(EngFunc_WriteCoord, origin[1]) engfunc(EngFunc_WriteCoord, origin[2]) write_short(m_iBlood[1]) write_short(m_iBlood[0]) write_byte(75) write_byte(5) message_end() }
[/spoiler]
2. shop [spoiler]Kód: #include <amxmodx> #include <fun> #include <cstrike> #define PLUGIN "Bolt" #define VERSION "0.5" #define AUTHOR "CocaIne"
new menu
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR); { menu = menu_create("\ySzerver Bolt \d[\wBy CocaIne\d]","func_menu"); menu_additem( menu, "\wKis gravitacio \y(\r200$\y)") menu_additem( menu, "\wGyorsasag \y(\r400$\y)") menu_additem( menu, "\w200 HP \y(\r800$\y)") menu_additem( menu, "\wPajzs \y(\r700$\y)") menu_additem( menu, "\wIsten mod \y(\r2000$\y)") menu_additem( menu, "\wVilagitas \y - \rPiros \y(\r1$\y)") menu_additem( menu, "\wVilagitas \y - \rKek \y(\r1$\y)") menu_additem( menu, "\wVilagitas \y - \rZold \y(\r1$\y)") menu_additem( menu, "\wVilagitas \y - \rSarga \y(\r1$\y)") menu_additem( menu, "\wVilagitas \y - \rLila \y(\r1$\y)") } register_clcmd("say /shop","go_menu"); register_clcmd("say /bolt","go_menu"); register_clcmd("say shop","go_menu"); register_clcmd("/shop","go_menu"); register_clcmd("shop","go_menu"); register_event("ResetHUD","reset","be") }
public func_menu(id, menu, key) { key++ new penz = cs_get_user_money(id); if(key == 1) { if(penz >= 200) { set_user_gravity(id, 0.100) cs_set_user_money(id,penz-200) } else { client_print(id,print_chat,"Nincs eleg penzed!"); } } if(key == 2) { if(penz >= 400) { set_user_maxspeed(id, 900.0) cs_set_user_money(id,penz-400) } else { client_print(id,print_chat,"Nincs eleg penzed!"); } } if(key == 3) { if(penz >= 800) { set_user_health(id, 200) cs_set_user_money(id,penz-800) } else { client_print(id,print_chat,"Nincs eleg penzed!"); } } if(key == 4) { if(penz >= 700) { set_user_armor(id, 150) cs_set_user_money(id,penz-700) } else { client_print(id,print_chat,"Nincs eleg penzed!"); } } if(key == 5) { if(penz >= 2000) { set_user_godmode(id, 1) cs_set_user_money(id,penz-2000) } else { client_print(id,print_chat,"Nincs eleg penzed!"); } } if(key == 6) { if(penz >= 1) { set_user_rendering(id,kRenderFxGlowShell,255,0,0,kRenderNormal,25) cs_set_user_money(id,penz-1) } else { client_print(id,print_chat,"Nincs eleg penzed!"); } } if(key == 7) { if(penz >= 1) { set_user_rendering(id,kRenderFxGlowShell,0,0,255,kRenderNormal,25) cs_set_user_money(id,penz-1) } else { client_print(id,print_chat,"Nincs eleg penzed!"); } } if(key == 8) { if(penz >= 1) { set_user_rendering(id,kRenderFxGlowShell,0,255,0,kRenderNormal,25) cs_set_user_money(id,penz-1) } else { client_print(id,print_chat,"Nincs eleg penzed!"); } } if(key == 9) { if(penz >= 1) { set_user_rendering(id,kRenderFxGlowShell,255,255,0,kRenderNormal,25) cs_set_user_money(id,penz-1) } else { client_print(id,print_chat,"Nincs eleg penzed!"); } } if(key == 10) { if(penz >= 1) { set_user_rendering(id,kRenderFxGlowShell,155,48,255,kRenderNormal,25) cs_set_user_money(id,penz-1) } else { client_print(id,print_chat,"Nincs eleg penzed!"); } } return PLUGIN_HANDLED } public go_menu(id) { menu_display(id,menu)
return PLUGIN_HANDLED } public reset(id) { client_print(id,print_chat,"Szerver bolt: /bolt"); }
[/spoiler]
3. goldenak
[spoiler]Kód: /* AMX Mod script * * (c) 2009, AlejandroSk * This file is provided as is (no warranties). * */
#include <amxmodx> #include <fakemeta> #include <fun> #include <hamsandwich> #include <cstrike> #include <amxmisc>
#define is_valid_player(%1) (1 <= %1 <= 32)
new AK_V_MODEL[64] = "models/v_ak47gold.mdl" new AK_P_MODEL[64] = "models/p_ak47gold.mdl"
/* Pcvars */ new cvar_dmgmultiplier, cvar_goldbullets, cvar_custommodel, cvar_uclip, cvar_cost
new bool:g_HasAk[33]
new g_hasZoom[ 33 ] new bullets[ 33 ]
// Sprite new m_spriteTexture
const Wep_ak47 = ((1<<CSW_AK47))
public plugin_init() { /* CVARS */ cvar_dmgmultiplier = register_cvar("goldenak_dmg_multiplier", "1.75") cvar_custommodel = register_cvar("goldenak_custom_model", "1") cvar_goldbullets = register_cvar("goldenak_gold_bullets", "0") cvar_uclip = register_cvar("goldenak_unlimited_clip", "0") cvar_cost = register_cvar("goldenak_cost", "3500") // Register The Buy Cmd register_clcmd("say /goldenak", "CmdBuyAk") register_clcmd("say_team /goldenak", "CmdBuyAk") register_concmd("amx_goldenak", "CmdGiveAk", ADMIN_BAN, "<name>") // Register The Plugin register_plugin("Golden Ak 47", "1.0", "AlejandroSk") // Death Msg register_event("DeathMsg", "Death", "a") // Weapon Pick Up register_event("WeapPickup","checkModel","b","1=19") // Current Weapon Event register_event("CurWeapon","checkWeapon","be","1=1") register_event("CurWeapon", "make_tracer", "be", "1=1", "3>0") // Ham TakeDamage RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage") register_forward( FM_CmdStart, "fw_CmdStart" ) RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1) }
public client_connect(id) { g_HasAk[id] = false }
public client_disconnect(id) { g_HasAk[id] = false }
public Death() { g_HasAk[read_data(2)] = false }
public fwHamPlayerSpawnPost(id) { g_HasAk[id] = false }
public plugin_precache() { precache_model(AK_V_MODEL) precache_model(AK_P_MODEL) m_spriteTexture = precache_model("sprites/dot.spr") precache_sound("weapons/zoom.wav") }
public checkModel(id) { if ( !g_HasAk[id] ) return PLUGIN_HANDLED new szWeapID = read_data(2) if ( szWeapID == CSW_AK47 && g_HasAk[id] == true && get_pcvar_num(cvar_custommodel) ) { set_pev(id, pev_viewmodel2, AK_V_MODEL) set_pev(id, pev_weaponmodel2, AK_P_MODEL) } return PLUGIN_HANDLED }
public checkWeapon(id) { new plrClip, plrAmmo, plrWeap[32] new plrWeapId plrWeapId = get_user_weapon(id, plrClip , plrAmmo) if (plrWeapId == CSW_AK47 && g_HasAk[id]) { checkModel(id) } else { return PLUGIN_CONTINUE } if (plrClip == 0 && get_pcvar_num(cvar_uclip)) { // If the user is out of ammo.. get_weaponname(plrWeapId, plrWeap, 31) // Get the name of their weapon give_item(id, plrWeap) engclient_cmd(id, plrWeap) engclient_cmd(id, plrWeap) engclient_cmd(id, plrWeap) } return PLUGIN_HANDLED }
public fw_TakeDamage(victim, inflictor, attacker, Float:damage) { if ( is_valid_player( attacker ) && get_user_weapon(attacker) == CSW_AK47 && g_HasAk[attacker] ) { SetHamParamFloat(4, damage * get_pcvar_float( cvar_dmgmultiplier ) ) } }
public fw_CmdStart( id, uc_handle, seed ) { if( !is_user_alive( id ) ) return PLUGIN_HANDLED if( ( get_uc( uc_handle, UC_Buttons ) & IN_ATTACK2 ) && !( pev( id, pev_oldbuttons ) & IN_ATTACK2 ) ) { new szClip, szAmmo new szWeapID = get_user_weapon( id, szClip, szAmmo ) if( szWeapID == CSW_AK47 && g_HasAk[id] == true && !g_hasZoom[id] == true) { g_hasZoom[id] = true cs_set_user_zoom( id, CS_SET_AUGSG552_ZOOM, 0 ) emit_sound( id, CHAN_ITEM, "weapons/zoom.wav", 0.20, 2.40, 0, 100 ) } else if ( szWeapID == CSW_AK47 && g_HasAk[id] == true && g_hasZoom[id]) { g_hasZoom[ id ] = false cs_set_user_zoom( id, CS_RESET_ZOOM, 0 ) } } return PLUGIN_HANDLED }
public make_tracer(id) { if (get_pcvar_num(cvar_goldbullets)) { new clip,ammo new wpnid = get_user_weapon(id,clip,ammo) new pteam[16] get_user_team(id, pteam, 15) if ((bullets[id] > clip) && (wpnid == CSW_AK47) && g_HasAk[id]) { new vec1[3], vec2[3] get_user_origin(id, vec1, 1) // origin; your camera point. get_user_origin(id, vec2, 4) // termina; where your bullet goes (4 is cs-only) //BEAMENTPOINTS message_begin( MSG_BROADCAST,SVC_TEMPENTITY) write_byte (0) //TE_BEAMENTPOINTS 0 write_coord(vec1[0]) write_coord(vec1[1]) write_coord(vec1[2]) write_coord(vec2[0]) write_coord(vec2[1]) write_coord(vec2[2]) write_short( m_spriteTexture ) write_byte(1) // framestart write_byte(5) // framerate write_byte(2) // life write_byte(10) // width write_byte(0) // noise write_byte( 255 ) // r, g, b write_byte( 215 ) // r, g, b write_byte( 0 ) // r, g, b write_byte(200) // brightness write_byte(150) // speed message_end() } bullets[id] = clip } }
public CmdBuyAk(id) { if ( !is_user_alive(id) ) { client_print(id,print_chat, "[AMXX] Az arany Ak vasarlasahoz elned kell!") return PLUGIN_HANDLED } new money = cs_get_user_money(id) if (money >= get_pcvar_num(cvar_cost)) { cs_set_user_money(id, money - get_pcvar_num(cvar_cost)) give_item(id, "weapon_ak47") g_HasAk[id] = true } else { client_print(id, print_chat, "[AMXX] Nincs eleg penzed arany ak-hoz. Ar $%d ", get_pcvar_num(cvar_cost)) } return PLUGIN_HANDLED }
public CmdGiveAk(id,level,cid) { if (!cmd_access(id,level,cid,2)) return PLUGIN_HANDLED; new arg[32]; read_argv(1,arg,31); new player = cmd_target(id,arg,7); if (!player) return PLUGIN_HANDLED; new name[32]; get_user_name(player,name,31); give_item(player, "weapon_ak47") g_HasAk[player] = true return PLUGIN_HANDLED }
stock drop_prim(id) { new weapons[32], num get_user_weapons(id, weapons, num) for (new i = 0; i < num; i++) { if (Wep_ak47 & (1<<weapons[i])) { static wname[32] get_weaponname(weapons[i], wname, sizeof wname - 1) engclient_cmd(id, "drop", wname) } } } /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1034\\ f0\\ fs16 \n\\ par } */
[/spoiler]
|