Raised This Month: $ Target: $400
 0% 

[Check] Jailbreak Voice


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 01-09-2015 , 04:05   [Check] Jailbreak Voice
Reply With Quote #1

I think that this Code, crashes my server

I want to know if this code is fine, I did test and sometimes DEAD T Team can speak.

Code:
#pragma semicolon 1

#define OVER_8000 8001

new gI_MaxClients;

new gH_LRCanSpeak;

public plugin_init()
{
    gI_MaxClients = get_maxplayers();
    
    gH_LRCanSpeak = register_cvar("amx_jailbreak_lr_can_speak", "1", 0, 1.0);
    
    register_forward(FM_Voice_SetClientListening, "OnClientSpeak");
}
Code:
public OnClientSpeak(receiver, sender, bool:listen)
{
    if(!IsValidClient(receiver) || !IsValidClient(sender))
    {
        return FMRES_IGNORED;
    }
    
    if(get_user_flags(sender) & ADMIN_LEVEL_F)
    {
        return FMRES_IGNORED;
    }
    
    if(cs_get_user_team(sender) == CS_TEAM_CT && is_user_alive(sender))
    {
        return FMRES_IGNORED;
    }
    
    if(get_pcvar_num(gH_LRCanSpeak) && is_user_alive(sender) && cs_get_user_team(sender) == CS_TEAM_T)
    {
        static count;
        count = 0;
        
        static i;
        
        for(i = 1; i <= gI_MaxClients; i++)
        {
            if(IsValidClient(i, true) && cs_get_user_team(i) == CS_TEAM_T)
            {
                count++;
            }
        }
        
        if(count == 1)
        {
            return FMRES_IGNORED;
        }
    }
    
    engfunc(EngFunc_SetClientListening, receiver, sender, false);
    
    return FMRES_SUPERCEDE;
}

stock bool:IsValidClient(client, bool:bAlive = false)
{
    if(client >= 1 && client <= gI_MaxClients && is_user_connected(client) && (bAlive == false || is_user_alive(client)))
    {
        return true;
    }
    
    return false;
}

Last edited by Fuck For Fun; 01-09-2015 at 04:06.
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
yan1255
Senior Member
Join Date: Jul 2011
Old 01-09-2015 , 12:27   Re: [Check] Jailbreak Voice
Reply With Quote #2

I don't know why your's crashes the server but here's something I Just built.
Its not tested and supposed to block dead prisoners voice.
PHP Code:
#include < amxmodx >
#include < fakemeta >

#define TALK_ACCESS    ADMIN_LEVEL_F

enum _:Teams
{
    
FM_TEAM_UNASSIGNED,
    
FM_TEAM_T,
    
FM_TEAM_CT,
    
FM_TEAM_SPECTATOR
};

new 
gH_LRCanSpeak;

public 
plugin_init()
{
    
register_plugin"JailBreak Voice Manager""1.0""Rejack" );
    
    
register_forwardFM_Voice_SetClientListening"FwdVoiceSetClientListening" );
    
    
gH_LRCanSpeak    register_cvar"amx_jailbreak_lr_can_speak""1" );
}    

public 
FwdVoiceSetClientListeningRecSenderbool:bListen 
{
    if ( !
is_user_connectedSender ) || !is_user_connectedRec ) )
        return 
1;
    
    if ( 
get_user_flagsSender ) & TALK_ACCESS )
        return 
1;
    
    if ( 
fm_get_user_teamSender ) == FM_TEAM_CT && is_user_aliveSender ) )
        return 
1;
    
    if ( 
get_pcvar_numgH_LRCanSpeak ) && TeamCount() == && is_user_aliveSender ) && fm_get_user_teamSender ) == FM_TEAM_T )
        return 
1;
    
    
engfuncEngFunc_SetClientListeningRecSender);
    
    return 
FMRES_SUPERCEDE;
}

stock TeamCount()
{
    static 
Players32 ], iNum;
    
    
get_playersPlayersiNum"aceh""TERRORIST" );
    
    return 
iNum;
}

stock fm_get_user_team( const index )
    return 
