ribbl
|
分享:
▼
x0
|
[技術][CS1.6] 发个BOSS源码-NPC
rar里面查看的,有些文字BT自己翻译..... // 袘芯褋褋 褋泻邪褔邪薪 褋 褋邪泄褌邪 Zombie-Mod.ru #include <amxmodx> #include <amxmisc> #include <engine> #include <cstrike> #include <hamsandwich> #include <fakemeta> #include <fun>
#define PLUGIN "[ZS] Alien Boss" #define VERSION "3.0" #define AUTHOR "Remake muxaz"
#define ANIM_DUMMY 0 #define ANIM_DEATH 1 #define ANIM_IDLE 2 #define ANIM_WALK 3 #define ANIM_RUN 4 #define ANIM_SHOCKWAVE 5 #define ANIM_JUSTICESWING 6 #define ANIM_MAHADASH 7
#define ALIEN_HEALTH 100000.0 // 袞懈蟹薪褜 袘芯褋褋邪 //#define ALIEN_BONUS_KILL 5000 // 袘芯薪褍褋 写谢褟 褍斜懈泄褋褌胁邪 袘芯褋褋邪 #define ALIEN_ATTACK_DELAY 1.0 // 袩褉芯屑械卸褍褌芯泻 屑械卸写褍 邪褌邪泻邪屑懈 袘芯褋褋邪 #define ALIEN_ATTACK_DISTANCE 160.0 // 袛懈褋褌邪薪褑懈褟 写谢褟 邪褌邪泻懈 袘芯褋褋邪 #define ALIEN_DASH_DISTANCE 200.0 // 袛懈褋褌邪薪褑懈褟 薪邪 泻邪褌芯褉褍褞 袘芯褋褋 锌褉褘谐邪械褌
#define ALIEN_JUMP_AFTER_SWING_COUNT 4 // 袨褌褋褔械褌 屑械卸写褍 褋泻懈谢谢邪屑懈
#define ALIEN_TASK 231211 #define ALIEN_TASK1 113713 #define ALIEN_TASK2 123714 #define ALIEN_TASK3 133715 #define ALIEN_TASK4 143716
// Agression one - 1-褘泄 褍褉芯胁械薪懈褌褜 邪谐褉械褋褋懈 #define ALIEN_SPEED_AG1 220 // 小泻芯褉芯褋褌褜 袘芯褋褋邪 锌褉懈 1 邪谐褉械褋褋懈懈 #define ALIEN_DAMAGE_ATTACK_AG1 100.0 // 校褉芯薪 袘芯褋褋邪 锌褉懈 1 邪谐褉械褋褋懈懈 #define ALIEN_DASH_DAMAGE_AG1 100 // 校褉芯薪 袘芯褋褋邪 锌褉懈 懈褋锌芯谢褜蟹芯胁邪薪懈械 褋泻懈谢谢邪 胁 1 邪谐褉械褋褋懈懈 #define ALIEN_SHOCK_SCREEN_RADIUS_AGRES1 800 // 袪邪写懈褍褋 褌褉褟褋泻懈 懈 褍褉芯薪邪 锌褉懈 胁芯谢薪械 胁 1 邪谐褉械褋褋懈懈 #define ALIEN_SHOCK_SCREEN_DAMAGE_AGRES1 50 // 校褉芯薪 芯褌 胁芯谢薪褘 胁 1 邪谐褉械褋褋懈懈
// Agression two - 2-芯泄 褍褉芯胁械薪褜 邪谐褉械褋褋懈 泻芯谐写邪 屑械薪褜 50 % 卸懈蟹薪懈 褍 邪谢懈械薪邪 #define ALIEN_SPEED_AG2 260 // 小泻芯褉芯褋褌褜 袘芯褋褋邪 锌褉懈 2 邪谐褉械褋褋懈懈 #define ALIEN_DAMAGE_ATTACK_AG2 100.0 // 校褉芯薪 袘芯褋褋邪 锌褉懈 2 邪谐褉械褋褋懈懈 #define ALIEN_DASH_DAMAGE_AG2 150 // 校褉芯薪 袘芯褋褋邪 锌褉懈 懈褋锌芯谢褜蟹芯胁邪薪懈械 褋泻懈谢谢邪 胁 2 邪谐褉械褋褋懈懈 #define ALIEN_SHOCK_SCREEN_RADIUS_AGRES2 500 // 袪邪写懈褍褋 褌褉褟褋泻懈 懈 褍褉芯薪邪 锌褉懈 胁芯谢薪械 胁 1 邪谐褉械褋褋懈懈 #define ALIEN_SHOCK_SCREEN_DAMAGE_AGRES2 200 // 校褉芯薪 芯褌 胁芯谢薪褘 胁 2 邪谐褉械褋褋懈懈
#define npc_classname "zs_alien" #define npc_model "models/zombie_plague/boss_alien.mdl" // 袦芯写械谢褜 袘芯褋褋邪 #define npc_sprite "sprites/zombie_plague/boss_health.spr" // 小锌褉邪泄褌 卸懈蟹薪懈 袘芯褋褋邪 #define SPRITE_Z 250 // 袙褘褋芯褌邪 褋锌褉邪泄褌邪 卸懈蟹薪懈
new const g_AlienSound[][] = { "zombie_plague/boss_death.wav", "zombie_plague/boss_dash.wav", "zombie_plague/boss_swing.wav", "zombie_plague/boss_shokwave.wav" }
new const g_CountSound[][] = { "zombie_plague/vox/1.wav", "zombie_plague/vox/2.wav", "zombie_plague/vox/3.wav", "zombie_plague/vox/4.wav", "zombie_plague/vox/5.wav", "zombie_plague/vox/6.wav", "zombie_plague/vox/7.wav", "zombie_plague/vox/8.wav", "zombie_plague/vox/9.wav", "zombie_plague/vox/10.wav" }
enum { FM_CS_TEAM_UNASSIGNED = 0, FM_CS_TEAM_T, FM_CS_TEAM_CT, FM_CS_TEAM_SPECTATOR }
new Float:g_dmg[512] new Float:g_distance[512] new Float:g_lastat[512] new Float:g_atdelay[512] new g_speed[512] new g_moves[512] new g_alive[512] new g_target[512] //new g_reward[512] new g_animrun[512] new g_exprew[512] new g_animattack[512] new g_ability new g_timer new g_game_start new g_can_jump new g_maxplayers new g_pBeam new g_pSprite new g_jump_count[512] new bool:start_swing[512] new bool:start_knock[512] new bool:g_bAlienLevel new spr_blood_drop, spr_blood_spray new g_screenshake new const UNIT_SECOND = (1<<12)
// HoLLyWooD #define TASK_CREATE_NPC 123124 #define ALIEN_CREATE_TASK 21341 new Float:g_fUserDamage[33] new g_iRandomSkills = ALIEN_JUMP_AFTER_SWING_COUNT; new bool:g_bChangeLevel = false;
// Command for changelevel new const g_sVoteCommand[] = "amx_map de_cityrush";
new msgID_deathMsg, msgID_sayText; new g_szName[33][32]
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR)
RegisterHam(Ham_Killed, "info_target", "npc_killed"); RegisterHam(Ham_Killed, "player", "player_killed"); RegisterHam(Ham_Think, "info_target", "npc_think"); RegisterHam(Ham_TraceAttack, "info_target", "npc_traceattack"); RegisterHam(Ham_TakeDamage, "info_target", "npc_takedamage")
register_forward(FM_PlayerPreThink, "fw_PlayerPreThink"); register_forward(FM_UpdateClientData, "fwd_UpdateClientData", 1);
register_logevent("round_end", 2, "1=Round_End") register_event("DeathMsg", "event_death", "ae")
register_clcmd("+attack", "block", g_timer)
g_screenshake = get_user_msgid("ScreenShake") g_maxplayers = get_maxplayers() g_pSprite = create_entity("info_target"); entity_set_model(g_pSprite, npc_sprite); entity_set_int(g_pSprite, EV_INT_rendermode, kRenderTransTexture); entity_set_float(g_pSprite, EV_FL_renderamt, 0.0); msgID_deathMsg = get_user_msgid("DeathMsg"); msgID_sayText = get_user_msgid("SayText"); register_message(msgID_deathMsg, "msg_deathMsg") }
public plugin_precache() { new mapname[32] get_mapname(mapname, charsmax(mapname)) if(equali(mapname, "zm_boss_depot")) { set_task(15.0, "begin_create_npc", TASK_CREATE_NPC); }else{ pause("ad"); } precache_model(npc_model) precache_model(npc_sprite)
new i; for(i = 0 ; i < sizeof g_CountSound ; i++) precache_sound(g_CountSound);
for(i = 0 ; i < sizeof g_AlienSound ; i++) precache_sound(g_AlienSound); spr_blood_drop = precache_model("sprites/blood.spr") spr_blood_spray = precache_model("sprites/bloodspray.spr") g_pBeam = precache_model( "sprites/shockwave.spr" ) }
public block(id) return PLUGIN_HANDLED;
public begin_create_npc(){ spawn_alien(); }
public client_connect(id){ g_fUserDamage[id] = 0.0 }
public spawn_alien() { set_task(1.0, "count_start", ALIEN_TASK) g_timer = 15 //26 set_task(16.0, "create_alien", ALIEN_CREATE_TASK); }
public create_alien() { new Float:origin[3]; // Origins for center map origin[0] = -27.0 origin[0] = 24.0 origin[2] = 460.0
origin[1] += 50.0 new ent = npc_alien_spawn(1, 1); set_pev(ent, pev_origin, origin); start_swing[ent] = false start_knock[ent] = false g_ability = false g_game_start = false g_jump_count[ent] = 0 origin[2] += SPRITE_Z; entity_set_origin(g_pSprite, origin); entity_set_int(g_pSprite, EV_INT_rendermode, kRenderNormal); entity_set_float(g_pSprite, EV_FL_renderamt, 16.0); entity_set_float(g_pSprite, EV_FL_frame, 100.0); g_game_start = true; }
public npc_alien_spawn(anim_run, exprew) { new ent = create_entity("info_target"); if(!ent) return 0; entity_set_string(ent, EV_SZ_classname, npc_classname); entity_set_model(ent, npc_model); entity_set_int(ent, EV_INT_iuser4, 0); entity_set_int(ent, EV_INT_solid, SOLID_BBOX); entity_set_int(ent, EV_INT_movetype, MOVETYPE_PUSHSTEP); entity_set_float(ent, EV_FL_takedamage, 1.0); entity_set_float(ent, EV_FL_gravity, 1.0); entity_set_float(ent, EV_FL_health, ALIEN_HEALTH); entity_set_float(ent, EV_FL_animtime, get_gametime()); entity_set_float(ent, EV_FL_nextthink, get_gametime() + 1.0) Util_PlayAnimation(ent, ANIM_SHOCKWAVE);
new Float: maxs[3] = { 16.0, 16.0, 60.0 } new Float: mins[3] = {-16.0, -16.0, -36.0}
entity_set_size(ent, mins, maxs)
g_alive[ent] = 1 g_dmg[ent] = ALIEN_DAMAGE_ATTACK_AG1 g_animrun[ent] = ANIM_RUN //g_reward[ent] = ALIEN_BONUS_KILL g_speed[ent] = ALIEN_SPEED_AG1 g_distance[ent] = ALIEN_ATTACK_DISTANCE g_atdelay[ent] = ALIEN_ATTACK_DELAY g_lastat[ent] = 0.0 g_exprew[ent] = exprew g_target[ent] = find_closes_enemy(ent)
set_task(5.0, "update_target", ent)
return ent; }
public npc_think(ent) { if(!is_valid_ent(ent)) return;
static className[32], animation; animation = 0; entity_get_string(ent, EV_SZ_classname, className, charsmax(className))
if(!equali(className, npc_classname)) return; if (!g_bAlienLevel) if (entity_get_float(ent, EV_FL_health) <= (ALIEN_HEALTH / 2.0)) { g_bAlienLevel = true; g_speed[ent] = ALIEN_SPEED_AG2; g_dmg[ent] = ALIEN_DAMAGE_ATTACK_AG2; } if(g_alive[ent]) { new Float:vecOrigin[3]; entity_get_vector(ent, EV_VEC_origin, vecOrigin); vecOrigin[2] += SPRITE_Z; entity_set_origin(g_pSprite, vecOrigin); if(g_game_start) { new Float:velocity[3] pev(ent,pev_velocity,velocity) velocity[0] += velocity[1] + velocity[2]
if(!is_user_alive(g_target[ent])) g_target[ent] = find_closes_enemy(ent) new Float:angle[3], Float:zmaim[3] pev(g_target[ent], pev_origin, zmaim) aim_at_origin(ent, zmaim, angle) angle[0] = 0.0 entity_set_vector(ent, EV_VEC_angles, angle)
if(g_target[ent]) { new Float:origins[3] pev(ent, pev_origin, origins) new Float:flDistance = get_distance_f(origins, zmaim) if(flDistance> 170.0) { if(g_moves[ent]) { zmaim[0] += random_num(1, -1) * 80.0 zmaim[1] += random_num(1, -1) * 80.0 g_moves[ent] -= 1 } else if(!g_moves[ent] && random_num(1, 5) == 1) g_moves[ent] = 20 } if(flDistance <= ALIEN_ATTACK_DISTANCE) g_moves[ent] = 0 if(flDistance <= g_distance[ent] && get_gametime() - g_lastat[ent] > g_atdelay[ent]) { if(!start_swing[ent] && !start_knock[ent]) { g_lastat[ent] = get_gametime() new anim = ANIM_JUSTICESWING
Util_PlayAnimation(ent, ANIM_IDLE) Util_PlayAnimation(ent, anim) ExecuteHamB(Ham_TakeDamage, g_target[ent] , 0, 0, g_dmg[ent], DMG_BULLET); set_task(2.0, "reset_swing", ent + ALIEN_TASK3) start_swing[ent] = true g_animattack[ent] = anim if(anim == ANIM_JUSTICESWING) emit_sound(ent, CHAN_VOICE, g_AlienSound[2], VOL_NORM, ATTN_NORM, 0, PITCH_NORM) if(g_jump_count[ent] < g_iRandomSkills) g_jump_count[ent]++ } } else { new Float:frames if(g_animattack[ent] == ANIM_JUSTICESWING) frames = 1.5 if(get_gametime() - g_lastat[ent] > frames) { if(flDistance <= g_distance[ent]) Util_PlayAnimation(ent, ANIM_IDLE) else { if(g_jump_count[ent] == g_iRandomSkills && flDistance <= 400.0) { // change skill delay g_iRandomSkills = random_num(2,4); if(!task_exists(ent + ALIEN_TASK2) && !task_exists(ent + ALIEN_TASK1)) { new task_args[4] task_args[0] = ent task_args[1] = floatround(zmaim[0]*100000, floatround_floor) task_args[2] = floatround(zmaim[1]*100000, floatround_floor) task_args[3] = floatround(zmaim[2]*100000, floatround_floor) if(!g_ability) { g_ability = true Util_PlayAnimation(ent, ANIM_MAHADASH) emit_sound(ent, CHAN_VOICE, g_AlienSound[1], VOL_NORM, ATTN_NORM, 0, PITCH_NORM) set_task(0.8, "go_jump", ent + ALIEN_TASK1, task_args, 4) animation = 1; } else { if (entity_get_float(ent, EV_FL_health) > (ALIEN_HEALTH / 2)) { server_print("--------- 1"); Util_PlayAnimation(ent, ANIM_SHOCKWAVE) start_knock[ent] = true set_task(2.1, "go_knock_agres1", ent + ALIEN_TASK1, task_args, 4) } else if (entity_get_float(ent, EV_FL_health) <= (ALIEN_HEALTH / 2)) { server_print("--------- 2"); Util_PlayAnimation(ent, ANIM_SHOCKWAVE) start_knock[ent] = true set_task(2.1, "go_knock_agres2", ent + ALIEN_TASK1, task_args, 4) } animation = 2; } } } else { ent_move_to(ent, zmaim, g_speed[ent]) Util_PlayAnimation(ent, g_animrun[ent]) } } } } } if(!g_target[ent]) Util_PlayAnimation(ent, ANIM_IDLE) } else if(g_can_jump) Util_PlayAnimation(ent, ANIM_IDLE) else Util_PlayAnimation(ent, ANIM_IDLE) if(animation == 1) entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.8); else if(animation == 2) entity_set_float(ent, EV_FL_nextthink, get_gametime() + 2.1); else entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.01); } }
public check_dash_damage(ent, id) { ent = ent - ALIEN_TASK4 for(new i = 0; i < g_maxplayers; i++) { if(is_user_alive(i)) { new Float:range_distance = entity_range(ent, i) new health = get_user_health(i) if(ALIEN_DASH_DISTANCE < floatround(range_distance) < ALIEN_ATTACK_DISTANCE) { if (g_bAlienLevel) { if(health - ALIEN_DASH_DAMAGE_AG2 > 0) set_user_health(i, health - ALIEN_DASH_DAMAGE_AG2) else { user_silentkill(i) message_begin(MSG_ALL, get_user_msgid("DeathMsg")) write_byte(ent) write_byte(i) write_byte(0) write_string("Boss Alien") message_end() } } else { if(health - ALIEN_DASH_DAMAGE_AG1 > 0) set_user_health(i, health - ALIEN_DASH_DAMAGE_AG1) else { user_silentkill(i) message_begin(MSG_ALL, get_user_msgid("DeathMsg")) write_byte(ent) write_byte(i) write_byte(0) write_string("Boss Alien") message_end() } } } } } }
public go_knock_agres1(args[], id) { new ent = args[0] new Float:origin[3] pev(ent,pev_origin,origin) message_begin(MSG_BROADCAST, SVC_TEMPENTITY ); write_byte(TE_BEAMCYLINDER) write_coord(floatround(origin[0])) write_coord(floatround(origin[1])) write_coord(floatround(origin[2])-16) write_coord(floatround(origin[0])) write_coord(floatround(origin[1])) write_coord(floatround(0.0)) write_short(g_pBeam) // sprite write_byte(0) // startframe write_byte(0) // framerate write_byte(25) // life write_byte(60) // width write_byte(0) // noise write_byte(255) // red write_byte(255) // green write_byte(0) // blue write_byte(200) // brightness write_byte(0) // speed message_end() emit_sound(ent, CHAN_VOICE, g_AlienSound[3], VOL_NORM, ATTN_NORM, 0, PITCH_NORM) set_task(1.0, "reset_knock", ent + ALIEN_TASK2)
static Float:flOrigin[3] , Float:flDistance , Float:flSpeed for(new iVictim=1;iVictim <= 32;iVictim++) { new health = get_user_health(iVictim)
if(is_user_connected(iVictim) && is_user_alive(iVictim)) { pev(iVictim, pev_origin, flOrigin) flDistance = get_distance_f ( origin, flOrigin )
if(flDistance <= ALIEN_SHOCK_SCREEN_RADIUS_AGRES1) { ScreenShake(iVictim)
flSpeed = 1400.0 static Float:flNewSpeed flNewSpeed = flSpeed * ( 1.0 - ( flDistance / 1000.0 ) ) set_user_health(iVictim, health - ALIEN_SHOCK_SCREEN_DAMAGE_AGRES1) static Float:flVelocity [ 3 ] get_speed_vector ( origin, flOrigin, flNewSpeed, flVelocity ) set_pev ( iVictim, pev_velocity,flVelocity ) } } } }
public go_knock_agres2(args[], id) { new ent = args[0] new Float:origin[3] pev(ent,pev_origin,origin) message_begin(MSG_BROADCAST, SVC_TEMPENTITY ); write_byte(TE_BEAMCYLINDER) write_coord(floatround(origin[0])) write_coord(floatround(origin[1])) write_coord(floatround(origin[2])-16) write_coord(floatround(origin[0])) write_coord(floatround(origin[1])) write_coord(floatround(0.0)) write_short(g_pBeam) // sprite write_byte(0) // startframe write_byte(0) // framerate write_byte(10) // life write_byte(60) // width write_byte(0) // noise write_byte(250) // red write_byte(0) // green write_byte(0) // blue write_byte(200) // brightness write_byte(0) // speed message_end() emit_sound(ent, CHAN_VOICE, g_AlienSound[3], VOL_NORM, ATTN_NORM, 0, PITCH_NORM) set_task(1.0, "reset_knock", ent + ALIEN_TASK2)
static Float:flOrigin[3] , Float:flDistance , Float:flSpeed for(new iVictim=1;iVictim <= 32;iVictim++) { new health = get_user_health(iVictim)
if(is_user_connected(iVictim) && is_user_alive(iVictim)) { pev(iVictim, pev_origin, flOrigin) flDistance = get_distance_f ( origin, flOrigin )
if(flDistance <= ALIEN_SHOCK_SCREEN_RADIUS_AGRES2) { ScreenShake(iVictim)
flSpeed = 1400.0 static Float:flNewSpeed flNewSpeed = flSpeed * ( 1.0 - ( flDistance / 1000.0 ) ) set_user_health(iVictim, health - ALIEN_SHOCK_SCREEN_DAMAGE_AGRES2) static Float:flVelocity [ 3 ] get_speed_vector ( origin, flOrigin, flNewSpeed, flVelocity ) set_pev ( iVictim, pev_velocity,flVelocity ) } } } }
public ScreenShake(id) { if(!is_user_alive(id)) return;
message_begin(MSG_ONE_UNRELIABLE, g_screenshake, _, id) write_short(UNIT_SECOND*7) // amplitude write_short(UNIT_SECOND*5) // duration write_short(UNIT_SECOND*15) // frequency message_end() }
public reset_knock(ent) { ent = ent - ALIEN_TASK2 start_knock[ent] = false g_ability = false g_jump_count[ent] = 0 }
public go_jump(args[]) { new ent = args[0] new Float:zmaim[3] zmaim[0]=float(args[1]/100000) zmaim[1]=float(args[2]/100000) zmaim[2]=float(args[3]/100000) ent_jump_to(ent, zmaim, 1700) g_can_jump = true set_task(0.6, "check_dash_damage", ent + ALIEN_TASK4) set_task(1.4, "reset_jump", ent + ALIEN_TASK2) }
public reset_swing(ent) { ent = ent - ALIEN_TASK3 start_swing[ent] = false }
public reset_jump(ent) { ent = ent - ALIEN_TASK2 g_jump_count[ent] = 0 set_task(0.5, "reset_time", ent + 55555) }
public reset_time() g_can_jump = false public npc_takedamage(ent, inflictor, attacker, Float:damage, damage_type) { if(!is_user_alive(attacker) || !is_valid_ent(ent)) return;
new className[32]; entity_get_string(ent, EV_SZ_classname, className, charsmax(className))
if(!equali(className, npc_classname) || !g_alive[ent]) return; g_fUserDamage[attacker] += damage; //client_print(attacker, print_center, "%f" , g_fUserDamage[attacker]); if(g_fUserDamage[attacker] >= 2000){ g_fUserDamage[attacker] -= 2000; } entity_set_float(g_pSprite, EV_FL_frame, entity_get_float(ent, EV_FL_health) / (ALIEN_HEALTH / 100.0)); }
public fw_PlayerPreThink(id) { if(cs_get_user_team(id) == CS_TEAM_T) cs_set_user_team(id, CS_TEAM_CT) }
public force_team(id) { engclient_cmd(id, "jointeam", "2", "3") }
public npc_traceattack(ent, attacker, Float: damage, Float: direction[3], trace, damageBits) { if(!is_valid_ent(ent) || !g_alive[ent]) return;
new className[32]; entity_get_string(ent, EV_SZ_classname, className, charsmax(className))
if(!equali(className, npc_classname) || !g_alive[ent]) return;
new Float: end[3] get_tr2(trace, TR_vecEndPos, end);
message_begin(MSG_BROADCAST, SVC_TEMPENTITY) write_byte(TE_BLOODSPRITE) engfunc(EngFunc_WriteCoord, end[0]) engfunc(EngFunc_WriteCoord, end[1]) engfunc(EngFunc_WriteCoord, end[2]) write_short(spr_blood_spray) write_short(spr_blood_drop) write_byte(247) write_byte(random_num(5, 10)) message_end() }
public player_killed(ent, attacker) { for(new id=1;id<g_maxplayers;id++) { if(is_user_alive(id)) return; } begin_changelevel(); client_print(0, print_chat, "袙褋械 谢褞写懈 褍屑械褉谢懈! 小屑械薪邪 泻邪褉褌褘 薪邪褔邪谢邪褋褜!"); }
public npc_killed(ent, attacker) { new className[32]; entity_get_string(ent, EV_SZ_classname, className, charsmax(className))
if(!equali(className, npc_classname) || !g_alive[ent]) return HAM_IGNORED;
g_alive[ent] = 0 Util_PlayAnimation(ent, ANIM_DEATH); emit_sound(ent, CHAN_VOICE, g_AlienSound[0], VOL_NORM, ATTN_NORM, 0, PITCH_NORM) remove_task(ent) set_pev(ent, pev_solid, SOLID_NOT) set_task(4.5, "npc_remove", ent)
entity_set_int(ent, EV_INT_iuser4, 1);
//cs_set_user_money(attacker, cs_get_user_money(attacker) + g_reward[ent]) entity_set_int(g_pSprite, EV_INT_rendermode, kRenderTransTexture); entity_set_float(g_pSprite, EV_FL_renderamt, 0.0); begin_changelevel(); client_print(0, print_chat, "袘芯褋褋 褍屑械褉! 小屑械薪邪 泻邪褉褌褘 薪邪褔邪谢邪褋褜!");
return HAM_SUPERCEDE; }
public round_end() { remove_task(ALIEN_TASK) remove_task(ALIEN_TASK1) remove_task(ALIEN_TASK2) remove_task(ALIEN_TASK3) remove_task(ALIEN_TASK4)
g_game_start = false begin_changelevel(); }
public event_death(id) { static ent = -1; while ((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", npc_classname)) != 0) { if(g_target[ent] == id) g_target[ent] = find_closes_enemy(ent) } client_cmd(id, "stopsound") new iVictim = read_data(2) new iKiller = read_data(1) new iHS = read_data(3) new szWeapon[24] read_data(4, szWeapon, 23) if(!is_user_connected(iVictim)) { do_deathmsg(iKiller, iVictim, iHS, szWeapon) return PLUGIN_CONTINUE } if(!is_user_connected(iKiller) && iKiller != ent) { do_deathmsg(iKiller, iVictim, iHS, szWeapon) return PLUGIN_CONTINUE } if(iKiller != iVictim && iKiller == ent) { new iNewKiller for(new i = 1; i < g_maxplayers; i++){ if(is_user_connected(i) && i != iVictim && !is_user_admin(id)) { iNewKiller = i; break; } } if(!iNewKiller || iNewKiller == iKiller) { do_deathmsg(iVictim, iVictim, iHS, szWeapon) return PLUGIN_HANDLED; } new szName[32];
get_user_name(iNewKiller, szName, 31) g_szName[iNewKiller] = szName
set_msg_block(msgID_sayText, BLOCK_ONCE); set_user_info(iNewKiller, "name", "ALIEN BOSS"); new args[4]
args[0] = iVictim args[1] = iNewKiller args[2] = iHS set_task(0.01, "player_diePost", 0, args, 3) } else { do_deathmsg(iVictim, iVictim, iHS, szWeapon) } return PLUGIN_CONTINUE; }
public player_diePost(arg[]) { new szWeapon[24] = "allien_boss_attack"; new iKiller = arg[1] new CsTeams:tempteam = cs_get_user_team(iKiller); cs_set_user_team(iKiller, CS_TEAM_T); do_deathmsg(iKiller, arg[0], arg[2], szWeapon) cs_set_user_team(iKiller, tempteam);
set_msg_block(msgID_sayText, BLOCK_ONCE) set_user_info(iKiller, "name", g_szName[iKiller])
return PLUGIN_CONTINUE }
public npc_remove(ent) { remove_task(ALIEN_TASK) remove_task(ALIEN_TASK1) remove_task(ALIEN_TASK2) remove_task(ALIEN_TASK3) remove_task(ALIEN_TASK4) remove_entity(ent) remove_task(ent) g_jump_count[ent] = 0 g_game_start = false }
public count_start(ent) { g_timer = g_timer - 1 if(g_timer > 0) client_print(0, print_center, "袠谐褉邪 薪邪褔薪褢褌褋褟 褔械褉械蟹 %d 褋械泻褍薪写.", g_timer) if(g_timer < 11) client_cmd(0, "spk zombie_plague/vox/%d", g_timer) if(g_timer >= 0) set_task(1.0, "count_start", ALIEN_TASK) if(g_timer == 0) { client_print(0, print_center, "Alien Boss 锌芯褟胁懈谢褋褟 褍斜械泄褌械 械谐芯!") g_game_start = true } }
public update_target(ent) { if(!is_valid_ent(ent)) return;
g_target[ent] = find_closes_enemy(ent) set_task(5.0, "update_target", ent) }
public msg_deathMsg() return PLUGIN_HANDLED;
public begin_changelevel(){ g_bChangeLevel = true; new ent; if((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", npc_classname)) != 0) npc_remove(ent); for(new id=1; id<g_maxplayers; id++) { if(is_user_alive(id)) { set_pev(id, pev_velocity, 1.0); set_pev(id, pev_maxspeed, 1.0); } } server_cmd(g_sVoteCommand); }
public fwd_UpdateClientData(id, weapons, cd) { if(id < 0 || id > g_maxplayers) return FMRES_IGNORED if(g_bChangeLevel) { set_cd(cd, CD_flNextAttack, 0.5) set_cd(cd, CD_MaxSpeed, 1.0) return FMRES_HANDLED } return FMRES_IGNORED }
stock do_deathmsg(iKiller, iVictim, iHS, const szWeapon[]) { message_begin(MSG_ALL, msgID_deathMsg) write_byte(iKiller) write_byte(iVictim) write_byte(iHS) write_string(szWeapon) message_end() }
stock find_closes_enemy(ent) { new enemy, Float:dist, Float:distmin, Float:origin[3], Float:originT[3] pev(ent, pev_origin, origin) origin[2] += 120.0 for(new id=1; id<=32; id++) { if (!is_user_alive(id)) continue;
dist = entity_range(ent, id) pev(id, pev_origin, originT) if ((!distmin || dist <= distmin)) { distmin = dist enemy = id } }
return enemy }
stock ent_move_to(ent, Float:target[3], speed) { static Float:vec[3] aim_at_origin(ent, target, vec) engfunc(EngFunc_MakeVectors, vec) global_get(glb_v_forward, vec) vec[0] *= speed vec[1] *= speed vec[2] *= speed * 0.1 set_pev(ent, pev_velocity, vec) new Float:angle[3] aim_at_origin(ent, target, angle) angle[0] = 0.0 entity_set_vector(ent, EV_VEC_angles, angle) }
stock ent_jump_to(ent, Float:target[3], speed) { static Float:vec[3] aim_at_origin(ent, target, vec) engfunc(EngFunc_MakeVectors, vec) global_get(glb_v_forward, vec) vec[0] *= speed vec[1] *= speed vec[2] *= speed * 0.1 set_pev(ent, pev_velocity, vec) new Float:angle[3] aim_at_origin(ent, target, angle) angle[0] = 0.0 entity_set_vector(ent, EV_VEC_angles, angle) }
stock aim_at_origin(id, Float:target[3], Float:angles[3]) { static Float:vec[3] pev(id, pev_origin, vec) vec[0] = target[0] - vec[0] vec[1] = target[1] - vec[1] vec[2] = target[2] - vec[2] engfunc(EngFunc_VecToAngles, vec, angles) angles[0] *= -1.0, angles[2] = 0.0 }
stock get_speed_vector(const Float:origin1[3], const Float:origin2[3], Float:speed, Float:new_velocity[3]) { new_velocity[0] = origin2[0] - origin1[0] new_velocity[1] = origin2[1] - origin1[1] new_velocity[2] = origin2[2] - origin1[2] new Float:num = floatsqroot(speed*speed / (new_velocity[0]*new_velocity[0] + new_velocity[1]*new_velocity[1] + new_velocity[2]*new_velocity[2])) new_velocity[0] *= num new_velocity[1] *= num new_velocity[2] *= num return 1; }
stock Util_PlayAnimation(index, sequence, Float: framerate = 1.0) { if(entity_get_int(index, EV_INT_sequence) == sequence) return;
entity_set_float(index, EV_FL_animtime, get_gametime()); entity_set_float(index, EV_FL_framerate, framerate); entity_set_float(index, EV_FL_frame, 0.0); entity_set_int(index, EV_INT_sequence, sequence); }
stock bool:is_hull_vacant(const Float:origin[3], hull,id) { static tr engfunc(EngFunc_TraceHull, origin, origin, 0, hull, id, tr) if (!get_tr2(tr, TR_StartSolid) || !get_tr2(tr, TR_AllSolid)) return true
return false }
stock fm_set_user_health(id, health) { (health > 0) ? set_pev(id, pev_health, float(health)) : dllfunc(DLLFunc_ClientKill, id); }
// 袘芯褋褋 褋泻邪褔邪薪 褋 褋邪泄褌邪 Zombie-Mod.ru
|