[Modificare plugin] Gag [rezolvat!]

Modificari necesare ale pluginurilor

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Post Reply
User avatar
Freezy.
Membru, skill +1
Membru, skill +1
Posts: 385
Joined: 21 Feb 2016, 14:12
Detinator Steam: Da
Detinator server CS: SUD.LEAGUECS.RO
SteamID: /id/fzind/
Fond eXtream: 0
Location: Constanţa
Has thanked: 2 times
Contact:

01 Feb 2018, 12:47

Cum pot elimina motivul de tot din gag.
să tastez doar amx_gag robi 1
să nu mai fie nevoie și de motiv.
Exotiq advanced gag | Afiseaza codul
#include <amxmodx>
#include <amxmisc>
#include <nvault> 

#define ACCESS    ADMIN_SLAY
#define WORDS   999
#define SWEAR_GAGMINUTES 3
#define SHOW

new const g_FileName[] = "automute-words.ini";

new 
bool:g_Gaged[ 33 ], g_GagTime[ 33 ],
bool:g_SwearGag[ 33 ], bool:g_CmdGag[ 33 ],
bool:g_NameChanged[33];

new g_reason[ 32 ], g_admin[ 32 ], g_name[ 33 ][ 32 ];

new g_WordsFile[ 128 ];
new g_Words[ WORDS ][ 32 ], g_Count, g_Len;
new point
new g_vault

public plugin_init() 
{
    register_plugin("GAG-Manager", "1.0", "ExoTiQ")
    
    register_concmd( "amx_gag", "gag_cmd", ACCESS,"- <nume> <minute> <motiv>" );
    register_concmd( "amx_ungag", "ungag_cmd", ACCESS, "- <nume>" );
    register_clcmd( "say", "check" );
    register_clcmd( "say_team", "check" );
    g_vault = nvault_open("ListaDisconnect");
    point = get_cvar_pointer( "amx_show_activity" );
    
}

public plugin_cfg()
{
    static dir[ 999 ];
    get_localinfo( "amxx_configsdir", dir, 998 );
    formatex( g_WordsFile , 127 , "%s/%s" , dir, g_FileName );
    
    if( !file_exists( g_WordsFile ) )
        write_file( g_WordsFile, "[Gag Words]", -1 );
    
    new Len;
    
    while( g_Count < WORDS && read_file( g_WordsFile, g_Count ,g_Words[ g_Count ][ 1 ], 30, Len ) )
    {
        g_Words[ g_Count ][ 0 ] = Len;
        g_Count++;
    }
}

public client_connect(id)
{
    LoadMutedPlayers(id)
}

public gag_cmd( id, level, cid )
{
    if( !cmd_access( id, level, cid, 4 ) )
        return PLUGIN_HANDLED;   
    
    new arg[ 32 ], arg2[ 6 ], reason[ 32 ];
    new name[ 32 ], namet[ 32 ];
    new minutes;
    
    read_argv(1, arg, 31)
    
    new player = cmd_target(id, arg, 9)
    
    if (!player) 
        return PLUGIN_HANDLED
    
    read_argv( 1, arg, sizeof arg - 1 );
    read_argv( 2, arg2, sizeof arg2 - 1 );
    read_argv( 3, reason, sizeof reason - 1 );
    
    get_user_name( id, name, 31 );
    
    copy( g_admin, 31, name );
    copy( g_reason, 31, reason );
    remove_quotes( reason );
    
    minutes = str_to_num( arg2 );
    
    new target = cmd_target( id, arg, 10 );
    if( !target)
        return PLUGIN_HANDLED;
    
    if( g_Gaged[ target ] )
    {
        console_print( id, "Jucatorul deja are gag!" );
        return PLUGIN_HANDLED;
    }
    
    get_user_name( target, namet, 31 );
    copy( g_name[ target ], 31, namet );
    
    g_CmdGag[ target ] = true;
    g_Gaged[target] = true;
    g_GagTime[ target ] = minutes;
    
    culoare_scris( 0, "!verde[INDUNGI]: !normalAdminul !verde%s !normali-a dat gag lui !verde%s !normalpentru !verde%d minut(e).",get_pcvar_num( point ) == 2 ? name : "", namet, minutes, reason );
    
    
    set_task( 60.0, "count", target + 123, _, _, "b" );
    
    return PLUGIN_HANDLED;
}

