// PsychoPerfect, Copyright 2002, PsychoGuard. No warranties. 
// Props to OLO for all the great Metamod plugins he developed. 
// 
// Award players who survived with 100 HP at round end by playing
// a litte sound for them.
//
// Cvars:
//   pd_perfect_sound     Sound to play. Default: misc/perfect. 

#include <amxmod>

public round_end() {
    new players[32];
    new player_count;
    new sound[64];

    get_cvar_string("pd_perfect_sound", sound, 64);
    get_players(players, player_count);

    for (new i = 0; i < player_count; i++) {
        if (get_user_health(players[i]) == 100) {
            client_cmd(players[i], "spk %s", sound);
        }
    }
    
    return PLUGIN_CONTINUE;
}

public plugin_init() {
    register_plugin("PsychoPerfect","0.4","PsychoGuard");

    register_event("SendAudio", "round_end", "a",
         "2=%!MRAD_terwin","2=%!MRAD_ctwin","2=%!MRAD_rounddraw");
    register_cvar("pd_perfect_sound", "misc/perfect");
        
    return PLUGIN_CONTINUE;
}
