AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   Death Sounds (https://forums.alliedmods.net/showthread.php?t=153374)

drekes 03-22-2011 12:09

Death Sounds
 
3 Attachment(s)
Death Sounds by Drekes

Description:

Plays a sound when you die.
Uses a .ini file for sounds.

Credits:
Code:

Alarm: Requested plugin http://forums.alliedmods.net/showthread.php?t=153363
Seta00: Helped me with CellArray problem.

Changelog:
Code:

v1.0.0: Created plugin
v1.0.1: Added auto-created config file.
v1.0.2:    Changed config file format to more user-friendly method.

Notes:
Code:

When a sound doesn't exist, it will be printed in the logs.

When you run the plugin for the first time, a death_sounds.ini file is created in the configs folder,
Add the sounds you want there.

Servers running this plugin.

Alarm 03-22-2011 12:33

Re: Death Sounds
 
Nice !
Tnx For Helping after me request

drekes 03-22-2011 13:39

Re: Death Sounds
 
No problem :)

burc ugur 03-22-2011 14:45

Re: Death Sounds
 
Where shall we put Sounds File ?? :D

/cstrike/sounds ?
/cstrike/sounds/misc ?
/cstrike/sounds/loading ?

Please Answer:D

Alarm 03-22-2011 16:41

Re: Death Sounds
 
drekes i have the songs , and i added this lines to the death_sounds.ini in the configs folder:
misc/Mandala.wav
misc/Lonely.wav
misc/GoAndSay.wav

when i connecting to the server it is downloading the songs to the folder but in game it is not working , i or no boddy heres it ...
some thing to fix in this plugin ?

drekes 03-22-2011 16:45

Re: Death Sounds
 
@burc_ugur:
Doesn't matter where you put them, just make sure the paths in the file are right.

@alarm:
I've tested it and it worked fine, but i'll take another look at it.

EDIT: Try typing 'spk "sound/misc/Mandala.wav" in your console and see if the sound plays.
If not, the sounds probably are encoded wrong for cs.

bboygrun 03-22-2011 17:26

Re: Death Sounds
 
You should create the .ini file and add example in, then upload it on your thread for people who have a little problem, it will help them.

drekes 03-22-2011 17:33

Re: Death Sounds
 
What's not to understand ?
Just put the path of the sound in the file, that's it.

bboygrun 03-22-2011 18:35

Re: Death Sounds
 
For you and me that's very easy, but for new guys who are trying to do their first AmxModX server, it can be a problem.

drekes 03-22-2011 19:31

Re: Death Sounds
 
Okay, i'll do it

EDIT: Updated

elitetaco 03-22-2011 23:51

Re: Death Sounds
 
Great Job Drekes! This is very Fun to have in servers :D

fysiks 03-23-2011 00:04

Re: Death Sounds
 
I'm confused. Why would you do this:

PHP Code:

    switch(szSound[strlen(szSound) - 1])
    {
        case 
'v''V':
            
client_cmd(iVictim"spk ^"sound/%s^""szSound);
            
        case 
'3':
            
client_cmd(iVictim"mp3 play ^"%s^""szSound);
    } 

and

Code:

; sound/misc/example.mp3^n^n; Be sure to write sound/ when the file is a .mp3^n
Why not just add the "sound/" in the mp3 situation just like you do in the wave situation? Then, you don't need to worry about putting wavs and mp3s in the .ini file differently.

EDIT: Just realized it was because of the precache_generic() BUT you could just add "sound/" when precaching mp3s. This would make it more "user friendly".

drekes 03-23-2011 00:16

Re: Death Sounds
 
Quote:

Originally Posted by fysiks (Post 1437948)
EDIT: Just realized it was because of the precache_generic() BUT you could just add "sound/" when precaching mp3s. This would make it more "user friendly".

will do.

EDIT: Done

ConnorMcLeod 03-23-2011 02:46

Re: Death Sounds
 
You musn't (don't have to ? w/e) pass 'sound/' in wav play cmd.

Arkshine 03-23-2011 08:08

Re: Death Sounds
 
You should not register the event if no sounds were found from the parsing.

Also, I would suggest to format directly the sound with spk or mp3 play at parsing time before saving in the array, so you can use directly something like that :

Code:
public EventDeathMsg() {     client_cmd( read_data( 2 ), "%a", ArrayGetStringHandle( g_aSounds, g_iTotalSounds == 1 ? 0 : random( g_iTotalSounds ) ) ); }

drekes 03-23-2011 09:30

Re: Death Sounds
 
Quote:

Originally Posted by ConnorMcLeod (Post 1437970)
You musn't (don't have to ? w/e) pass 'sound/' in wav play cmd.

I've tried with and without /sound for .wav files, and it seems to work with both, so what is the difference ?

Quote:

Originally Posted by Arkshine (Post 1438039)
You should not register the event if no sounds were found from the parsing.

Also, I would suggest to format directly the sound with spk or mp3 play at parsing time before saving in the array, so you can use directly something like that :

Code:
public EventDeathMsg() { client_cmd( read_data( 2 ), "%a", ArrayGetStringHandle( g_aSounds, g_iTotalSounds == 1 ? 0 : random( g_iTotalSounds ) ) ); }

I'll update it once i have received an answer from Connor for the question above.

GuTo 03-23-2011 10:03

Re: Death Sounds
 
cool man

dark_style 03-23-2011 11:03

Re: Death Sounds
 
Also you should use formatex where applicable. :)

drekes 03-23-2011 11:27

Re: Death Sounds
 
Quote:

Originally Posted by dark_style (Post 1438113)
Also you should use formatex where applicable. :)

I know but it isn't applicable in this code.
This is the only format() i use:
PHP Code:

format(szDatacharsmax(szData), "sound/%s"szData); 

As you can see, i use szData[] as output, but also use szData as the 4th param, which isn't possible with formatex()

dark_style 03-23-2011 11:47

Re: Death Sounds
 
Sorry, my fault. The idea of the plugin is good, but you should add more features.

drekes 03-23-2011 12:03

Re: Death Sounds
 
Like what ?

ConnorMcLeod 03-23-2011 12:21

Re: Death Sounds
 
Quote:

Originally Posted by drekes (Post 1438079)
I've tried with and without /sound for .wav files, and it seems to work with both, so what is the difference ?

Was talking about sound/ folder that you don't have to put in wav sound path, in bot precache and play sound.
About extension, it is the way you check file type so you would have better to let it, anyway i think you don't need it in speak cmd but you need it in precache, so if it's easier for the code, let it everywhere would be a good solution.

drekes 03-23-2011 12:36

Re: Death Sounds
 
Now i'm kinda confused.
I do add sound/ in front of the .wav files, but when i precache them i use
precache_sound(szData[6]);
So it doesn't contain sound/ when it's precached.
And for the spk command, it works with and without sound/ in front of it, so i don't think it really matters.
I will update the code with Arkshine's suggestion.

d1mQa 03-10-2024 04:43

Re: Death Sounds
 
Hello. What needs to be done so that the sound of death can be heard by everyone on the server?


All times are GMT -4. The time now is 13:52.

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