public ungag_cmd( id,level, cid )
{
    if( !cmd_access( id, level, cid, 2 ) )
        return PLUGIN_HANDLED;
    
    new arg[ 32 ], reason[ 32 ], name[ 32 ];
    read_argv( 1, arg, sizeof arg - 1 );
    read_argv( 2, reason, sizeof reason - 1 );
    get_user_name( id, name, sizeof name - 1 );
    remove_quotes( reason );
    
    new target = cmd_target( id, arg, 11 );
    if( !target )
        return PLUGIN_HANDLED;
    new namet[ 32 ];
    get_user_name( target, namet, sizeof namet - 1 );
    
    if( !g_Gaged[ target ] )
    {
        console_print( id, "Jucatorul %s nu are gag.", namet );
        return PLUGIN_HANDLED;
    }
    
    g_Gaged[ target ] = false;
    g_SwearGag[ target ] = false;
    
    if( g_NameChanged[ target ] )
        client_cmd( target, "name ^"%s^"", g_name[ target ] );
    
    g_NameChanged[ target ] = false;
    
    remove_task( target + 123 );
    
    culoare_scris( 0, "!verde[INDUNGI]: !normalAdminul !verde%s !normali-a scos gag-ul lui !verde%s.",get_pcvar_num( point ) == 2 ? name : "", namet );
    
    return PLUGIN_HANDLED;
}

public count( task )
{
    new index = task - 123;
    if( !is_user_connected( index ) )
        return 0;
    
    g_GagTime[index] -= 1;
    
    if( g_GagTime[ index ] <= 0 )
    {
        remove_task( index + 123 );
        new name[ 32 ]
        get_user_name( index, name, 31 );
        culoare_scris( 0, "!verde[INDUNGI]: !normalJucatorului !verde%s !normali-a expirat !verdegag-ul.",name );
        g_Gaged[ index ] = false;
        
        if( g_NameChanged[ index ] )
            client_cmd( index, "name ^"%s^"", g_name[ index ] );
        
        return 0;
    }
    
    return 1;
}

public check( id )
{
    new said[ 192 ];
    read_args( said, sizeof said - 1 );
    
    if( !strlen( said ) )
        return PLUGIN_CONTINUE;
    
    if( g_Gaged[ id ] )
    {
        if( g_CmdGag[ id ] )
        {
            culoare_scris( id,"!verde[INDUNGI]: !normalAi primit gag din partea adminului !verde%s.", g_admin);
            culoare_scris( id,"!verde[INDUNGI]: !normalGag-ul iti expira peste !verde%d minut(e)." , g_GagTime[ id ], g_GagTime[ id ] == 1 ? "" : "s" );
            culoare_scris( id,"!verde[INDUNGI]: !normalAi interzicere la toate chat-urile. !verde(voice_chat/say/say_team/say_team@)", g_reason );
            
            return PLUGIN_HANDLED;
            
            } else if( g_SwearGag[ id ] ) {
            culoare_scris( id, "!verde[INDUNGI]: !normalAi primit auto-gag pentru !verdelimbaj !normalsau !verdereclama.")
            culoare_scris( id,"!verde[INDUNGI]: !normalGag-ul iti expira peste !verde%d minute." , g_GagTime[ id ], g_GagTime[ id ] == 1 ? "" : "s" );
            return PLUGIN_HANDLED;
        }
        } else {
        
        new bool:g_Sweared, i, pos;
        
        for( i = 0; i < g_Count; ++i )
        {
            if( ( pos = containi( said, g_Words[ i ][ 1 ] ) ) != -1 )
            {
                g_Len = g_Words[ i ][ 0 ];
                
                while( g_Len-- )
                    said[ pos++ ] = '*';
                
                g_Sweared = true;
                continue;
            }
        }
        
        if( g_Sweared )
        {
            new cmd[ 32 ], name[ 32 ];
            
            get_user_name( id, name, sizeof name - 1 );
            read_argv( 0, cmd, sizeof cmd - 1 );
            copy( g_name[ id ], 31, name );
            
            engclient_cmd( id, cmd, said );
            g_Gaged[ id ] = true;
            g_CmdGag[ id ] = false;
            
            
            
            g_SwearGag[ id ] = true;
            g_GagTime[ id ] = SWEAR_GAGMINUTES;
            
            culoare_scris( 0,"!verde[INDUNGI]: !normalJucatorul !verde%s !normala primit !verdeauto-gag !normalpentru !verde3 minute.",name );
            
            
            set_task( 60.0, "count",id+123,_,_,"b");
            
            return PLUGIN_HANDLED;
        }
    }
    
    return PLUGIN_CONTINUE;
}

public client_disconnect(id) 
{ 
    if(g_Gaged[id]) 
    {
        new Nick[32],Authid[35],userip[32]
        get_user_name(id,Nick,31)
        get_user_ip(id,userip,31);
        get_user_authid(id,Authid,34) 
        culoare_scris(0, "!verde[INDUNGI]: !normalJucatorul !verde%s !normal cu IP-ul !verde%s !normala iesit de pe server.",Nick,userip)        
        SaveMutedPlayers(id);    
        remove_task( id );
        
    }
}

