View Single Post
Author Message
KiloGames
Junior Member
Join Date: Nov 2008
Old 06-10-2009 , 15:34   Console error Emit Sound
Reply With Quote #1

L 06/10/2009 - 121:12: [SM] Native "EmitSound" reported: Client index 0 is invalid
L 06/10/2009 - 121:12: [SM] Displaying call stack trace for plugin "boomheadshot.smx":
L 06/10/2009 - 121:12: [SM] [0] Line 370, /home/groups/sourcemod/compiler-1.2/include/sdktools_sound.inc::EmitSoundToClient()
L 06/10/2009 - 121:12: [SM] [1] Line 36, /home/groups/sourcemod/upload_tmp/phpKfC5aj.sp::Event_PlayerDeath()

here is the source code to the plugin I think may be causing it because it's the only one with sound that i have recently added.
Code:
#include sourcemod
#include sdktools


#define Boom          "boomheadshot.wav"

public Plugin:myinfo = 
{
    name = "Boom Headshot!",
    author = "ThatGuy",
    description = "Plays a sound to snipers when they get headshots & victims of headshots",
    version = "1.1",
    url = "http://www.iam-clan.com"
}

public OnPluginStart() {
    HookEvent("player_death", Event_PlayerDeath)
    CreateConVar("BoomHSVersion", "1.1", "Boom Headshot Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY)
}

public OnMapStart() 
{
    PrecacheSound(Boom)
    decl String:file[64]
    Format(file, 63, "sound/%s", Boom);
    AddFileToDownloadsTable(file)
}

public Action:Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
        new attacker = GetClientOfUserId(GetEventInt(event, "attacker"))
        new victim = GetClientOfUserId(GetEventInt(event, "victim"))
    new String:weapon[32]
    GetEventString(event, "weapon", weapon, 32)
    if (GetEventInt(event, "customkill")) {
        if (StrContains(weapon,"sniperrifle") != -1) 
        { 
                
        EmitSoundToClient(attacker, Boom, SOUND_FROM_PLAYER, SNDCHAN_AUTO, SNDLEVEL_NORMAL)
        EmitSoundToClient(victim, Boom, SOUND_FROM_PLAYER, SNDCHAN_AUTO, SNDLEVEL_NORMAL)
    }
    }
    return Plugin_Continue
}
KiloGames is offline