AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Silent shooting - command (https://forums.alliedmods.net/showthread.php?t=204910)

F0RCE 01-04-2013 15:48

Silent shooting - command
 
Hello, I found a really nice plugin.
This video show how it works : http://www.youtube.com/watch?v=-YrRx...layer_embedded

It is making the sound of guns silent (You can hear only Your sounds)
And here is my request. I can't make it to work with command.
I want play to choose with command /silent or /mute.

PHP Code:

#pragma semicolon 0
#include <amxmisc>
#include <fakemeta>

new iEvents[] = {20,12,18,17,23,24,15,10,11,22,13,21,14,16,27,28,4,6,3,7,8,9,2,1,5}

public 
plugin_init() {
    
register_plugin("Blokujemy dzwieki""1.0""DarkGL")
    
register_forward(FM_PlaybackEvent"fwPlaybackEvent");
}

public 
fwPlaybackEventflagsideventindex,FloatdelayFloatorigin[3], Floatangles[3], Floatfparam1Floatfparam2iparam1iparam2bparam1bparam2) {
    new 
bool:bFind false;
    
    for(new 
0;sizeof iEvents;i++){    
        if(
eventindex == iEvents[i]){
            
bFind true;
            break;
        }
    }
    
    if(!
bFind)    return FMRES_IGNORED;
    
    return 
FMRES_SUPERCEDE;


Thx for help!

AngeIII 01-04-2013 15:54

Re: Silent shooting - command
 
Try this:
PHP Code:

#pragma semicolon 0
#include <amxmisc>
#include <fakemeta>

new iEvents[] = {20,12,18,17,23,24,15,10,11,22,13,21,14,16,27,28,4,6,3,7,8,9,2,1,5}
new 
bool:g_silent[33];
public 
plugin_init() {
    
register_plugin("Blokujemy dzwieki""1.0""DarkGL")
    
register_forward(FM_PlaybackEvent"fwPlaybackEvent");
    
register_clcmd("say /silent","cmd_silent");
}

public 
fwPlaybackEventflagsideventindex,FloatdelayFloat:  origin[3], Floatangles[3], Floatfparam1Floatfparam2iparam1,  iparam2bparam1bparam2) {
    if(!
g_silent[id]) return FMRES_IGNORED;
    new 
bool:bFind false;
    
    for(new 
0;sizeof iEvents;i++){    
        if(
eventindex == iEvents[i]){
            
bFind true;
            break;
        }
    }
    
    if(!
bFind)    return FMRES_IGNORED;
    
    return 
FMRES_SUPERCEDE;
}
public 
client_connect(id)
{
   
g_silent[id]=false;
}
public 
cmd_silent(id)
{
   
g_silent[id]=!g_silent[id];
   
client_print(id,print_chat,"You have set SOUND:%s",g_silent[id]?"[off]":"[on]");
   return 
PLUGIN_HANDLED;



F0RCE 01-04-2013 16:14

Re: Silent shooting - command
 
Nothing happen after typing that command.
Nothing show up in chat, sounds aren't muted

//It was not a bump it was another question...
If It's not possible, why should I wait 14days just to know that? not logical ;x

AngeIII 01-05-2013 10:40

Re: Silent shooting - command
 
i have tested and decided that when you write /silent for you no changes. BUT for others they will not hear you.

and also I miss "]"..
g_silent[id]=!g_silent[id];

F0RCE 01-05-2013 12:52

Re: Silent shooting - command
 
But, isn't it possible to make it this way :

1 # I write /silent
2 # I can hear myself shooting, but not the others

AngeIII 01-05-2013 14:18

Re: Silent shooting - command
 
i think no, with this public fwPlaybackEvent( flags, id, eventindex,Float: delay, Float: origin[3], Float: angles[3], Float: fparam1, Float: fparam2, iparam1, iparam2, bparam1, bparam2)
forward impossible
you can try with orpheu module, to hook events from one players which is sended to others.
for example if you will find this forward with this params:
PHP Code:

event(sender,receiver)
{
  if(
g_silent[receiver]) return FM_SUPERCEDE;
  return 
FM_IGNORED;




All times are GMT -4. The time now is 13:39.

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