public SaveMutedPlayers(id) 
{ 
    
    new name[32], userip[32];
    get_user_name(id,name,31); 
    get_user_ip(id,userip,31);
    new vaultkey[64],vaultdata[256]  
    format(vaultkey,63,"%s[IP: %s]-Muted",name,userip) 
    format(vaultdata,255,"%i#%i#",g_Gaged[id],g_SwearGag[id]) 
    nvault_set(g_vault,vaultkey,vaultdata) 
    return PLUGIN_CONTINUE 
}  

public LoadMutedPlayers(id) 
{ 
    new name[32], userip[32];
    get_user_name(id,name,31); 
    get_user_ip(id,userip,31);
    new vaultkey[64],vaultdata[256] 
    format(vaultkey,63,"%s[IP: %s]-Muted",name,userip) 
    format(vaultdata,255,"%i#%i#",g_Gaged[id],g_SwearGag[id])
    nvault_get(g_vault,vaultkey,vaultdata,255) 
    replace_all(vaultdata, 255, "#", " ") 
    return PLUGIN_CONTINUE 
}  

stock culoare_scris(const id, const input[], any:...)
{
    new count = 1, players[32]
    static msg[191]
    vformat(msg, 190, input, 3)
    
    replace_all(msg, 190, "!verde", "^4")
    replace_all(msg, 190, "!normal", "^1")
    replace_all(msg, 190, "!team", "^3")
    
    if (id) players[0] = id; else get_players(players, count, "ch")
    {
        for (new i = 0; i < count; i++)
        {
            if (is_user_connected(players))
            {
                message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players)
                write_byte(players);
                write_string(msg);
                message_end();
            }
        }
    }  
}
sud.leaguecs.ro # 32/32 non stop. - 5.254.20.19:27015
sudmix.leaguecs.ro # mix our familly - 5.254.20.7:27015 - DE
sudmix2.leaguecs.ro # mix our familly - 109.163.232.164:27015 - RO
leaguecs românia - forum sud: https://bit.ly/3fm6bJK

----------------------------------------------------------
servere găzduite de gphosting.ro
User avatar
YONTU
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 2466
Joined: 10 May 2013, 14:25
Detinator Steam: Nu
CS Status: Everyone is looking at ur shoes
Reputatie: Moderator ajutator
Fost scripter eXtreamCS
Location: Gura Humorului
Has thanked: 256 times
Been thanked: 288 times
Contact:

02 Feb 2018, 15:17

| Afiseaza codul
[code=php]#include <amxmodx>
#include <amxmisc>
#include <nvault> 

#define ACCESS    ADMIN_SLAY
#define WORDS   999
#define SWEAR_GAGMINUTES 3
#define SHOW

new const g_FileName[] = "automute-words.ini";

new 
bool:g_Gaged[ 33 ], g_GagTime[ 33 ],
bool:g_SwearGag[ 33 ], bool:g_CmdGag[ 33 ],
bool:g_NameChanged[33];

new g_admin[ 32 ], g_name[ 33 ][ 32 ];

new g_WordsFile[ 128 ];
new g_Words[ WORDS ][ 32 ], g_Count, g_Len;
new point
new g_vault

public plugin_init() 
{
    register_plugin("GAG-Manager", "1.0", "ExoTiQ")
    
    register_concmd( "amx_gag", "gag_cmd", ACCESS,"- <nume> <minute>" );
    register_concmd( "amx_ungag", "ungag_cmd", ACCESS, "- <nume>" );
    register_clcmd( "say", "check" );
    register_clcmd( "say_team", "check" );
    g_vault = nvault_open("ListaDisconnect");
    point = get_cvar_pointer( "amx_show_activity" );
    
}

public plugin_cfg()
{
    static dir[ 999 ];
    get_localinfo( "amxx_configsdir", dir, 998 );
    formatex( g_WordsFile , 127 , "%s/%s" , dir, g_FileName );
    
    if( !file_exists( g_WordsFile ) )
        write_file( g_WordsFile, "[Gag Words]", -1 );
    
    new Len;
    
    while( g_Count < WORDS && read_file( g_WordsFile, g_Count ,g_Words[ g_Count ][ 1 ], 30, Len ) )
    {
        g_Words[ g_Count ][ 0 ] = Len;
        g_Count++;
    }
}

public client_connect(id)
{
    LoadMutedPlayers(id)
}

