Raised This Month: $51 Target: $400
 12% 

One sound works, one doesn't , why?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Austin
Senior Member
Join Date: Oct 2005
Old 08-14-2021 , 02:31   One sound works, one doesn't , why?
Reply With Quote #1

I have the following plugin for CSGO

This doesn't work, but!
In the middle of a round on a map it started working.
Ever since I can't get it to work.
My best guess is during the round where it started working the condition to play the t_death01 wav
was met and the engine played it and this somehow cached up the wav which caused my plugin to start working?

Can anyone suggest how to make this simple plugin work 100% of the time?


PHP Code:
#include <sourcemod>
#include <sdkhooks>
#include <sdktools>
#pragma semicolon 1
 
public void OnPluginStart()
{
  
HookEvent("player_death",        Event_PlayerDeath,        EventHookMode_Post);
}

public 
Action Event_PlayerDeath(Event event, const char[] namebool dontBroadcast)
{
    if (
event.GetBool("headshot"))
    {
        
PrintToChatAll("HEADSHOT DEATH!");
        
EmitSoundToAll("player/vo/balkan/t_death01.wav"GetClientOfUserId(event.GetInt("attacker")));
    }
    return 
Plugin_Continue;
}

void OnMapStart()
{
    
PrecacheSound("player/vo/balkan/t_death01.wav"true);


Last edited by Austin; 08-14-2021 at 03:15.
Austin is offline
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Location: The Netherlands
Old 08-14-2021 , 05:42   Re: One sound works, one doesn't , why?
Reply With Quote #2

OnMapStart needs to be public.
__________________
Advertisements | REST in Pawn - HTTP client for JSON REST APIs
Please do not PM me with questions. Post in the plugin thread.
DJ Tsunami is offline
Austin
Senior Member
Join Date: Oct 2005
Old 08-14-2021 , 15:07   Re: One sound works, one doesn't , why?
Reply With Quote #3

Quote:
Originally Posted by DJ Tsunami View Post
OnMapStart needs to be public.
I was wondering why the compiler was giving me this....
ABS_CSGO_Test.sp(184) : warning 203: symbol is never used: "OnMapStart"

I changed it to public and the warning goes away and it works!
WOW!

That was All it was......

The interesting thing is...
OnMapStart with void was not getting called so the sound was not getting precached so that explains EmitSoundToClient() not working,

but this death sound is used by CSGO.
About once in 100 deaths CSGO will play this sound.
After CSGO plays this sound my EmitSoundToClient() starts to work.

SO CSGO maybe? must see that it needs to cache that sound before it plays it and then caches it which causes my plugin to work?

How do I mark this post as Solved?

THANK YOU!

Last edited by Austin; 08-14-2021 at 15:08.
Austin is offline
Reply



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 07:53.


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