AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   no death sound? (https://forums.alliedmods.net/showthread.php?t=16939)

algee2005 08-23-2005 05:59

no death sound?
 
well, im trying to make a plugin and i need to avoid the death sound only when a specific person dies, is this possible?

http://forums.alliedmods.net/showthread.php?t=16684

XxAvalanchexX 08-23-2005 16:20

Code:
 #include <amxmodx>  #include <fakemeta>  public plugin_init() {     register_forward(FM_EmitSound,"fw_emitsound",0);  }  public fw_emitsound(ent,channel,sample[],Float:volume,Float:atten,flags,pitch) {     if(!is_user_connected(ent)) {         return FMRES_IGNORED;     }     // additional if statement here to see     // if this user's death should NOT be blocked     if(something) {         return FMRES_IGNORED;     }     if(containi(sample,"player/die") != -1 || containi(sample,"player/death") != -1) {         return FMRES_SUPERCEDE;     }     return FMRES_IGNORED;  }

algee2005 08-24-2005 07:29

thx alot for your help :)

but it didnt work for me, i must do something wrong :(

this is my attempt:

Code:
new bool:stealth[32] public plugin_init()    {    register_forward(FM_EmitSound,"forward_EmitSound",0);    } public client_putinserver(id)    {    if(is_user_admin(id)) stealth[id]=true    } public forward_EmitSound(ent,channel,sample[],Float:volume,Float:atten,flags,pitch)    {    if(!is_user_connected(ent))       {       return FMRES_IGNORED;       }    if(stealth[ent])       {       return FMRES_IGNORED;       }    if(containi(sample,"player/die") != -1 || containi(sample,"player/death") != -1)       {       return FMRES_SUPERCEDE;       }    return FMRES_IGNORED;    }

something like this should work, no?
that should make admins cause no death sound when they die...

but i can still hear death sound when i die :(
maybe you can look into this again and tell me what im doing wrong?

XxAvalanchexX 08-24-2005 14:54

a) Your variable should be size 33, not 32

b)
Code:
   if(stealth[ent])       {       return FMRES_IGNORED;       }
That means if they have stealth then it will play the sound anyway, change the if to "!stealth[ent]"

algee2005 08-25-2005 05:55

then i must have got the comment wrong there..

Code:
if(!is_user_connected(ent))    {    return FMRES_IGNORED;    } // additional if statement here to see // if this user's death should NOT be blocked if(something)    {    return FMRES_IGNORED;    }

so, it would also play the sound when the user is not connected anymore?




but -- i thought 32 is just the definition of size - the players id would go from 0 to 31, so having 32 possible players, no?

XxAvalanchexX 08-25-2005 15:50

Yes, you got the comment wrong, I said if their death should NOT be blocked, if stealth[id] is true it SHOULD be blocked, so instead you have to check for !stealth[id].

Also, players go from 1 to 32, an array of size 32 has a max index number of 31.

algee2005 08-25-2005 18:09

ok, i will do the ! thingy.

Quote:

Originally Posted by XxAvalanchexX
Also, players go from 1 to 32, an array of size 32 has a max index number of 31.

:shock: wow, never knew that, i will have to go and fix alot of stuff then... :roll: thx for telling me :)

EDIT: oooh :o forgot the karma up :? fixed now :)


All times are GMT -4. The time now is 14:33.

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