public gag_cmd( id, level, cid )
{
    if( !cmd_access( id, level, cid, 4 ) )
        return PLUGIN_HANDLED;   
    
    new arg[ 32 ], arg2[ 6 ];
    new name[ 32 ], namet[ 32 ];
    new minutes;
    
    read_argv(1, arg, 31)
    
    new player = cmd_target(id, arg, 9)
    
    if (!player) 
        return PLUGIN_HANDLED
    
    read_argv( 1, arg, sizeof arg - 1 );
    read_argv( 2, arg2, sizeof arg2 - 1 );
    
    get_user_name( id, name, 31 );
    
    copy( g_admin, 31, name );
    
    minutes = str_to_num( arg2 );
    
    new target = cmd_target( id, arg, 10 );
    if( !target)
        return PLUGIN_HANDLED;
    
    if( g_Gaged[ target ] )
    {
        console_print( id, "Jucatorul deja are gag!" );
        return PLUGIN_HANDLED;
    }
    
    get_user_name( target, namet, 31 );
    copy( g_name[ target ], 31, namet );
    
    g_CmdGag[ target ] = true;
    g_Gaged[target] = true;
    g_GagTime[ target ] = minutes;
    
    culoare_scris( 0, "!verde[INDUNGI]: !normalAdminul !verde%s !normali-a dat gag lui !verde%s !normalpentru !verde%d minut(e).",get_pcvar_num( point ) == 2 ? name : "", namet, minutes);
    
    
    set_task( 60.0, "count", target + 123, _, _, "b" );
    
    return PLUGIN_HANDLED;
}

public ungag_cmd( id,level, cid )
{
    if( !cmd_access( id, level, cid, 2 ) )
        return PLUGIN_HANDLED;
    
    new arg[ 32 ], name[ 32 ];
    read_argv( 1, arg, sizeof arg - 1 );
    get_user_name( id, name, sizeof name - 1 );
    
    new target = cmd_target( id, arg, 11 );
    if( !target )
        return PLUGIN_HANDLED;
    new namet[ 32 ];
    get_user_name( target, namet, sizeof namet - 1 );
    
    if( !g_Gaged[ target ] )
    {
        console_print( id, "Jucatorul %s nu are gag.", namet );
        return PLUGIN_HANDLED;
    }
    
    g_Gaged[ target ] = false;
    g_SwearGag[ target ] = false;
    
    if( g_NameChanged[ target ] )
        client_cmd( target, "name ^"%s^"", g_name[ target ] );
    
    g_NameChanged[ target ] = false;
    
    remove_task( target + 123 );
    
    culoare_scris( 0, "!verde[INDUNGI]: !normalAdminul !verde%s !normali-a scos gag-ul lui !verde%s.",get_pcvar_num( point ) == 2 ? name : "", namet );
    
    return PLUGIN_HANDLED;
}

public count( task )
{
    new index = task - 123;
    if( !is_user_connected( index ) )
        return 0;
    
    g_GagTime[index] -= 1;
    
    if( g_GagTime[ index ] <= 0 )
    {
        remove_task( index + 123 );
        new name[ 32 ]
        get_user_name( index, name, 31 );
        culoare_scris( 0, "!verde[INDUNGI]: !normalJucatorului !verde%s !normali-a expirat !verdegag-ul.",name );
        g_Gaged[ index ] = false;
        
        if( g_NameChanged[ index ] )
            client_cmd( index, "name ^"%s^"", g_name[ index ] );
        
        return 0;
    }
    
    return 1;
}

public check( id )
{
    new said[ 192 ];
    read_args( said, sizeof said - 1 );
    
    if( !strlen( said ) )
        return PLUGIN_CONTINUE;
    
    if( g_Gaged[ id ] )
    {
        if( g_CmdGag[ id ] )
        {
            culoare_scris( id,"!verde[INDUNGI]: !normalAi primit gag din partea adminului !verde%s.", g_admin);
            culoare_scris( id,"!verde[INDUNGI]: !normalGag-ul iti expira peste !verde%d minut(e)." , g_GagTime[ id ], g_GagTime[ id ] == 1 ? "" : "s" );
            culoare_scris( id,"!verde[INDUNGI]: !normalAi interzicere la toate chat-urile. !verde(voice_chat/say/say_team/say_team@)");
            
            return PLUGIN_HANDLED;
            
            } else if( g_SwearGag[ id ] ) {
            culoare_scris( id, "!verde[INDUNGI]: !normalAi primit auto-gag pentru !verdelimbaj !normalsau !verdereclama.")
            culoare_scris( id,"!verde[INDUNGI]: !normalGag-ul iti expira peste !verde%d minute." , g_GagTime[ id ], g_GagTime[ id ] == 1 ? "" : "s" );
            return PLUGIN_HANDLED;
        }
        } else {
        
        new bool:g_Sweared, i, pos;
        
        for( i = 0; i < g_Count; ++i )
        {
            if( ( pos = containi( said, g_Words[ i ][ 1 ] ) ) != -1 )
            {
                g_Len = g_Words[ i ][ 0 ];
                
                while( g_Len-- )
                    said[ pos++ ] = '*';
                
                g_Sweared = true;
                continue;
            }
        }
        
        if( g_Sweared )
        {
            new cmd[ 32 ], name[ 32 ];
            
            get_user_name( id, name, sizeof name - 1 );
            read_argv( 0, cmd, sizeof cmd - 1 );
            copy( g_name[ id ], 31, name );
            
            engclient_cmd( id, cmd, said );
            g_Gaged[ id ] = true;
            g_CmdGag[ id ] = false;
            
            
            
            g_SwearGag[ id ] = true;
            g_GagTime[ id ] = SWEAR_GAGMINUTES;
            
            culoare_scris( 0,"!verde[INDUNGI]: !normalJucatorul !verde%s !normala primit !verdeauto-gag !normalpentru !verde3 minute.",name );
            
            
            set_task( 60.0, "count",id+123,_,_,"b");
            
            return PLUGIN_HANDLED;
        }
    }
    
    return PLUGIN_CONTINUE;
}

