AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   |CSGO| Custom Join-Message-Sound by Steamid (https://forums.alliedmods.net/showthread.php?t=308519)

ateszhun95 06-23-2018 13:20

|CSGO| Custom Join-Message-Sound by Steamid
 
Hi,

Is there any plugin, with i can set custom join sound and messages idenitfied by the palyers steamid? In one plugin, unlimited players.

Thanks in advance! :)

Best regards and have a good evening/day :))

LenHard 06-23-2018 17:32

Re: |CSGO| Custom Join-Message-Sound by Steamid
 
1 Attachment(s)
PHP Code:

#include <sourcemod>
#include <sdktools>
#pragma semicolon 1
#pragma newdecls required

KeyValues gK_JoinInfo;

public 
void OnMapStart()
{
    
gK_JoinInfo = new KeyValues("joininfo");

    
char[] sFile = new char[PLATFORM_MAX_PATH];
    
BuildPath(Path_SMsFilePLATFORM_MAX_PATH"configs/joininfo.cfg");
    
gK_JoinInfo.ImportFromFile(sFile);
}

public 
void OnMapEnd() {
    
delete gK_JoinInfo;
}

public 
void OnClientPostAdminCheck(int client)
{
    if (!
IsFakeClient(client))
    {
        
char[] sSteamId = new char[MAX_NAME_LENGTH];
        
GetClientAuthId(clientAuthId_Steam2sSteamIdMAX_NAME_LENGTH);
     
        if (
gK_JoinInfo.JumpToKey(sSteamIdfalse))
        {
            
char[] sFormat = new char[PLATFORM_MAX_PATH];
            
gK_JoinInfo.GetString("sound"sFormatPLATFORM_MAX_PATH);
            
            if (
sFormat[0] != '\0'
            {
                if (
sFormat[0] != '*')
                    
Format(sFormatPLATFORM_MAX_PATH"*%s"sFormat);    
                
EmitSoundToAll(sFormat);
            }
            
            
gK_JoinInfo.GetString("message"sFormatPLATFORM_MAX_PATH);
            
            if (
sFormat[0] != '\0'
            {
                
FilterColors(sFormat);
                
PrintToChatAll(" %s"sFormat);
            }
        }
        
gK_JoinInfo.Rewind();
    }
}

void FilterColors(char[] sString)
{    
    
ReplaceString(sStringPLATFORM_MAX_PATH"{red}""\x02"false);
    
ReplaceString(sStringPLATFORM_MAX_PATH"{green}""\x04"false);
    
ReplaceString(sStringPLATFORM_MAX_PATH"{olive}""\x06"false);
    
ReplaceString(sStringPLATFORM_MAX_PATH"{purple}""\x03"false);
    
ReplaceString(sStringPLATFORM_MAX_PATH"{yellow}""\x09"false);
    
ReplaceString(sStringPLATFORM_MAX_PATH"{blue}""\x0B"false);
    
ReplaceString(sStringPLATFORM_MAX_PATH"{pink}""\x0E"false);
    
ReplaceString(sStringPLATFORM_MAX_PATH"{grey}""\x08"false);
    
ReplaceString(sStringPLATFORM_MAX_PATH"{lightred}""\x07"false);
    
ReplaceString(sStringPLATFORM_MAX_PATH"{white}""\x01"false);
    
ReplaceString(sStringPLATFORM_MAX_PATH"{orange}""\x10"false);


Create a file in configs folder called "joininfo.cfg" and in it add
Code:

"joininfo"
{
        "STEAM_ID"
        {
                "sound"                "*blah/file.mp3"
                "message"                "Testing"
        }
}

Try it out (Untested)

Note: Precache + add the sounds to downloads table before adding them into the file.

ateszhun95 06-24-2018 08:31

Re: |CSGO| Custom Join-Message-Sound by Steamid
 
Thank you so much for your time :)
Unfortunately not working. No sound, no chat msg. Tested with different steamids. Sound file is good,
44 hz and 320 kbps.

LenHard 06-25-2018 04:51

Re: |CSGO| Custom Join-Message-Sound by Steamid
 
Quote:

Originally Posted by ateszhun95 (Post 2599057)
Thank you so much for your time :)
Unfortunately not working. No sound, no chat msg. Tested with different steamids. Sound file is good,
44 hz and 320 kbps.

I tested it and It works. Just make sure the steam id you put is correct and for the sound make sure you don't add "sound/" in the path and be sure to precache the sound prior to adding it.

Azet 10-24-2018 17:15

Re: |CSGO| Custom Join-Message-Sound by Steamid
 
How do I precache sound? With sm_downloader plugin?

HvG Community 10-25-2018 22:12

Re: |CSGO| Custom Join-Message-Sound by Steamid
 
Quote:

Originally Posted by Azet (Post 2621146)
How do I precache sound? With sm_downloader plugin?

If you know you are going to use just this file then you can also add it right away to downloadtable when compiling plugin.
Code:

public OnMapStart()
{
        AddFileToDownloadsTable("sound/hello.wav");
        AddFileToDownloadsTable("sound/hello2.wav");
}

If not then use
https://forums.alliedmods.net/showthread.php?p=2482443


All times are GMT -4. The time now is 15:37.

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