Raised This Month: $ Target: $400
 0% 

Sound in plugins


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Da_sk8rboy
Veteran Member
Join Date: Jul 2006
Old 10-10-2006 , 20:08   Sound in plugins
Reply With Quote #1

if i wanted to add a sound to my plugin what would i do?
__________________
i stop around here and there.
Da_sk8rboy is offline
Silencer123
Veteran Member
Join Date: Jul 2006
Old 10-11-2006 , 07:54   Re: Sound in plugins
Reply With Quote #2

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. }
__________________
EAT YOUR VEGGIES
Silencer123 is offline
Rolnaaba
Veteran Member
Join Date: May 2006
Old 10-11-2006 , 10:21   Re: Sound in plugins
Reply With Quote #3

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 }
__________________
DO NOT PM me about avp mod.

Last edited by Rolnaaba; 10-11-2006 at 11:18.
Rolnaaba is offline
Silencer123
Veteran Member
Join Date: Jul 2006
Old 10-11-2006 , 10:43   Re: Sound in plugins
Reply With Quote #4

public precache() does not exist, it is public plugin_precache().
Or you call precache() inside of plugin_precache(), which makes no sence.
__________________
EAT YOUR VEGGIES
Silencer123 is offline
Rolnaaba
Veteran Member
Join Date: May 2006
Old 10-11-2006 , 11:18   Re: Sound in plugins
Reply With Quote #5

dude called a typo geez,
fixed
__________________
DO NOT PM me about avp mod.
Rolnaaba is offline
Da_sk8rboy
Veteran Member
Join Date: Jul 2006
Old 10-11-2006 , 11:39   Re: Sound in plugins
Reply With Quote #6

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?
__________________
i stop around here and there.
Da_sk8rboy is offline
Rolnaaba
Veteran Member
Join Date: May 2006
Old 10-11-2006 , 11:57   Re: Sound in plugins
Reply With Quote #7

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")
__________________
DO NOT PM me about avp mod.
Rolnaaba is offline
Rolnaaba
Veteran Member
Join Date: May 2006
Old 10-11-2006 , 11:59   Re: Sound in plugins
Reply With Quote #8

where "id" is your target of course so change as neccisary (I know I cant spell)
__________________
DO NOT PM me about avp mod.
Rolnaaba is offline
Da_sk8rboy
Veteran Member
Join Date: Jul 2006
Old 10-11-2006 , 12:04   Re: Sound in plugins
Reply With Quote #9

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. Thnx.
__________________
i stop around here and there.

Last edited by Da_sk8rboy; 10-11-2006 at 12:07.
Da_sk8rboy is offline
Silencer123
Veteran Member
Join Date: Jul 2006
Old 10-11-2006 , 13:35   Re: Sound in plugins
Reply With Quote #10

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.
__________________
EAT YOUR VEGGIES
Silencer123 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 04:59.


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