public client_disconnect(id) 
{ 
    if(g_Gaged[id]) 
    {
        new Nick[32],Authid[35],userip[32]
        get_user_name(id,Nick,31)
        get_user_ip(id,userip,31);
        get_user_authid(id,Authid,34) 
        culoare_scris(0, "!verde[INDUNGI]: !normalJucatorul !verde%s !normal cu IP-ul !verde%s !normala iesit de pe server.",Nick,userip)        
        SaveMutedPlayers(id);    
        remove_task( id );
        
    }
}

public SaveMutedPlayers(id) 
{ 
    
    new name[32], userip[32];
    get_user_name(id,name,31); 
    get_user_ip(id,userip,31);
    new vaultkey[64],vaultdata[256]  
    format(vaultkey,63,"%s[IP: %s]-Muted",name,userip) 
    format(vaultdata,255,"%i#%i#",g_Gaged[id],g_SwearGag[id]) 
    nvault_set(g_vault,vaultkey,vaultdata) 
    return PLUGIN_CONTINUE 
}  

public LoadMutedPlayers(id) 
{ 
    new name[32], userip[32];
    get_user_name(id,name,31); 
    get_user_ip(id,userip,31);
    new vaultkey[64],vaultdata[256] 
    format(vaultkey,63,"%s[IP: %s]-Muted",name,userip) 
    format(vaultdata,255,"%i#%i#",g_Gaged[id],g_SwearGag[id])
    nvault_get(g_vault,vaultkey,vaultdata,255) 
    replace_all(vaultdata, 255, "#", " ") 
    return PLUGIN_CONTINUE 
}  

stock culoare_scris(const id, const input[], any:...)
{
    new count = 1, players[32]
    static msg[191]
    vformat(msg, 190, input, 3)
    
    replace_all(msg, 190, "!verde", "^4")
    replace_all(msg, 190, "!normal", "^1")
    replace_all(msg, 190, "!team", "^3")
    
    if (id) players[0] = id; else get_players(players, count, "ch")
    {
        for (new i = 0; i < count; i++)
        {
            if (is_user_connected(players))
            {
                message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players)
                write_byte(players);
                write_string(msg);
                message_end();
            }
        }
    }  
}
 [/code]
„Peste douăzeci de ani vei fi dezamăgit din cauza lucrurilor pe care nu le-ai făcut, nu din cauza celor pe care le-ai făcut.” - Mark Twain
„Asa e si in viata, hotii castiga, prostii care invata pierd.” - Mihai Nemeș


Bio.LeagueCs.Ro - Biohazard v4.4 Xmas Edition
discord: IonutC#5114

Experinta in: Java/Spring boot/Angular/C/C++/C#/Javascript/Python/HTML/CSS/Pawn/SQL
Ai nevoie de ajutorul meu? Ma poti gasi doar la adresa de discord de mai sus.
User avatar
Freezy.
Membru, skill +1
Membru, skill +1
Posts: 385
Joined: 21 Feb 2016, 14:12
Detinator Steam: Da
Detinator server CS: SUD.LEAGUECS.RO
SteamID: /id/fzind/
Fond eXtream: 0
Location: Constanţa
Has thanked: 2 times
Contact:

02 Feb 2018, 20:11

Code: Select all

    register_concmd( "amx_gag", "gag_cmd", ACCESS,"- <nume> <minute>" );
Ai modificat doar aici? pentru că asta am făcut și eu prima oară, dar când scriu amx_gag robi 1, tot nu mă lasă să dau gag fără să pun și motivul.
sud.leaguecs.ro # 32/32 non stop. - 5.254.20.19:27015
sudmix.leaguecs.ro # mix our familly - 5.254.20.7:27015 - DE
sudmix2.leaguecs.ro # mix our familly - 109.163.232.164:27015 - RO
leaguecs românia - forum sud: https://bit.ly/3fm6bJK

----------------------------------------------------------
servere găzduite de gphosting.ro
User avatar
YONTU
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 2466
Joined: 10 May 2013, 14:25
Detinator Steam: Nu
CS Status: Everyone is looking at ur shoes
Reputatie: Moderator ajutator
Fost scripter eXtreamCS
Location: Gura Humorului
Has thanked: 256 times
Been thanked: 288 times
Contact:

