Raised This Month: $32 Target: $400
 8% 

End map sound?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ndrs24
Junior Member
Join Date: Jan 2019
Old 01-01-2019 , 13:04   End map sound?
Reply With Quote #1

Use my server is connected to a database so it takes a few seconds longer than normal, and I ask if it happens to me. I want sound when I finish a map. please help me : 'u
I found this plugin that is what I need but the problem is that it is for the sourcemod
PHP Code:
/*
end_sound.sp

Description:
    Plays Music/sound at the end of the map.
        Has a cvar for the filename to play

Versions:
    1.2
        * Initial Release
    
*/


#include <sourcemod>
#include <sdktools>

#define PLUGIN_VERSION "1.2"

#pragma semicolon 1
#define MAX_FILE_LEN 255

public Plugin:myinfo 
{
    
name "Map End Music/Sound",
    
author "TechKnow",
    
description "Plays Music/sound at the end of the map.",
    
version PLUGIN_VERSION,
    
url "http://forums.alliedmods.net"
};

new 
Handle:cvarSoundName;
new 
String:soundFileName[MAX_FILE_LEN];


public 
OnPluginStart()
{
    
CreateConVar("sm_MapEnd_Sound_version"PLUGIN_VERSION"MapEnd_Sound_Version"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
    
cvarSoundName CreateConVar("sm_end_sound""mapend/end.mp3""The sound to play at the end of map");
    
HookEvent("round_end"EndEvent);

    
AutoExecConfig(true"end_sound");
    
OnMapStart();
}


public 
OnMapStart()
{
    
GetConVarString(cvarSoundNamesoundFileNameMAX_FILE_LEN);
    
decl String:buffer[MAX_FILE_LEN];
    
PrecacheSound(soundFileNametrue);
    
Format(bufferMAX_FILE_LEN"sound/%s"soundFileName);
    
AddFileToDownloadsTable(buffer);
}

public 
EndEvent(Handle:event,const String:name[],bool:dontBroadcast)
{
        new 
timeleft;
    
GetMapTimeLeft(timeleft);
    if (
timeleft <= 0)
        {
               for(new 
1<= GetMaxClients(); i++)
               if(
IsClientConnected(i) && !IsFakeClient(i))
           {
                    
decl String:buffer[255];
            
Format(buffersizeof(buffer), "play %s", (soundFileName), SNDLEVEL_RAIDSIREN);
                
ClientCommand((i), buffer);
               }
         }
}

public 
OnEventShutdown()
{
    
UnhookEvent("round_end"EndEvent);

Could I convert it to hlds? plis: 'v
Ndrs24 is offline
Old 01-01-2019, 13:31
Relaxing
This message has been deleted by Relaxing. Reason: Wrong, Incorrect.
Mr Misw
Member
Join Date: Aug 2018
Location: India
Old 01-02-2019 , 02:39   Re: End map sound?
Reply With Quote #2

AlliedModders Forum Index > AMX Mod X > Plugins > Suggestions / Requests
__________________
Facebook ==> Here
ScrewedUP's Website :
Main Website
My Ranking System [Skin Version] :
ScrewedUP Ranking System
My Ranking System [Without Skin Version] :
ScrewedUP Ranking System
Mr Misw is offline
raizo11
BANNED
Join Date: Dec 2013
Location: https://t.me/pump_upp
Old 01-02-2019 , 05:17   Re: End map sound?
Reply With Quote #3

Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN_VERSION "1.0"

new Array:g_aSounds,
    g_iArraySize

enum
{
    TYPE_INVALID = 0,
    TYPE_WAV,
    TYPE_MP3
}

public plugin_init()
{
    register_plugin("Map End Music", PLUGIN_VERSION, "OciXCrom")
    register_event("30", "PlayMusic", "a")
}

public plugin_precache()
{
    g_aSounds = ArrayCreate(128, 1)
    fileRead()
}

public plugin_end()
    ArrayDestroy(g_aSounds)

public PlayMusic()
{
    new szSound[128]
    ArrayGetString(g_aSounds, random(g_iArraySize), szSound, charsmax(szSound))
    
    new iType = get_sound_type(szSound)
    client_cmd(0, "%s%s", iType == TYPE_WAV ? "spk " : "mp3 play sound/", szSound)
}

fileRead()
{
    new szConfigsName[256], szFilename[256]
    get_configsdir(szConfigsName, charsmax(szConfigsName))
    formatex(szFilename, charsmax(szFilename), "%s/MapEndMusic.ini", szConfigsName)
    new iFilePointer = fopen(szFilename, "rt")
    
    if(iFilePointer)
    {
        new szData[128]
        
        while(!feof(iFilePointer))
        {
            fgets(iFilePointer, szData, charsmax(szData))
            trim(szData)
            
            switch(szData[0])
            {
                case EOS, ';': continue
                default:
                {
                    switch(get_sound_type(szData))
                    {
                        case TYPE_WAV, TYPE_MP3: precache_sound(szData)
                        case TYPE_INVALID: continue
                    }
                    
                    ArrayPushString(g_aSounds, szData)
                }
            }    
        }
        
        g_iArraySize = ArraySize(g_aSounds)
        fclose(iFilePointer)
    }
}

get_sound_type(szSound[])
{
    if(contain(szSound, ".wav") != -1)
        return TYPE_WAV
    else if(contain(szSound, ".mp3") != -1)
        return TYPE_MP3
        
    return TYPE_INVALID
}

Last edited by raizo11; 01-02-2019 at 05:35.
raizo11 is offline
Send a message via ICQ to raizo11 Send a message via AIM to raizo11 Send a message via MSN to raizo11 Send a message via Yahoo to raizo11 Send a message via Skype™ to raizo11
Old 01-02-2019, 05:27
raizo11
This message has been deleted by raizo11.
popilas
Senior Member
Join Date: Apr 2017
Location: lituanica
Old 01-02-2019 , 05:50   Re: End map sound?
Reply With Quote #4

Map End Music 1.0 OciXCrom running

need create cs in configs/ MapEndMusic.ini ??
And how write in MapEndMusic.ini

"sounds/13.mp3"

dont work

Last edited by popilas; 01-02-2019 at 06:23.
popilas is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-02-2019 , 08:26   Re: End map sound?
Reply With Quote #5

Quote:
Originally Posted by Mr Misw View Post
AlliedModders Forum Index > AMX Mod X > Plugins > Suggestions / Requests
Quote:
Originally Posted by Ndrs24 View Post
Use my server is connected to a database so it takes a few seconds longer than normal, and I ask if it happens to me. I want sound when I finish a map. please help me : 'u
I found this plugin that is what I need but the problem is that it is for the sourcemod

Could I convert it to hlds?
plis: 'v
Quote:
Originally Posted by popilas View Post
"sounds/13.mp3"

dont work
Of course it didn't. There's no such folder named "sounds". The base folder is named "sound".
Put only the filename and subfolders if found, not the "sound" folder itself.
Example: 13.mp3 (no brackets, no quotes, no anything - each sound goes on a new line in the file).
__________________

Last edited by OciXCrom; 01-02-2019 at 08:27.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
popilas
Senior Member
Join Date: Apr 2017
Location: lituanica
Old 01-02-2019 , 09:58   Re: End map sound?
Reply With Quote #6

worked.

maybe can u do like musicmenu and opend music choose song and play all players?

Last edited by popilas; 01-02-2019 at 10:16.
popilas is offline
Ndrs24
Junior Member
Join Date: Jan 2019
Old 01-02-2019 , 14:35   Re: End map sound?
Reply With Quote #7

I just want the music to sound at the moment of changing the map, because it connects to the database and the map change takes a few seconds, and to entertain users, I wanted to choose that plugin end map sound.
Ndrs24 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-02-2019 , 17:19   Re: End map sound?
Reply With Quote #8

You already got what you asked for.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Ndrs24
Junior Member
Join Date: Jan 2019
Old 01-03-2019 , 12:05   Re: End map sound?
Reply With Quote #9

Quote:
You already got what you asked for.
in console of the users it leaves:
Missing RIFF / WAVE chunks and apart that the sound does not sound.
Ndrs24 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-03-2019 , 14:34   Re: End map sound?
Reply With Quote #10

Because the sound is not properly converted for Counter-Strike. You can use this webiste and set the following attributes:
  • Bit resolution: 16 Bit
  • Sampling rate: 22050 Hz
  • Audio channels: mono
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
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 17:44.


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