AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   some engfunc help (https://forums.alliedmods.net/showthread.php?t=47944)

Rolnaaba 11-30-2006 14:05

some engfunc help
 
this code:
Code:
#include <amxmodx> #include <fakemeta> new rep_Planted[] = "sounds/JingleBell.mp3" new rep_Defused[] = "sounds/Laugh.mp3" 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_forward(FM_EmitSound, "replace_sound"); } public replace_sound(ent, channel, const sound[]) {         if(equali(sound, game_Defused)) {         engfunc(EngFunc_EmitSound,ent,rep_Defused);         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,rep_Planted);                 return FMRES_SUPERCEDE;             }         }     }     return FMRES_IGNORED; }

crashes the client with this error message:
Code:


EMIT_SOUND:VOLUME=0

why lol and how to fix if possible plz :)

VEN 11-30-2006 14:13

Re: some engfunc help
 
You should learn the basics first, read the fakemeta_const.inc.

EmitSound should be called with the prototype:
Quote:

(edict_t *entity, int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch)

P34nut 11-30-2006 14:13

Re: some engfunc help
 
Code:
engfunc(EngFunc_EmitSound, index, channel, sample[], Float:vol, Float:att,flags, pitch) // this should work AFAIK

edit: Hello VEN:)

Rolnaaba 12-01-2006 10:59

Re: some engfunc help
 
omg I am so retarded I am sry, what are max/min values of Float:vol?

[EDIT] think this will work...
Code:
#include <amxmodx> #include <fakemeta> new rep_Planted[] = "sounds/JingleBell.mp3" new rep_Defused[] = "sounds/Laugh.mp3" 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_forward(FM_EmitSound, "fw_replace_sound"); } 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 }

Rolnaaba 12-01-2006 13:15

Re: some engfunc help
 
they said it not working still...not sure whats wrong

P34nut 12-01-2006 13:27

Re: some engfunc help
 
is weapons/c4_disarm.wav emited?

Rolnaaba 12-01-2006 13:45

Re: some engfunc help
 
pretty sure thats the default sound...

P34nut 12-01-2006 14:12

Re: some engfunc help
 
you cant emit mp3 sound as far as i know

VEN 12-01-2006 14:28

Re: some engfunc help
 
Good catch, P34nut

Rolnaaba 12-01-2006 19:05

Re: some engfunc help
 
ahh so I how would I play an mp3 sound from that ent (bomb) that I am trying to do?


All times are GMT -4. The time now is 11:12.

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