03 Feb 2018, 10:24

Fre?zy - #darkmind wrote:

Code: Select all

    register_concmd( "amx_gag", "gag_cmd", ACCESS,"- <nume> <minute>" );
Ai modificat doar aici? pentru că asta am făcut și eu prima oară, dar când scriu amx_gag robi 1, tot nu mă lasă să dau gag fără să pun și motivul.
Nu, trebuia sa stergi motivul din argumentele apelului comenzii.
„Peste douăzeci de ani vei fi dezamăgit din cauza lucrurilor pe care nu le-ai făcut, nu din cauza celor pe care le-ai făcut.” - Mark Twain
„Asa e si in viata, hotii castiga, prostii care invata pierd.” - Mihai Nemeș


Bio.LeagueCs.Ro - Biohazard v4.4 Xmas Edition
discord: IonutC#5114

Experinta in: Java/Spring boot/Angular/C/C++/C#/Javascript/Python/HTML/CSS/Pawn/SQL
Ai nevoie de ajutorul meu? Ma poti gasi doar la adresa de discord de mai sus.
User avatar
Freezy.
Membru, skill +1
Membru, skill +1
Posts: 385
Joined: 21 Feb 2016, 14:12
Detinator Steam: Da
Detinator server CS: SUD.LEAGUECS.RO
SteamID: /id/fzind/
Fond eXtream: 0
Location: Constanţa
Has thanked: 2 times
Contact:

03 Feb 2018, 10:45

YONTU wrote:
| Afiseaza codul
[code=php]#include <amxmodx>
#include <amxmisc>
#include <nvault> 

#define ACCESS    ADMIN_SLAY
#define WORDS   999
#define SWEAR_GAGMINUTES 3
#define SHOW

new const g_FileName[] = "automute-words.ini";

new 
bool:g_Gaged[ 33 ], g_GagTime[ 33 ],
bool:g_SwearGag[ 33 ], bool:g_CmdGag[ 33 ],
bool:g_NameChanged[33];

new g_admin[ 32 ], g_name[ 33 ][ 32 ];

new g_WordsFile[ 128 ];
new g_Words[ WORDS ][ 32 ], g_Count, g_Len;
new point
new g_vault

public plugin_init() 
{
    register_plugin("GAG-Manager", "1.0", "ExoTiQ")
    
    register_concmd( "amx_gag", "gag_cmd", ACCESS,"- <nume> <minute>" );
    register_concmd( "amx_ungag", "ungag_cmd", ACCESS, "- <nume>" );
    register_clcmd( "say", "check" );
    register_clcmd( "say_team", "check" );
    g_vault = nvault_open("ListaDisconnect");
    point = get_cvar_pointer( "amx_show_activity" );
    
}

public plugin_cfg()
{
    static dir[ 999 ];
    get_localinfo( "amxx_configsdir", dir, 998 );
    formatex( g_WordsFile , 127 , "%s/%s" , dir, g_FileName );
    
    if( !file_exists( g_WordsFile ) )
        write_file( g_WordsFile, "[Gag Words]", -1 );
    
    new Len;
    
    while( g_Count < WORDS && read_file( g_WordsFile, g_Count ,g_Words[ g_Count ][ 1 ], 30, Len ) )
    {
        g_Words[ g_Count ][ 0 ] = Len;
        g_Count++;
    }
}

public client_connect(id)
{
    LoadMutedPlayers(id)
}

public gag_cmd( id, level, cid )
{
    if( !cmd_access( id, level, cid, 4 ) )
        return PLUGIN_HANDLED;   
    
    new arg[ 32 ], arg2[ 6 ];
    new name[ 32 ], namet[ 32 ];
    new minutes;
    
    read_argv(1, arg, 31)
    
    new player = cmd_target(id, arg, 9)
    
    if (!player) 
        return PLUGIN_HANDLED
    
    read_argv( 1, arg, sizeof arg - 1 );
    read_argv( 2, arg2, sizeof arg2 - 1 );
    
    get_user_name( id, name, 31 );
    
    copy( g_admin, 31, name );
    
    minutes = str_to_num( arg2 );
    
    new target = cmd_target( id, arg, 10 );
    if( !target)
        return PLUGIN_HANDLED;
    
    if( g_Gaged[ target ] )
    {
        console_print( id, "Jucatorul deja are gag!" );
        return PLUGIN_HANDLED;
    }
    
    get_user_name( target, namet, 31 );
    copy( g_name[ target ], 31, namet );
    
    g_CmdGag[ target ] = true;
    g_Gaged[target] = true;
    g_GagTime[ target ] = minutes;
    
    culoare_scris( 0, "!verde[INDUNGI]: !normalAdminul !verde%s !normali-a dat gag lui !verde%s !normalpentru !verde%d minut(e).",get_pcvar_num( point ) == 2 ? name : "", namet, minutes);
    
    
    set_task( 60.0, "count", target + 123, _, _, "b" );
    
    return PLUGIN_HANDLED;
}

