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

[CS:GO] Server Player Join Sound


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Doctros
AlliedModders Donor
Join Date: Apr 2011
Location: Chicago ILL. USA
Old 05-28-2017 , 18:52   [CS:GO] Server Player Join Sound
Reply With Quote #1

Hello All,

I'm interested in a plugin for my CS:GO server that plays a sound wav/mp3 file when a player joins a team CT or T that all clients in game can hear so they know new player has joined the game.

All the other announce plugins I have seen only play the sound to the player that is connecting and not everyone playing in the server. like this one.

Thanks
Doctros is offline
shanapu
Veteran Member
Join Date: Apr 2015
Location: .de
Old 05-31-2017 , 15:55   Re: [CS:GO] Server Player Join Sound
Reply With Quote #2

hi,
please don't cross post on forum.
I answerd to you in main plugin thread.
https://forums.alliedmods.net/showth...50#post2525050
__________________
coding & free software
shanapu is offline
Divin12
Senior Member
Join Date: Nov 2011
Old 06-01-2017 , 03:15   Re: [CS:GO] Server Player Join Sound
Reply With Quote #3

PHP Code:
#pragma semicolon 1

#include <sourcemod>
#include <emitsoundany>

public Plugin:myinfo 
{
    
name    "Sound Connect",
    
author    "Divin",
    
version    "1.0"
};

new 
Handle:g_Array;
new 
g_Sounds_Count;
new 
g_CurrPos = -1;
new 
bool:g_CanListen[MAXPLAYERS 1] = {true, ...};

public 
OnPluginStart()
{
    new 
Handle:dir OpenDirectory("sound/div");
    if (
dir == INVALID_HANDLE)
        
SetFailState("Fail \"sound/div\"");

    
g_Array CreateArray(150);
    
decl String:SoundName[150], FileType:type;
    while (
ReadDirEntry(dirSoundName150type))
    {
        if (
type == FileType_File && StrContains(SoundName".ztmp") == -1)
        {
            if (
StrContains(SoundName".mp3") > || StrContains(SoundName".wav") > 0)
            {
                
Format(SoundName150"div/%s"SoundName);
                
PushArrayString(g_ArraySoundName);
            }
        }
    }
    
CloseHandle(dir);

    if ((
g_Sounds_Count GetArraySize(g_Array)) < 1)
        
SetFailState("В \"sound/div\" :D");

    
    
RegConsoleCmd("sm_stopmusic"sm_rem_cmd);
}

public 
OnMapStart()
{
    
decl String:SoundName[150];
    for (new 
0g_Sounds_Counti++)
    {
        
GetArrayString(g_ArrayiSoundName150); PrecacheSoundAny(SoundNametrue);
        
Format(SoundName150"sound/%s"SoundName); AddFileToDownloadsTable(SoundName);
    }
}

public 
OnClientPostAdminCheck(client)
{
    
    
CreateTimerGetRandomFloat 2.52.7 ), joinclient);
    if (++
g_CurrPos >= g_Sounds_Countg_CurrPos 0;
    
decl String:SoundName[150]; GetArrayString(g_Arrayg_CurrPosSoundName150);
    for (new 
1<= MaxClientsi++)
    {
        if (
g_CanListen[i] && IsClientInGame(i) && !IsFakeClient(i))
        {    
            
EmitSoundToClientAny(iSoundName);                    
        }
    }
}
}

public 
Action join(Handletimerany:client)
{
    
char name[64];
    
GetClientName(clientname[client], sizeof(name));
    
PrintToChatAll("★\x04%s \x07joined the server",name[client]);
}

public 
Action:sm_rem_cmd(clientargs)
{
    if (
client <= MaxClients)
        
PrintToChat(client, (g_CanListen[client] = !g_CanListen[client]) ? "\x04OFF" "ON");

    return 
Plugin_Handled;
}

public 
OnClientPutInServer(client)
{
    
g_CanListen[client] = true;

Download music foler: http://www30.zippyshare.com/v/AeM6LDlX/file.html
Compile plugin.
Drop div folder in sounds.
Restart server.
__________________

Last edited by Divin12; 06-01-2017 at 12:09.
Divin12 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 06:05.


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