First of all, sorry for spaming this section but i'm trying to learn more about keyvalues because they are OP.
PHP Code:
public void OnClientPutInServer(int Client)
{
if(HasJoinSounds(Client))
{
CreateTimer(GetRandomFloat(20.0, 30.0), PlayJoinSound, Client);
}
}
bool HasJoinSounds(int Client)
{
char szAuthID[32];
GetClientAuthId(Client, AuthId_Steam3, szAuthID, sizeof(szAuthID))
/* Format : U:1:430133270 */
char Configfile[1024];
BuildPath(Path_SM, Configfile, 1024, "configs/tz_plugins/JoinSounds.txt");
if(!FileExists(Configfile))
SetFailState("Can not find config file \"%s\"!", Configfile);
KeyValues hKV = CreateKeyValues("JoinSound");
hKV.ImportFromFile(Configfile);
if(hKV.GetString(szAuthID, g_szSoundPath[Client], sizeof(g_szSoundPath)))
return true;
hKV.Rewind();
delete hKV;
return false;
}
public Action PlayJoinSound(Handle pTimer, any Data)
{
int Client = GetClientOfUserId(Data);
EmitSoundToAll(g_szSoundPath[Client]);
}
This sould be my config :
PHP Code:
"JoinSound"
{
"U:1:430133270" "joinsounds/laugh.mp3"
}
I don't really know why. I have an plugin that auto download any texture, model, sound and precache it.
Because I dont precache my sound in the source code is the main reason why my song it's not played
__________________