public ungag_cmd( id,level, cid )
{
    if( !cmd_access( id, level, cid, 2 ) )
        return PLUGIN_HANDLED;
    
    new arg[ 32 ], name[ 32 ];
    read_argv( 1, arg, sizeof arg - 1 );
    get_user_name( id, name, sizeof name - 1 );
    
    new target = cmd_target( id, arg, 11 );
    if( !target )
        return PLUGIN_HANDLED;
    new namet[ 32 ];
    get_user_name( target, namet, sizeof namet - 1 );
    
    if( !g_Gaged[ target ] )
    {
        console_print( id, "Jucatorul %s nu are gag.", namet );
        return PLUGIN_HANDLED;
    }
    
    g_Gaged[ target ] = false;
    g_SwearGag[ target ] = false;
    
    if( g_NameChanged[ target ] )
        client_cmd( target, "name ^"%s^"", g_name[ target ] );
    
    g_NameChanged[ target ] = false;
    
    remove_task( target + 123 );
    
    culoare_scris( 0, "!verde[INDUNGI]: !normalAdminul !verde%s !normali-a scos gag-ul lui !verde%s.",get_pcvar_num( point ) == 2 ? name : "", namet );
    
    return PLUGIN_HANDLED;
}

public count( task )
{
    new index = task - 123;
    if( !is_user_connected( index ) )
        return 0;
    
    g_GagTime[index] -= 1;
    
    if( g_GagTime[ index ] <= 0 )
    {
        remove_task( index + 123 );
        new name[ 32 ]
        get_user_name( index, name, 31 );
        culoare_scris( 0, "!verde[INDUNGI]: !normalJucatorului !verde%s !normali-a expirat !verdegag-ul.",name );
        g_Gaged[ index ] = false;
        
        if( g_NameChanged[ index ] )
            client_cmd( index, "name ^"%s^"", g_name[ index ] );
        
        return 0;
    }
    
    return 1;
}

public check( id )
{
    new said[ 192 ];
    read_args( said, sizeof said - 1 );
    
    if( !strlen( said ) )
        return PLUGIN_CONTINUE;
    
    if( g_Gaged[ id ] )
    {
        if( g_CmdGag[ id ] )
        {
            culoare_scris( id,"!verde[INDUNGI]: !normalAi primit gag din partea adminului !verde%s.", g_admin);
            culoare_scris( id,"!verde[INDUNGI]: !normalGag-ul iti expira peste !verde%d minut(e)." , g_GagTime[ id ], g_GagTime[ id ] == 1 ? "" : "s" );
            culoare_scris( id,"!verde[INDUNGI]: !normalAi interzicere la toate chat-urile. !verde(voice_chat/say/say_team/say_team@)");
            
            return PLUGIN_HANDLED;
            
            } else if( g_SwearGag[ id ] ) {
            culoare_scris( id, "!verde[INDUNGI]: !normalAi primit auto-gag pentru !verdelimbaj !normalsau !verdereclama.")
            culoare_scris( id,"!verde[INDUNGI]: !normalGag-ul iti expira peste !verde%d minute." , g_GagTime[ id ], g_GagTime[ id ] == 1 ? "" : "s" );
            return PLUGIN_HANDLED;
        }
        } else {
        
        new bool:g_Sweared, i, pos;
        
        for( i = 0; i < g_Count; ++i )
        {
            if( ( pos = containi( said, g_Words[ i ][ 1 ] ) ) != -1 )
            {
                g_Len = g_Words[ i ][ 0 ];
                
                while( g_Len-- )
                    said[ pos++ ] = '*';
                
                g_Sweared = true;
                continue;
            }
        }
        
        if( g_Sweared )
        {
            new cmd[ 32 ], name[ 32 ];
            
            get_user_name( id, name, sizeof name - 1 );
            read_argv( 0, cmd, sizeof cmd - 1 );
            copy( g_name[ id ], 31, name );
            
            engclient_cmd( id, cmd, said );
            g_Gaged[ id ] = true;
            g_CmdGag[ id ] = false;
            
            
            
            g_SwearGag[ id ] = true;
            g_GagTime[ id ] = SWEAR_GAGMINUTES;
            
            culoare_scris( 0,"!verde[INDUNGI]: !normalJucatorul !verde%s !normala primit !verdeauto-gag !normalpentru !verde3 minute.",name );
            
            
            set_task( 60.0, "count",id+123,_,_,"b");
            
            return PLUGIN_HANDLED;
        }
    }
    
    return PLUGIN_CONTINUE;
}

