Raised This Month: $165 Target: $400
 41% 

[REQ] Gag player,


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
martvonk
Junior Member
Join Date: Jul 2012
Old 04-17-2014 , 18:15   [REQ] Gag player,
Reply With Quote #1

Hello, Please help me in the gag player

When i want to gag a player he gagged all player

Please help fast !


Code:
public CmdGagPlayer( const id, const iLevel, const iCid ) {
    if( !cmd_access( id, iLevel, iCid, 2 ) ) {
        console_print( id, "Flags: a - Chat | b - Team Chat | c - Voice communications" );
        
        return PLUGIN_HANDLED;
    }
    
    new szArg[ 32 ];
    read_argv( 1, szArg, 31 );
    
    new iPlayer = cmd_target( id, szArg, CMDTARGET_OBEY_IMMUNITY | CMDTARGET_NO_BOTS );
    
    if( !iPlayer )
        return PLUGIN_HANDLED;
    
    new szName[ 20 ];
    get_user_name( iPlayer, szName, 19 );
    
    if( TrieKeyExists( g_tArrayPos, g_szAuthid[ iPlayer ] ) ) {
        console_print( id, "User ^"%s^" is already gagged!", szName );
        
        return PLUGIN_HANDLED;
    }
    
    new szFlags[ 4 ], Float:flGagTime;
    read_argv( 2, szArg, 31 );
    
    if( !szArg[ 0 ] ) { // No time entered
        flGagTime = DEFAULT_TIME;
        
        formatex( szFlags, 3, "abc" );
    } else {
        if( is_str_num( szArg ) ) { // Seconds entered
            flGagTime = floatstr( szArg );
            
            if( flGagTime > 86400.0 )
                flGagTime = 86400.0;
        } else {
            console_print( id, "The value must be in seconds!" );
            
            return PLUGIN_HANDLED;
        }
        
        read_argv( 3, szArg, 31 );
        
        if( !szArg[ 0 ] ) // No flag entered
            formatex( szFlags, 3, "abc" );
        else
            formatex( szFlags, 3, szArg );
    }
    
    new iFlags = read_flags( szFlags );
    
    new data[ GagData ];
    data[ GAG_START ] = _:get_gametime( );
    data[ GAG_TIME ]  = _:flGagTime;
    data[ GAG_FLAGS ] = iFlags;
    copy( data[ GAG_AUTHID ], 19, g_szAuthid[ iPlayer ] );
    
    TrieSetCell( g_tArrayPos, g_szAuthid[ iPlayer ], g_iGagged );
    ArrayPushArray( g_aGagData, data );
    
    new szFrom[ 64 ];
    
    if( iFlags & GAG_CHAT )
        formatex( szFrom, 63, "say" );
    
    if( iFlags & GAG_TEAMSAY ) {
        if( !szFrom[ 0 ] )
            formatex( szFrom, 63, "say_team" );
        else
            format( szFrom, 63, "%s / say_team", szFrom );
    }
    
    if( iFlags & GAG_VOICE ) {
        set_speak( iPlayer, SPEAK_MUTED );
        
        if( !szFrom[ 0 ] )
            formatex( szFrom, 63, "voicecomm" );
        else
            format( szFrom, 63, "%s / voicecomm", szFrom );
    }
    
    g_iGagged++;
    
    new Float:flGametime = get_gametime( ), Float:flNextThink;
    flNextThink = entity_get_float( g_iThinker, EV_FL_nextthink );
    
    if( !flNextThink || flNextThink > ( flGametime + flGagTime ) )
        entity_set_float( g_iThinker, EV_FL_nextthink, flGametime + flGagTime );
    
    new szInfo[ 32 ], szAdmin[ 20 ], iTime = floatround( flGagTime ), iMinutes = iTime / 60, iSeconds = iTime % 

60;
    get_user_name( id, szAdmin, 19 );
    
    if( !iMinutes )
        formatex( szInfo, 31, "%i second%s", iSeconds, iSeconds == 1 ? "" : "s" );
    else
        formatex( szInfo, 31, "%i minute%s", iMinutes, iMinutes == 1 ? "" : "s" );
    
    show_activity( id, szAdmin, "Has gagged %s from speaking for %s! (%s)", szName, szInfo, szFrom );
    
    console_print( id, "You have gagged ^"%s^" (%s) !", szName, szFrom );
    
    log_amx( "Gag: ^"%s<%s>^" has gagged ^"%s<%s>^" for %i minutes. (%s)", szAdmin, g_szAuthid[ id ], szName, 

g_szAuthid[ iPlayer ], floatround( flGagTime / 60 ), szFrom );
    
    return PLUGIN_HANDLED;
}

