AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   why not playing? (https://forums.alliedmods.net/showthread.php?t=48159)

Rolnaaba 12-06-2006 08:57

why not playing?
 
This is not playing sounds...why?
Code:
#include <amxmodx> #include <fakemeta> #define TREE "models/c14-cristmastree.mdl" new rep_Planted[] = "sound/JingleBell.wav"; new rep_Defused[] = "sound/Laugh.wav"; new game_Planted[5][] = {       "weapons/c4_beep1.wav",     "weapons/c4_beep2.wav",     "weapons/c4_beep3.wav",     "weapons/c4_beep4.wav",     "weapons/c4_beep5.wav" }; new game_Defused[] = "weapons/c4_disarm.wav"; public plugin_init() {     register_plugin("C4 Tree","0.10","Avalanche");     register_forward(FM_SetModel,"fw_setmodel");     //sounds added by Rolnaaba     register_forward(FM_EmitSound, "fw_replace_sound"); } public plugin_precache() {     precache_model(TREE);     precache_sound("sound/JingleBell.wav")     precache_sound("sound/Laugh.wav") } public fw_setmodel(ent,model[]) {     if(equali(model,"models/w_c4.mdl"))     {         engfunc(EngFunc_SetModel,ent,TREE);         return FMRES_SUPERCEDE;     }     return FMRES_IGNORED; } //sounds added by Rolnaaba public fw_replace_sound(ent, channel, const sound[], Float:volume,Float:attenuation, flags, pitch) {     if(equali(sound, game_Defused)) {         engfunc(EngFunc_EmitSound,ent,channel,rep_Defused,volume,attenuation,flags,pitch);         return FMRES_SUPERCEDE;     }     else {         new listsize = sizeof game_Planted;                 for(new i; i<listsize; i++) {             if(equali(sound, game_Planted[i])) {                 engfunc(EngFunc_EmitSound,ent,channel,rep_Planted,volume,attenuation,flags,pitch);                 return FMRES_SUPERCEDE;             }         }     }     return FMRES_IGNORED; }


Sounds:
JingleBell.wav
Laugh.wav

The Specialist 12-06-2006 13:29

Re: why not playing?
 
ummmm, it looks like you didnt define or pass the functiona ny of the proper sound varaibles. There in the paramter , but you ddidnt pass it volume , or pitch , any thing .

VEN 12-06-2006 13:49

Re: why not playing?
 
Don't put sound/ in precache_sound

Rolnaaba 12-06-2006 15:55

Re: why not playing?
 
ty VEN
Code:
#include <amxmodx> #include <fakemeta> #define TREE "models/c14-cristmastree.mdl" new rep_Planted[] = "sound/JingleBell.wav"; new rep_Defused[] = "sound/Laugh.wav"; new game_Planted[5][] = {       "weapons/c4_beep1.wav",     "weapons/c4_beep2.wav",     "weapons/c4_beep3.wav",     "weapons/c4_beep4.wav",     "weapons/c4_beep5.wav" }; new game_Defused[] = "weapons/c4_disarm.wav"; public plugin_init() {     register_plugin("C4 Tree","0.10","Avalanche");     register_forward(FM_SetModel,"fw_setmodel");     //sounds added by Rolnaaba     register_forward(FM_EmitSound, "fw_replace_sound"); } public plugin_precache() {     precache_model(TREE);     precache_sound("JingleBell.wav")     precache_sound("Laugh.wav") } public fw_setmodel(ent,model[]) {     if(equali(model,"models/w_c4.mdl"))     {         engfunc(EngFunc_SetModel,ent,TREE);         return FMRES_SUPERCEDE;     }     return FMRES_IGNORED; } //sounds added by Rolnaaba public fw_replace_sound(ent, channel, const sound[], Float:volume,Float:attenuation, flags, pitch) {     if(equali(sound, game_Defused)) {         engfunc(EngFunc_EmitSound,ent,channel,rep_Defused,volume,attenuation,flags,pitch);         return FMRES_SUPERCEDE;     }     else {         new listsize = sizeof game_Planted;                 for(new i; i<listsize; i++) {             if(equali(sound, game_Planted[i])) {                 engfunc(EngFunc_EmitSound,ent,channel,rep_Planted,volume,attenuation,flags,pitch);                 return FMRES_SUPERCEDE;             }         }     }     return FMRES_IGNORED; }
teoretically this should work correct?

dutchmeat 12-06-2006 16:06

Re: why not playing?
 
test,test,test,test :)

stupok 12-06-2006 19:30

Re: why not playing?
 
Should it be:
Code:

new rep_Planted[] = "sound/JingleBell.wav"
Or:
Code:

new rep_Planted[] = "JingleBell.wav"

Rolnaaba 12-07-2006 10:45

Re: why not playing?
 
the first since to play the sound it goes into sound file i think


All times are GMT -4. The time now is 06:57.

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