public client_disconnect(id) 
{ 
    if(g_Gaged[id]) 
    {
        new Nick[32],Authid[35],userip[32]
        get_user_name(id,Nick,31)
        get_user_ip(id,userip,31);
        get_user_authid(id,Authid,34) 
        culoare_scris(0, "!verde[INDUNGI]: !normalJucatorul !verde%s !normal cu IP-ul !verde%s !normala iesit de pe server.",Nick,userip)        
        SaveMutedPlayers(id);    
        remove_task( id );
        
    }
}

public SaveMutedPlayers(id) 
{ 
    
    new name[32], userip[32];
    get_user_name(id,name,31); 
    get_user_ip(id,userip,31);
    new vaultkey[64],vaultdata[256]  
    format(vaultkey,63,"%s[IP: %s]-Muted",name,userip) 
    format(vaultdata,255,"%i#%i#",g_Gaged[id],g_SwearGag[id]) 
    nvault_set(g_vault,vaultkey,vaultdata) 
    return PLUGIN_CONTINUE 
}  

public LoadMutedPlayers(id) 
{ 
    new name[32], userip[32];
    get_user_name(id,name,31); 
    get_user_ip(id,userip,31);
    new vaultkey[64],vaultdata[256] 
    format(vaultkey,63,"%s[IP: %s]-Muted",name,userip) 
    format(vaultdata,255,"%i#%i#",g_Gaged[id],g_SwearGag[id])
    nvault_get(g_vault,vaultkey,vaultdata,255) 
    replace_all(vaultdata, 255, "#", " ") 
    return PLUGIN_CONTINUE 
}  

stock culoare_scris(const id, const input[], any:...)
{
    new count = 1, players[32]
    static msg[191]
    vformat(msg, 190, input, 3)
    
    replace_all(msg, 190, "!verde", "^4")
    replace_all(msg, 190, "!normal", "^1")
    replace_all(msg, 190, "!team", "^3")
    
    if (id) players[0] = id; else get_players(players, count, "ch")
    {
        for (new i = 0; i < count; i++)
        {
            if (is_user_connected(players))
            {
                message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players)
                write_byte(players);
                write_string(msg);
                message_end();
            }
        }
    }  
}
[/code]


Păi dacă vrei să mă ajuți, ajută-mă, că ți-am zis, am testat ce ai pus mai sus și nu e ce trebuie .. poți testa chiar tu.
sud.leaguecs.ro # 32/32 non stop. - 5.254.20.19:27015
sudmix.leaguecs.ro # mix our familly - 5.254.20.7:27015 - DE
sudmix2.leaguecs.ro # mix our familly - 109.163.232.164:27015 - RO
leaguecs românia - forum sud: https://bit.ly/3fm6bJK

----------------------------------------------------------
servere găzduite de gphosting.ro
User avatar
YONTU
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 2466
Joined: 10 May 2013, 14:25
Detinator Steam: Nu
CS Status: Everyone is looking at ur shoes
Reputatie: Moderator ajutator
Fost scripter eXtreamCS
Location: Gura Humorului
Has thanked: 256 times
Been thanked: 288 times
Contact:

03 Feb 2018, 22:56

A da, uitasem. Cauta publicul gag_cmd si modifica linia

Code: Select all

if( !cmd_access( id, level, cid, 4 ) )
        return PLUGIN_HANDLED;
Astfel: in loc de 4 pune 3
„Peste douăzeci de ani vei fi dezamăgit din cauza lucrurilor pe care nu le-ai făcut, nu din cauza celor pe care le-ai făcut.” - Mark Twain
„Asa e si in viata, hotii castiga, prostii care invata pierd.” - Mihai Nemeș


Bio.LeagueCs.Ro - Biohazard v4.4 Xmas Edition
discord: IonutC#5114

Experinta in: Java/Spring boot/Angular/C/C++/C#/Javascript/Python/HTML/CSS/Pawn/SQL
Ai nevoie de ajutorul meu? Ma poti gasi doar la adresa de discord de mai sus.
User avatar
Freezy.
Membru, skill +1
Membru, skill +1
Posts: 385
Joined: 21 Feb 2016, 14:12
Detinator Steam: Da
Detinator server CS: SUD.LEAGUECS.RO
SteamID: /id/fzind/
Fond eXtream: 0
Location: Constanţa
Has thanked: 2 times
Contact:

04 Feb 2018, 23:50

Mulțumesc.
sud.leaguecs.ro # 32/32 non stop. - 5.254.20.19:27015
sudmix.leaguecs.ro # mix our familly - 5.254.20.7:27015 - DE
sudmix2.leaguecs.ro # mix our familly - 109.163.232.164:27015 - RO
leaguecs românia - forum sud: https://bit.ly/3fm6bJK

----------------------------------------------------------
servere găzduite de gphosting.ro
Post Reply

Return to “Modificari pluginuri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 7 guests