public CmdUnGagPlayer( const id, const iLevel, const iCid ) {
    if( !cmd_access( id, iLevel, iCid, 2 ) )
        return PLUGIN_HANDLED;
    
    new szArg[ 32 ];
    read_argv( 1, szArg, 31 );
    
    if( equali( szArg, "@all" ) ) {
        if( !g_iGagged ) {
            console_print( id, "No gagged players!" );
            
            return PLUGIN_HANDLED;
        }
        
        while( g_iGagged ) DeleteGag( 0 ); // Excellent by Exolent
        
        if( entity_get_float( g_iThinker, EV_FL_nextthink ) > 0.0 )
            entity_set_float( g_iThinker, EV_FL_nextthink, 0.0 );
        
        console_print( id, "You have ungagged all players!" );
        
        new szAdmin[ 32 ];
        get_user_name( id, szAdmin, 31 );
        
        show_activity( id, szAdmin, "Has ungagged all players." );
        
        log_amx( "UnGag: ^"%s<%s>^" has ungagged all players.", szAdmin, g_szAuthid[ id ] );
        
        return PLUGIN_HANDLED;
    }
    
    new iPlayer = cmd_target( id, szArg, CMDTARGET_OBEY_IMMUNITY | CMDTARGET_NO_BOTS );
    
    if( !iPlayer )
        return PLUGIN_HANDLED;
    
    new szName[ 32 ];
    get_user_name( iPlayer, szName, 31 );
    
    new iArrayPos;
    if( !TrieGetCell( g_tArrayPos, g_szAuthid[ iPlayer ], iArrayPos ) ) {
        console_print( id, "User ^"%s^" is not gagged!", szName );
        
        return PLUGIN_HANDLED;
    }
    
    DeleteGag( iArrayPos );
    
    new szAdmin[ 32 ];
    get_user_name( id, szAdmin, 31 );
    
    show_activity( id, szAdmin, "Has ungagged %s.", szName );
    
    console_print( id, "You have ungagged ^"%s^" !", szName );
    
    log_amx( "UnGag: ^"%s<%s>^" has ungagged ^"%s<%s>^"", szAdmin, g_szAuthid[ id ], szName, g_szAuthid[ 

iPlayer ] );
    
    return PLUGIN_HANDLED;
}

public CmdGagMenu( const id, const iLevel, const iCid ) {
    if( !cmd_access( id, iLevel, iCid, 1 ) )
        return PLUGIN_HANDLED;
    
    g_iMenuOption[ id ] = 0;
    arrayset( g_iMenuPlayers[ id ], 0, 32 );
    
    DisplayGagMenu( id, g_iMenuPosition[ id ] = 0 );
    
    return PLUGIN_HANDLED;
}

