Code: Select all
public FwdCmdStartas(client, uc_handle, seed){if( !(1 <= client <= g_iMaxPlayers) || !is_user_alive(client) || g_being_healed[client] || get_user_team(client) == 1 ) return FMRES_IGNORED; new button = get_uc(uc_handle, UC_Buttons);new oldbuttons = pev(client, pev_oldbuttons);static target, body;new Float:dist = get_user_aiming(client, target, body);static Float: Time;Time = get_gametime(); new model[33];pev(client, pev_viewmodel2, model, 32); if ( !g_being_healed[client] ){ if( (button & IN_USE) && !(oldbuttons & IN_USE) && dist < HEALING_DISTANCE ) { if( (1 <= target <= g_iMaxPlayers) && is_user_alive(target) && !g_being_healed[target] && !g_healing[target] && Time - MEDIC_HEAL_COOLDOWN > g_LastHeal[client] && get_user_team(client) == get_user_team(target) ) { static name[32] ; get_user_name(target, name, charsmax(name)); static name2[32] ; get_user_name(client, name2, charsmax(name2)); client_print(client, print_center, "Your target: %s", name); client_print(target, print_center, "Your healer: %s", name2); set_view(target, CAMERA_3RDPERSON) set_view(client, CAMERA_3RDPERSON) emit_sound(target, CHAN_ITEM, g_medkit_heal, 1.0, ATTN_NORM, 0, PITCH_NORM); g_healing_teammate[client] = true g_healing[client] = true; g_target[client] = target; g_being_healed[target] = true; ManageBar(client, HEAL_TIME); ManageBar(target, HEAL_TIME); set_task(float(HEAL_TIME), "TaskFinishHeal", client); g_LastHeal[client] = Time } } else if( g_healing[client] && !(button & IN_USE) ) { new targeti = g_target[client]; g_healing[client] = false; g_being_healed[targeti] = false; ManageBar(client, BAR_REMOVE); ManageBar(targeti, BAR_REMOVE); remove_task(client); } if( (button & IN_USE) && !(oldbuttons & IN_USE) ) { if(!g_being_healed[client] && !g_healing[client] && Time - MEDIC_HEAL_COOLDOWN > g_LastHeal[client] ) { emit_sound(client, CHAN_ITEM, g_medkit_heal, 1.0, ATTN_NORM, 0, PITCH_NORM); g_healing_teammate[client] = false; g_healing[client] = true; if ( !(button & IN_JUMP) && !(button & IN_DUCK) && !(button & IN_FORWARD) && !(button & IN_BACK) && !(button & IN_MOVELEFT) && !(button & IN_MOVERIGHT) && !(button & IN_ATTACK) && !(button & IN_ATTACK2)) { client_print(client, print_center, "Healing Self"); set_view(client, CAMERA_3RDPERSON) } ManageBar(client, HEAL_TIME); set_task(float(HEAL_TIME), "TaskFinishHeal2", client); g_LastHeal[client] = Time }}else if ( g_healing[client] && !(button & IN_USE) ){ g_healing[client] = false; ManageBar(client, BAR_REMOVE); remove_task(client);}if ( g_healing[client] ){ if ( g_healing_teammate[client] && dist > HEALING_DISTANCE ) { new targeti = g_target[client]; g_healing[client] = false; g_being_healed[targeti] = false; ManageBar(client, BAR_REMOVE); ManageBar(targeti, BAR_REMOVE); remove_task(client); } if ( !g_healing_teammate[client] ) { if ( (button & IN_JUMP) || (button & IN_DUCK) || (button & IN_FORWARD) || (button & IN_BACK) || (button & IN_MOVELEFT) || (button & IN_MOVERIGHT) || (button & IN_ATTACK) || (button & IN_ATTACK2)) { g_healing[client] = false; ManageBar(client, BAR_REMOVE); remove_task(client); }}}} return FMRES_IGNORED;} public TaskFinishHeal(client){if( pev_valid(g_ent[client]) ){remove_entity( g_ent[client] );g_ent[client] = 0;} new target = g_target[client]; new health;health = get_user_health(target)static name[32] ; get_user_name(client, name, charsmax(name)); if ( health < 100){set_user_health(target, 100);set_view(target, CAMERA_NONE) } if( g_human[target] && SurvivorClass[target] == 0){emit_sound(target, CHAN_ITEM, bill_healed[random_num(0,sizeof bill_healed-1)], 1.0, ATTN_NORM, 0, PITCH_NORM);} if( g_human[target] && SurvivorClass[target] == 1){emit_sound(target, CHAN_ITEM, louis_healed[random_num(0,sizeof louis_healed-1)], 1.0, ATTN_NORM, 0, PITCH_NORM);} if( g_human[target] && SurvivorClass[target] == 2){emit_sound(target, CHAN_ITEM, zoey_healed[random_num(0,sizeof zoey_healed-1)], 1.0, ATTN_NORM, 0, PITCH_NORM);} if( g_human[target] && SurvivorClass[target] == 3){emit_sound(target, CHAN_ITEM, francis_healed[random_num(0,sizeof francis_healed-1)], 1.0, ATTN_NORM, 0, PITCH_NORM);} ManageBar(client, BAR_REMOVE);ManageBar(target, BAR_REMOVE); g_healing[client] = false; g_being_healed[target] = false;} public TaskFinishHeal2(client){if( !(1 <= client <= g_iMaxPlayers) ) return PLUGIN_CONTINUE; new health;health = get_user_health(client) if ( health < 100){set_view(client, CAMERA_NONE) set_user_health(client, 100);} if( g_human[client] && SurvivorClass[client] == 0){emit_sound(client, CHAN_ITEM, bill_healed[random_num(0,sizeof bill_healed-1)], 1.0, ATTN_NORM, 0, PITCH_NORM);set_view(client, CAMERA_NONE) } if( g_human[client] && SurvivorClass[client] == 1){emit_sound(client, CHAN_ITEM, louis_healed[random_num(0,sizeof louis_healed-1)], 1.0, ATTN_NORM, 0, PITCH_NORM);set_view(client, CAMERA_NONE) } if( g_human[client] && SurvivorClass[client] == 2){emit_sound(client, CHAN_ITEM, zoey_healed[random_num(0,sizeof zoey_healed-1)], 1.0, ATTN_NORM, 0, PITCH_NORM);set_view(client, CAMERA_NONE) } if( g_human[client] && SurvivorClass[client] == 3){emit_sound(client, CHAN_ITEM, francis_healed[random_num(0,sizeof francis_healed-1)], 1.0, ATTN_NORM, 0, PITCH_NORM);set_view(client, CAMERA_NONE) } ManageBar(client, BAR_REMOVE); g_healing[client] = false; return PLUGIN_CONTINUE;} ResetItems(client){if( !(1 <= client <= g_iMaxPlayers) ) return; if( pev_valid(g_ent[client]) ){engfunc(EngFunc_RemoveEntity, g_ent[client]);g_ent[client] = 0;} if( g_being_healed[client] ){new target = g_target[client]; g_being_healed[target] = false; g_healing[client] = false; ManageBar(client, BAR_REMOVE);ManageBar(target, BAR_REMOVE);} if( g_healing[client] ){new target = g_target[client]; g_healing[client] = false; g_being_healed[target] = false; ManageBar(client, BAR_REMOVE);ManageBar(target, BAR_REMOVE);}}