AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Sound in plugins (https://forums.alliedmods.net/showthread.php?t=45761)

Da_sk8rboy 10-10-2006 20:08

Sound in plugins
 
if i wanted to add a sound to my plugin what would i do?

Silencer123 10-11-2006 07:54

Re: Sound in plugins
 
http://www.amxmodx.org/funcwiki.php?go=func&id=282
Code:
public plugin_precache() {     precache_sound("myfolder/mysound.wav")     // = modfolder/sound/myfolder/mysound.wav     // Note that some Sounds are precached by the Game already }   public something(id) {     emit_sound(id,4,"myfolder/mysound.wav",0.7,0.8,0,100)     // Will play a Sound at the Origin of the Player with given ID. Use id 0 to play to everyone       // OR     client_cmd("play myfolder/mysound.wav")     // Plays a Sound that only this client can hear.     // You can use id 0 here, too, which is better than emit_sound with id 0, because this will have Mono effect. }

Rolnaaba 10-11-2006 10:21

Re: Sound in plugins
 
for .mp3:
Code:
new MySound[] = "sounds/mysounds.mp3"   public plugin_precache() {    precache_generic(MySound) }   public functoplaysound() {   client_cmd(0, "mp3 play %s", MySound) //index as 0 will play to all people on server }   //or if you func passes an ID you can do: public func_to_play_sound(id) {    client_cmd(id, "mp3 play %s", MySound) //this will play to id func collected }

Silencer123 10-11-2006 10:43

Re: Sound in plugins
 
public precache() does not exist, it is public plugin_precache().
Or you call precache() inside of plugin_precache(), which makes no sence.

Rolnaaba 10-11-2006 11:18

Re: Sound in plugins
 
dude called a typo geez,
fixed

Da_sk8rboy 10-11-2006 11:39

Re: Sound in plugins
 
Ok, so where would i put this in my script?
Also everytime i do the command for the plugin i scripted will the sound play? How would i do that?

is it possible, just say if when i do my command for my plugin,

EX: amx_adminheal <target> <amount healed>

and i wanted it to change the model of the target and (play the sound like you said above) when i use the command?

Also, final question in this post, how do you add a model to the plugin?

Rolnaaba 10-11-2006 11:57

Re: Sound in plugins
 
ok,
(1) sound part if u used
Code:
public plugin_init() {    register_clcmd("admin_heal", "heal_func") }
then in the heal_func u would put this sound.


(2) for model change probably use:
Code:
entity_set_model(id, "MODEL_NAME")

Rolnaaba 10-11-2006 11:59

Re: Sound in plugins
 
where "id" is your target of course so change as neccisary (I know I cant spell)

Da_sk8rboy 10-11-2006 12:04

Re: Sound in plugins
 
So
Quote:

public plugin_init() {
register_clcmd("admin_heal", "heal_func")
}
I would find that line in the script and just add :

Code:
public plugin_precache(){ precache_sound("myfolder/mysound.wav") // = modfolder/sound/myfolder/mysound.wav // Note that some Sounds are precached by the Game already} public something(id){ emit_sound(id,4,"myfolder/mysound.wav",0.7,0.8,0,100) // Will play a Sound at the Origin of the Player with given ID. Use id 0 to play to everyone // OR client_cmd("play myfolder/mysound.wav") // Plays a Sound that only this client can hear. // You can use id 0 here, too, which is better than emit_sound with id 0, because this will have Mono effect.}


and the Model part
Quote:

entity_set_model(id, "MODEL_NAME")
Where would i place the model at in the script?


Wel i will get back to you after school. :D Thnx.

Silencer123 10-11-2006 13:35

Re: Sound in plugins
 
Code:
entity_set_model(id,"models/myfolder/mymodel.mdl") // = modfolder/models/myfolder/mymodel.mdl // The entity_set_model Function starts browsing in the Modfolder, // not like emit_sound, which starts browsing in the sound Folder. // Also, do not forget to precache the Model in plugin_precache(): precache_model("models/myfolder/mymodel.mdl") // You can also precache Sprites with this Function.


All times are GMT -4. The time now is 04:59.

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