public ActionGagMenu( const id, const iKey ) {
    switch( iKey ) {
        case 7: {
            ++g_iMenuOption[ id ];
            g_iMenuOption[ id ] %= ArraySize( g_aGagTimes );
            
            DisplayGagMenu( id, g_iMenuPosition[ id ] );
        }
        case 8: DisplayGagMenu( id, ++g_iMenuPosition[ id ] );
        case 9: DisplayGagMenu( id, --g_iMenuPosition[ id ] );
        default: {
            new iPlayer = g_iMenuPlayers[ id ][ g_iMenuPosition[ id ] * 7 + iKey ];
            
            if( TrieKeyExists( g_tArrayPos, g_szAuthid[ iPlayer ] ) )
                client_cmd( id, "amx_ungag #%i", get_user_userid( iPlayer ) );
            else
                client_cmd( id, "amx_gag #%i %i", get_user_userid( iPlayer ), ArrayGetCell( 

g_aGagTimes, g_iMenuOption[ id ] ) );
            
            DisplayGagMenu( id, g_iMenuPosition[ id ] );
        }
    }
}

// I just copied this from AMXX Ban menu, so don't blame me :D
DisplayGagMenu( const id, iPosition ) {
    if( iPosition < 0 ) {
        arrayset( g_iMenuPlayers[ id ], 0, 32 );
        
        return;
    }
    
    new iPlayers[ 32 ], iNum, iCount, szMenu[ 512 ], iPlayer, iFlags, szName[ 32 ];
    get_players( iPlayers, iNum, "ch" ); // Ignore bots and hltv
    
    new iStart = iPosition * 7;
    
    if( iStart >= iNum )
        iStart = iPosition = g_iMenuPosition[ id ] = 0;
    
    new iEnd = iStart + 7, iKeys = MENU_KEY_0 | MENU_KEY_8;
    new iLen = formatex( szMenu, 511, g_bColoredMenus ? "\rGag Menu\R%i/%i\w^n^n" : "Gag Menu %i %i^n^n", 

iPosition + 1, ( iNum / 7 + ( ( iNum % 7 ) ? 1 : 0 ) ) );
    
    if( iEnd > iNum ) iEnd = iNum;
    
    for( new i = iStart; i < iEnd; ++i ) {
        iPlayer = iPlayers[ i ];
        iFlags  = get_user_flags( iPlayer );
        get_user_name( iPlayer, szName, 31 );
        
        if( iPlayer != id && iFlags & ADMIN_IMMUNITY ) {
            ++iCount;
            
            if( g_bColoredMenus )
                iLen += formatex( szMenu[ iLen ], 511 - iLen, "\d%i. %s^n", iCount, szName );
            else
                iLen += formatex( szMenu[ iLen ], 511 - iLen, "#. %s^n", szName );
        } else {
            iKeys |= ( 1 << iCount );
            ++iCount;
            
            iLen += formatex( szMenu[ iLen ], 511 - iLen, g_bColoredMenus ? "\r%i.\w %s\y%s\r%s^n" : 

"%i. %s%s%s^n", iCount, szName, TrieKeyExists( g_tArrayPos, g_szAuthid[ iPlayer ] ) ? " GAGGED" : "", ( ~iFlags & 

ADMIN_USER ? " *" : "" ) );
        }
    }
    
    g_iMenuPlayers[ id ] = iPlayers;
    
    new iSeconds = ArrayGetCell( g_aGagTimes, g_iMenuOption[ id ] );
    new iTime    = iSeconds / 60;
    
    iLen += formatex( szMenu[ iLen ], 511 - iLen, g_bColoredMenus ? "^n\r8.\w Gag for\y %i\w %s^n" : "^n8. Gag 

for %i %s^n", ( iSeconds > 60 ? iTime : iSeconds ), ( iSeconds > 60 ? "minutes" : "seconds" ) );
    
    if( iEnd != iNum ) {
        formatex( szMenu[ iLen ], 511 - iLen, g_bColoredMenus ? "^n\r9.\w More...^n\r0.\w %s" : "^n9. 

More...^n0. %s", iPosition ? "Back" : "Exit" );
        iKeys |= MENU_KEY_9;
    } else
        formatex( szMenu[ iLen ], 511 - iLen, g_bColoredMenus ? "^n\r0.\w %s" : "^n0. %s", iPosition ? 

"Back" : "Exit" );
    
    show_menu( id, iKeys, szMenu, -1, "Gag Menu" );
}

CheckGagFlag( const id, const iFlag ) {
    new iArrayPos;
    
    if( TrieGetCell( g_tArrayPos, g_szAuthid[ id ], iArrayPos ) ) {
        new data[ GagData ];
        ArrayGetArray( g_aGagData, iArrayPos, data );
        
        return ( data[ GAG_FLAGS ] & iFlag );
    }
    
    return 0;
}

DeleteGag( const iArrayPos ) {
    new data[ GagData ];
    ArrayGetArray( g_aGagData, iArrayPos, data );
    
    if( data[ GAG_FLAGS ] & GAG_VOICE ) {
        new iPlayer = find_player( "c", data[ GAG_AUTHID ] );
        if( is_user_connected( iPlayer ) )
            set_speak( iPlayer, SPEAK_NORMAL );
    }
    
    TrieDeleteKey( g_tArrayPos, data[ GAG_AUTHID ] );
    ArrayDeleteItem( g_aGagData, iArrayPos );
    g_iGagged--;
    
    for( new i = iArrayPos; i < g_iGagged; i++ ) {
        ArrayGetArray( g_aGagData, i, data );
        TrieSetCell( g_tArrayPos, data[ GAG_AUTHID ], i );
    }
}
martvonk is offline
joshknifer
Veteran Member
Join Date: Jun 2011
Location: Denver, CO
Old 04-17-2014 , 19:22   Re: [REQ] Gag player,
Reply With Quote #2

Is your server steam-only? (your signature line one is not)
__________________
joshknifer is offline
Send a message via Skype™ to joshknifer
martvonk
Junior Member
Join Date: Jul 2012
Old 04-17-2014 , 19:47   Re: [REQ] Gag player,
Reply With Quote #3

Yes, I use another server only steam
martvonk is offline
joshknifer
Veteran Member
Join Date: Jun 2011
Location: Denver, CO
Old 04-17-2014 , 19:59   Re: [REQ] Gag player,
Reply With Quote #4

Your error is consistent with a non-steam server as well. IP of the other server?
__________________
joshknifer is offline
Send a message via Skype™ to joshknifer
martvonk
Junior Member
Join Date: Jul 2012
Old 04-17-2014 , 20:14   Re: [REQ] Gag player,
Reply With Quote #5

5.175.138.177:27015
martvonk is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 04-17-2014 , 21:40   Re: [REQ] Gag player,
Reply With Quote #6

Quote:
Originally Posted by martvonk View Post
5.175.138.177:27015
Make your server Steam only.

Code:
hostname:  [NEW*] LAND OF FIGHT | ZOMBIE-ESCAPE |
version :  48/1.1.2.6/Stdio 5787 secure  (10)
tcp/ip  :  5.175.138.177:27015
map     :  ze_campescape_lg at: 0 x, 0 y, 0 z
players :  2 active (32 max)

#      name userid uniqueid frag time ping loss adr
# 1 "LAND OF FIGHT" 94 BOT   0  9:05:38    0    0
# 2 "playa playa" 96 STEAM_0:0:18055903   0 00:43  146    0
2 users
] meta list
Currently running plugins:
 [  1] AMX Mod X, v1.8.1.3746, Aug 16 2008, by AMX Mod X Dev Team, see http://www.amxmodx.org
 [  2] dproto_EF, v0.9.335, 2013-10-08, by Crock, see 
 [  3] Block Sendfile Exploit, v1.0, Sep 22 2013, by kiki, see www.hlmod.hu
 [  4] CsBlackDevil Protection, v1.0, Dec  1 2011, by Hattrick, see http://www.CsBlackDevil.com/
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
Reply


Thread Tools
Display Modes

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 23:19.


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