get_pdata_intindex114 ); 
__________________
yan1255 is offline
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 01-09-2015 , 12:39   Re: [Check] Jailbreak Voice
Reply With Quote #3

Quote:
Originally Posted by yan1255 View Post
I don't know why your's crashes the server but here's something I Just built.
Its not tested and supposed to block dead prisoners voice.
PHP Code:
#include < amxmodx >
#include < fakemeta >

#define TALK_ACCESS    ADMIN_LEVEL_F

enum _:Teams
{
    
FM_TEAM_UNASSIGNED,
    
FM_TEAM_T,
    
FM_TEAM_CT,
    
FM_TEAM_SPECTATOR
};

new 
gH_LRCanSpeak;

public 
plugin_init()
{
    
register_plugin"JailBreak Voice Manager""1.0""Rejack" );
    
    
register_forwardFM_Voice_SetClientListening"FwdVoiceSetClientListening" );
    
    
gH_LRCanSpeak    register_cvar"amx_jailbreak_lr_can_speak""1" );
}    

public 
FwdVoiceSetClientListeningRecSenderbool:bListen 
{
    if ( !
is_user_connectedSender ) || !is_user_connectedRec ) )
        return 
1;
    
    if ( 
get_user_flagsSender ) & TALK_ACCESS )
        return 
1;
    
    if ( 
fm_get_user_teamSender ) == FM_TEAM_CT && is_user_aliveSender ) )
        return 
1;
    
    if ( 
get_pcvar_numgH_LRCanSpeak ) && TeamCount() == && is_user_aliveSender ) && fm_get_user_teamSender ) == FM_TEAM_T )
        return 
1;
    
    
engfuncEngFunc_SetClientListeningRecSender);
    
    return 
FMRES_SUPERCEDE;
}

stock TeamCount()
{
    static 
Players32 ], iNum;
    
    
get_playersPlayersiNum"aceh""TERRORIST" );
    
    return 
iNum;
}

stock fm_get_user_team( const index )
    return 
get_pdata_intindex114 ); 
I think, once you have given me this code, and i use it and it dropped (crashed) my server

So I tried to build one myself, but Dead Prisoner Talking.

Check your code and tell me if working
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
yan1255
Senior Member
Join Date: Jul 2011
Old 01-09-2015 , 12:45   Re: [Check] Jailbreak Voice
Reply With Quote #4

Quote:
Originally Posted by Fuck For Fun View Post
I think, once you have given me this code, and i use it and it dropped (crashed) my server

So I tried to build one myself, but Dead Prisoner Talking.

Check your code and tell me if working
I don't have a server to check it on.
This is a new code that I just made just now try it if you want.
__________________
yan1255 is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 01-09-2015 , 12:55   Re: [Check] Jailbreak Voice
Reply With Quote #5

if ( !is_user_connected( Sender ) || !is_user_connected( Rec ) )
return 1;

if ( get_user_flags( Sender ) & TALK_ACCESS )
return 1;

I am not sure what's the define for 1 in fakemeta, but i am sure that's wrong. If 1 = allowed to talk, you are allowing disconnected senders/receivers to speak/listen
__________________
Jhob94 is offline
yan1255
Senior Member
Join Date: Jul 2011
Old 01-09-2015 , 12:58   Re: [Check] Jailbreak Voice
Reply With Quote #6

Quote:
Originally Posted by jhob94 View Post
if ( !is_user_connected( sender ) || !is_user_connected( rec ) )
return 1;

if ( get_user_flags( sender ) & talk_access )
return 1;

i am not sure what's the define for 1 in fakemeta, but i am sure that's wrong. If 1 = allowed to talk, you are allowing disconnected senders/receivers to speak/listen
1 = frmes_ignored;
__________________
yan1255 is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 01-09-2015 , 13:01   Re: [Check] Jailbreak Voice
Reply With Quote #7

I am not in my computer so i cant check. If 1 = frmes_ignored, then you must do this:

if(!is_user_connected(sender) || !is_user_connected(receiver))
return FMRES_SUPERCEDE
__________________
Jhob94 is offline
Reply



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 15:29.


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