AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Loadingsound more than 1 Sound. (https://forums.alliedmods.net/showthread.php?t=222715)

PepsiSexy 08-05-2013 18:16

Loadingsound more than 1 Sound.
 
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 08-05-2013 18:16

Re: Loadingsound more than 1 Sound.
 
Oh i think i post in wrong section. I didnt knew if this goes to Scirpting or Suggestion forums, im sorry.

akcaliberg 08-05-2013 19:02

Re: Loadingsound more than 1 Sound.
 
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") }

PepsiSexy 08-05-2013 19:13

Re: Loadingsound more than 1 Sound.
 
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.

akcaliberg 08-05-2013 19:33

Re: Loadingsound more than 1 Sound.
 
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.

PepsiSexy 08-05-2013 19:48

Re: Loadingsound more than 1 Sound.
 
Oh ye, it gives some. Thank you.

UchihaSkills 08-17-2013 04:25

Re: Loadingsound more than 1 Sound.
 
akcaliberg your plugin will not work btw.

Balck 08-17-2013 05:05

Re: Loadingsound more than 1 Sound.
 
Quote:

Originally Posted by PepsiSexy (Post 2006471)
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



PepsiSexy 08-17-2013 18:20

Re: Loadingsound more than 1 Sound.
 
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?


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

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