Raised This Month: $ Target: $400
 0% 

Loadingsound more than 1 Sound.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PepsiSexy
Member
Join Date: Aug 2013
Old 08-05-2013 , 18:16   Loadingsound more than 1 Sound.
Reply With Quote #1

Hello. Currently im using this simple loadingsound Plugin but i want that you can put in 3 Sounds and 1 is randomly playing if you connect. could someone do it for me please? please do it so that i can use .mp3 files. But .wav is also good. Mp3 or Wav? What is better, please use the better way. Thank you in advance
PHP Code:
#include <amxmodx>



public plugin_precache() {
    
precache_sound("misc/myfile.mp3")
    return 
PLUGIN_CONTINUE
}


public 
client_connect(id) {
    
client_cmd(id,"mp3 play sound/misc/myfile.mp3")
    return 
PLUGIN_CONTINUE
}



public 
plugin_init() {
    
register_plugin("Loadingsound","1.0","Lambo")
    return 
PLUGIN_CONTINUE

PepsiSexy is offline
PepsiSexy
Member
Join Date: Aug 2013
Old 08-05-2013 , 18:16   Re: Loadingsound more than 1 Sound.
Reply With Quote #2

Oh i think i post in wrong section. I didnt knew if this goes to Scirpting or Suggestion forums, im sorry.
PepsiSexy is offline
akcaliberg
Senior Member
Join Date: Nov 2011
Location: Istanbul
Old 08-05-2013 , 19:02   Re: Loadingsound more than 1 Sound.
Reply With Quote #3

First, you shouldn't precache mp3 files with precache_sound.

You must use precache_generic.

If you want to know how to do it, this is the right section. But if you want someone to do it for you, you must start the thread in the "Suggestions / Requests" section.

Code:
#include <amxmodx> new const mp3array[][] = {     "sound/misc/myfile.mp3",     "sound/misc/myfile2.mp3",     "sound/misc/myfile3.mp3" } public plugin_precache() {     for(new i; i<sizeof(mp3array); i++) {         precache_generic(mp3array[i])     } } public client_connect(id) {     client_cmd(id,"mp3 play ^"%s^"",mp3array[ random( sizeof(mp3array) ) ] ) } public plugin_init() {     register_plugin("Loadingsound","1.0","Lambo") }

Last edited by akcaliberg; 08-05-2013 at 19:31.
akcaliberg is offline
PepsiSexy
Member
Join Date: Aug 2013
Old 08-05-2013 , 19:13   Re: Loadingsound more than 1 Sound.
Reply With Quote #4

Thanks ill test it later, and btw the code on top works fine :s. 'Its not my Plugin but it just works with the 1 sound file. But still thanks for making me new plugin.
PepsiSexy is offline
akcaliberg
Senior Member
Join Date: Nov 2011
Location: Istanbul
Old 08-05-2013 , 19:33   Re: Loadingsound more than 1 Sound.
Reply With Quote #5

yes but precaching mp3 files with precache_sound is not recommended. It can give errors on console. precache_sound should be used only for wav files.

Last edited by akcaliberg; 08-05-2013 at 19:34.
akcaliberg is offline
PepsiSexy
Member
Join Date: Aug 2013
Old 08-05-2013 , 19:48   Re: Loadingsound more than 1 Sound.
Reply With Quote #6

Oh ye, it gives some. Thank you.
PepsiSexy is offline
UchihaSkills
Senior Member
Join Date: May 2013
Location: Germany
Old 08-17-2013 , 04:25   Re: Loadingsound more than 1 Sound.
Reply With Quote #7

akcaliberg your plugin will not work btw.
UchihaSkills is offline
Balck
Senior Member
Join Date: Apr 2013
Location: Kosova-Mitrovica
Old 08-17-2013 , 05:05   Re: Loadingsound more than 1 Sound.
Reply With Quote #8

Quote:
Originally Posted by PepsiSexy View Post
Hello. Currently im using this simple loadingsound Plugin but i want that you can put in 3 Sounds and 1 is randomly playing if you connect. could someone do it for me please? please do it so that i can use .mp3 files. But .wav is also good. Mp3 or Wav? What is better, please use the better way. Thank you in advance
PHP Code:
#include <amxmodx>



public plugin_precache() {
    
precache_sound("misc/myfile.mp3")
    return 
PLUGIN_CONTINUE
}


public 
client_connect(id) {
    
client_cmd(id,"mp3 play sound/misc/myfile.mp3")
    return 
PLUGIN_CONTINUE
}



public 
plugin_init() {
    
register_plugin("Loadingsound","1.0","Lambo")
    return 
PLUGIN_CONTINUE

it works 100 % i use this always.

PHP Code:
#include <amxmodx>
#define Maxsounds 6

new soundlist[Maxsounds][] = {"Half-Life01","Half-Life02","Half-Life04","Half-Life12","Half-Life13","Half-Life17"}

public 
plugin_init() {
    
register_plugin("Loading_Sound","1.0","AUTHOR")
    return 
PLUGIN_CONTINUE
}

public 
client_connect(id) {
    new 
i
    i 
random_num(0,Maxsounds-1)
    
client_cmd(id,"mp3 play media/%s",soundlist[i])
    return 
PLUGIN_CONTINUE

__________________
Balck is offline
PepsiSexy
Member
Join Date: Aug 2013
Old 08-17-2013 , 18:20   Re: Loadingsound more than 1 Sound.
Reply With Quote #9

Hey i must put 6 sounds i have on top? Like instead of Half Life 01 i put in "MySong01" and it must be .mp3 rigjht?
PepsiSexy is offline
Reply


Thread Tools
Display Modes

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 15:46.


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