Monthly Target: $400 Donations: $250

Console error Emit Sound

Post New Thread Reply   
Thread Tools Display Modes
Author Message
Junior Member
Join Date: Nov 2008
Old 06-10-2009 , 16: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/
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.
#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 = ""

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

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

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)
    return Plugin_Continue
KiloGames is offline
Veteran Member
Join Date: Jun 2007
Location: VALVe Land, WA
Old 06-11-2009 , 18:46   Re: Console error Emit Sound
Reply With Quote #2

The error says that its trying to play the sound to the server, add a check to make sure its not a fakeclient I believe, or something similar. When I say server I dont mean everyone on the server, I mean the actual console.

DontWannaName is offline

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -4. The time now is 18:39.

Powered by vBulletin®
Copyright ©2000 - 2015, vBulletin Solutions, Inc.
Theme made by Freecode