event load
{
    // Load the keygroup "nade_sounds" (assumes your script is called "nade_sounds")

    es_xkeygroupload nade_sounds |nade_sounds

    // Set variables for use later

    es_xset rand_sound 0
    es_xset sound_path 0
    es_xset temp_key 0

    // Make the sounds downloadable

    es_foreachkey temp_key in nade_sounds "es_xdoblock nade_sounds/make_downloadable"
    
    es_xmsg #multi #greenNade_sounds #defaultLoaded
}

block make_downloadable
{
    // Get the sound name from the keygroup

    es_keygetvalue rand_sound nade_sounds server_var(temp_key) soundpath

    // Format the sound path

    es_xformatv sound_path "sound/%1" rand_sound

    // Officially make the sounds downloadble

    es downloadable server_var(sound_path)
}

event es_map_start
{
    // Make the sounds downloadable

    es_foreachkey temp_key in nade_sounds "es_xdoblock nade_sounds/make_downloadable"
}

event player_death
{
    if (event_var(weapon) == "hegrenade") do
    {
        // Choose a random number between 1 and 2 (since we currently have 2 sounds)

        es_xrand rand_sound 1 4
        
        // We now use the random number from above to select 1 sound or the other from the keygroup
        // Translated:
        //     * es_keygetvalue sound_path nade_sounds 1 soundpath
        //          or...
        //     * es_keygetvalue sound_path nade_sounds 2 soundpath
        // PseudoCode:
        //     Get the value "soundpath" from key #1 or key #2 and store it in the "sound_path" variable

        es_keygetvalue sound_path nade_sounds server_var(rand_sound) soundpath

        // Play the sound to the player/players
        es_emitsound player event_var(attacker) server_var(sound_path) 1.0 0.0
        es_centertell event_var(attacker) Nice Nade! lol
        es_centertell event_var(userid) Nice Catch! lol
	es_msg #multi #green event_var(es_attackername) #lightgreennice #greennade #lightgreenlol #green! #lightgreen!
    }
}

event unload
{
    es_xkeygroupdelete nade_sounds

    es_xmsg #multi #greenNade_sounds #defaultUnLoaded
}


///
///  XE_ManUp was here :)
///BTW ty