AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Source Servers (SRCDS) (https://forums.alliedmods.net/forumdisplay.php?f=130)
-   -   Console error Emit Sound (https://forums.alliedmods.net/showthread.php?t=94386)

KiloGames 06-10-2009 15:34

Console error Emit Sound
 
L 06/10/2009 - 12:31:12: [SM] Native "EmitSound" reported: Client index 0 is invalid
L 06/10/2009 - 12:31:12: [SM] Displaying call stack trace for plugin "boomheadshot.smx":
L 06/10/2009 - 12:31:12: [SM] [0] Line 370, /home/groups/sourcemod/compiler-1.2/include/sdktools_sound.inc::EmitSoundToClient()
L 06/10/2009 - 12:31: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
}


DontWannaName 06-11-2009 17:46

Re: Console error Emit Sound
 
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.


All times are GMT -4. The time now is 01:46.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.