#include #include #include new const SMOKEGRENADE_MODEL[] = "models/w_smokegrenade.mdl" new const HEGRENADE_MODEL[] = "models/w_hegrenade.mdl" new const FLASHBANG_MODEL[] = "models/w_flashbang.mdl" new const USE1[20][] = { "scientist/whoareyou.wav", "scientist/excellentteam.wav", "scientist/yesihope.wav", "scientist/getoutofhere.wav", "scientist/waithere.wav", "scientist/gottogetout.wav", "scientist/c1a3_sci_rescued.wav", "scientist/madness.wav", "scientist/getoutalive.wav", "scientist/hello.wav", "scientist/okihope.wav", "scientist/greetings.wav", "scientist/hopeyouknow.wav", "scientist/fine.wav", "scientist/okgetout.wav", "scientist/c1a3_sci_thankgod.wav", "scientist/leadtheway.wav", "scientist/yesletsgo.wav", "scientist/c1a3_sci_atlast.wav", "scientist/letsgo.wav" } new const USE2[7][] = { "scientist/illwait.wav", "scientist/illwaithere.wav", "scientist/whyleavehere.wav", "scientist/reconsider.wav", "scientist/leavingme.wav", "scientist/beenaburden.wav", "scientist/stop4.wav" } new const IDLE[6][] = { "scientist/c1a0_sci_stall.wav", "scientist/cough.wav", "scientist/rescueus.wav", "scientist/overhere.wav", "scientist/cantbeworse.wav", "scientist/c3a2_sci_1glu.wav" } new const ATTACKED[6][] = { "scientist/sci_fear3.wav", "scientist/sci_fear9.wav", "scientist/sci_fear13.wav", "scientist/dontwantdie.wav", "scientist/whatyoudoing.wav", "scientist/noplease.wav" } new const CHASE[2][] = { "scientist/rightwayout.wav", "scientist/evergetout.wav" } enum {//ANIMATIONS walk, walk_scared, run, run1, run2, a180_Left, a180_Right, flinch, flinch1, laflinch, raflinch, llflinch, rlflinch, idle1, idle3, idle4, idle5, idle6, idle7, crouchstand, crouch_idle, crouch_idle2, crouch_idle3, crouch_idle4, panic, fear1, fear2, eye_wipe, pull_needle, return_needle, give_shot, diesimple, dieforward, dieforward1, diebackward, headshot, gutshot, barnacled1, barnacled2, barnacled3, barnacled4, lying_on_back, lying_on_stomach, dead_sitting, dead_table1, dead_table2, dead_table3, console, checktie, dryhands, tieshoe, writeboard, studycart, lean, pondering, pondering2, pondering3, buysoda, pause1, yes, no, push_button, converse1, converse2, retina, talkleft, talkright, deskidle, coffee, franticbutton, startle, sitlookleft, sitlookright, sitscared, sitting2, sitting3, cprscientist, cprscientistrevive, cowering_in_corner, sstruggleidle, sstruggle, headcrabbed, c1a0_catwalkidle, c1a0_catwalk, ceiling_dangle, ventpull1, ventpull2, ventpullidle1, ventpullidle2, sitidle, sitstand, keypad, lookwindow, wave, pulldoor, beatdoor, fallingloop, crawlwindow, divewindow, locked_door, push_button2, unlock_door, quicklook, handrailidle, handrail, hanging_idle, fall, scientist_get_pulled, hanging_idle2, fall_elevator, scientist_idlewall, ickyjump_sci, haulscientist, c1a4_wounded_idle, c1a4_dying_speech, tentacle_grab, helicack, windive, scicrashidle, scicrash, onguard, seeya, rocketcrawl, portal, gluonshow, crouch, kneel, pepsiidle, pepsifall } enum {//SOUND TYPES use1, use2, idle, attacked, chase } stock EmitHostageSound ( id, soundType, Float:vol = 0.8 ) { switch ( soundType ) { case use1: emit_sound ( id, 2, USE1[ random_num ( 0, 19 ) ], vol, 0.8, 0, 110 ) case use2: emit_sound ( id, 2, USE2[ random_num ( 0, 6 ) ], vol, 0.8, 0, 110 ) case idle: emit_sound ( id, 2, IDLE[ random_num ( 0, 5 ) ], vol, 0.8, 0, 110 ) case attacked: emit_sound ( id, 2, ATTACKED[ random_num ( 0, 5 ) ], vol, 0.8, 0, 110 ) case chase: emit_sound ( id, 2, CHASE[ random_num ( 0, 1 ) ], vol, 0.8, 0, 110 ) } } public is_hostage_alive(id) { return (!entity_get_int(id,EV_INT_deadflag)); } public is_hostage_follow(id) { if(is_hostage(id)) return (00" ) register_event("TextMsg","TextMsg","b","2&#Game_radio", "4&#Fire_in_the_hole") register_cvar("mp_hostagehp","100")//Max is 32767//Min is -32767 register_event("ResetHUD","SetHostageHp","b") new x for ( x = get_maxplayers(); x <= entity_count ( ); x ++ ) { if ( is_hostage ( x ) ) { hostageid[hostagesfound] = x set_task ( random_float ( 30.0, 60.0 ), "followers", x + 200 ) hostagesfound++ set_entity_flags ( x, FL_SWIM, 1 ) } } if ( ! hostagesfound ){pause ( "ae" );} } /*************************** *Credit to AssKickR for the* *Concept of hostage health.* ***************************/ public SetHostageHp(id) { new Float:health=get_cvar_float("mp_hostagehp"),x if(health!=100.0){ if(floatabs(health)>32767.0){set_cvar_num("mp_hostagehp",100);} for(x=0;x<=hostagesfound;x++){ if(is_hostage(hostageid[x])) {entity_set_float(hostageid[x],EV_FL_health,health);} } } } /******************** *Created using the * *tracer fire concept* ********************/ public shoot ( id ) { new weapon = read_data ( 2 ), ammo = read_data ( 3 ) if ( ! lastshot[0][id] ){lastshot[0][id] = read_data ( 2 );} if ( weapon == lastshot[0][id] && ammo < lastshot[1][id] && ammo >= 0 ) { new Float:origin[2][3], intOrigin[3], Float:hostageorigin[3] entity_get_vector ( id, EV_VEC_origin, origin[0] ) new x, p get_user_origin ( id, intOrigin, 3 ) IVecFVec ( intOrigin, origin[1] ) for ( x = 0; x <= hostagesfound; x ++ ) { if ( is_hostage_alive ( hostageid[x] ) ) { entity_get_vector ( hostageid[x], EV_VEC_origin, hostageorigin ) if ( vector_distance ( origin[0], hostageorigin ) < 200 || vector_distance ( origin[1], hostageorigin ) < 200 ) { if ( cs_get_hostage_foll ( hostageid[x] ) ) { switch (entity_get_int (hostageid [ x ],EV_INT_sequence) ) { case walk: entity_set_int (hostageid [ x ],EV_INT_sequence,walk_scared) case run: entity_set_int (hostageid [ x ],EV_INT_sequence,random_num (run1, run2 )) } } else { p = entity_get_int ( hostageid [ x ], EV_INT_sequence ) if ( p >= crouch_idle && p <= crouch_idle4 ) { entity_set_int (hostageid [ x ],EV_INT_sequence,random_num(crouch_idle,crouch_idle4)) setuncrouch ( hostageid [ x ] ) } else{hostagecrouch ( hostageid [ x ] );} } EmitHostageSound ( hostageid[x], attacked ) } } } } lastshot[0][id] = weapon lastshot[1][id] = ammo } public setuncrouch ( id ) { if ( task_exists ( id ) ){remove_task ( id );} if ( is_hostage_alive ( id ) ){set_task ( random_float ( 4.0, 8.0 ), "uncrouch", id );} } public hostagecrouch ( id ) { if ( is_hostage_alive ( id ) ) { entity_set_int ( id, EV_INT_sequence, crouch ) set_task ( 0.5, "docrouchidle", id + 50 ) setuncrouch ( id ) } } public docrouchidle ( id ) { id -= 50 if ( is_hostage_alive ( id ) && is_hostage_crouched ( id ) ) { entity_set_int ( id, EV_INT_sequence, random_num ( crouch_idle, crouch_idle4 ) ) set_task ( random_float ( 4.0, 8.0 ), "docrouchidle", id + 50 ) } } public uncrouch ( id ) { if ( is_hostage_alive ( id ) ) { entity_set_int ( id, EV_INT_sequence, crouchstand ) set_task ( 0.5, "doidle", id ) if ( task_exists ( id + 50 ) ){remove_task ( id + 50 );} } } public doidle ( id ) { if ( ! is_hostage_follow ( id ) && is_hostage_alive ( id ) ) { entity_set_int ( id, EV_INT_sequence, random_num ( idle1, idle7 ) ) if(!random_num(0,4)){EmitHostageSound (id, idle, 0.7 );} set_task ( random_float ( 2.0, 4.0 ), "doidle", id ) } } public followers ( id ) { id -= 200 if ( is_hostage_follow ( id ) && is_hostage_alive ( id ) ) EmitHostageSound ( id, chase, 0.6 ) set_task ( random_float ( 30.0, 60.0 ), "followers", id + 200 ) } public plugin_precache ( ) { new x for ( x = 0; x <= 19; x++ ) precache_sound ( USE1[x] ) for ( x = 0; x <= 6; x++ ) precache_sound ( USE2[x] ) for ( x = 0; x <= 5; x++ ) precache_sound ( IDLE[x] ) for ( x = 0; x <= 5; x++ ) precache_sound ( ATTACKED[x] ) for ( x = 0; x <= 1; x++ ) precache_sound ( CHASE[x] ) } /****************************** *Credit to AssKickR for the * *Structure of grenade handlers* ******************************/ public TextMsg () { new name[32] read_data (3, name, 31) new id = get_user_index (name) set_task(0.5, "grenid", id+100) } public grenid ( id ) { id-=100 new entitylist[2][20] new string[32] new grenadeid = get_grenade(id) if(grenadeid > 0) { find_sphere_class( grenadeid, "monster_hostage", 500.0, entitylist[0], 19 ) find_sphere_class( grenadeid, "hostage_entity", 500.0, entitylist[1], 19 ) entity_get_string(grenadeid, EV_SZ_model, string, 31) if(equali(SMOKEGRENADE_MODEL, string)) { new x, y for ( y = 0; y <= 1; y++ ) { for ( x = 0; x <= 20; x++ ) { if ( entitylist[y][x] ) { if( is_hostage_alive ( entitylist[y][x] ) ){ entity_set_int ( entitylist[y][x],EV_INT_sequence, pondering2 ) EmitHostageSound ( entitylist[y][x], idle, 0.7 ) } } } } remove_task(id) set_task(4.0, "grenid", id+100) set_task(1.0, "doidle", id) } else if(equali(HEGRENADE_MODEL, string)) { new x, y for ( y = 0; y <= 1; y++ ) { for ( x = 0; x <= 20; x++ ) { if ( entitylist[y][x] ) { if( is_hostage_alive ( entitylist[y][x] ) ){ entity_set_int ( entitylist[y][x], EV_INT_sequence, random_num ( panic, fear2 ) ) EmitHostageSound(entitylist[y][x],attacked,0.5) } } } } set_task(2.0, "doidle", id) } else if(equali(FLASHBANG_MODEL, string)) { new x, y for ( y = 0; y <= 1; y++ ) { for ( x = 0; x <= 20; x++ ) { if ( entitylist[y][x] ) { if( is_hostage_alive ( entitylist[y][x] ) ){ entity_set_int ( entitylist[y][x], EV_INT_sequence, eye_wipe ) EmitHostageSound(entitylist[y][x],attacked,0.5) } } } } set_task(random_float(1.0, 3.0), "doidle", id) } } } /************* *Code from my* *Hostage Push* *************/ public pfn_touch ( ptr, ptd ) if ( get_user_team ( ptr ) == 1 && is_hostage ( ptd ) ) { new Float:origin[2][3] entity_get_vector ( ptr, EV_VEC_origin, origin[0] ) entity_get_vector ( ptd, EV_VEC_origin, origin[1] ) new x for ( x = 0; x <= 2; x++ ) { origin[1][x] -= origin[0][x] origin[1][x] *= 6 } entity_set_vector ( ptd, EV_VEC_velocity, origin[1] ) } public client_PreThink ( id ) { new button = get_user_button ( id ) & IN_USE new oldbutton = get_user_oldbutton ( id ) & IN_USE if( button && !oldbutton && get_user_team(id)==1 ){ new hostage[2] if ( get_user_aiming ( id, hostage[0], hostage[1] ) < 64.0 ) { if ( cs_get_hostage_foll ( hostage[0] ) == id ) { cs_set_hostage_foll ( hostage[0] ) } else {cs_set_hostage_foll ( hostage[0], id );} } } }