Raised This Month: $32 Target: $400
 8% 

banmenu reasons and custom time


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Parol23
Junior Member
Join Date: Jan 2021
Old 02-18-2021 , 06:05   banmenu reasons and custom time
Reply With Quote #1

Can you guys help me with a banmenu plugin which have a players menu to ban, a reasons menu ( and if a reason isn't there press 6 or 7 to type a custom reason) and a time menu ? I search the internet but i didn't find it, i don't want to use amxbans bcs i do not have webpanel xd, not useless answers pls
Parol23 is offline
raizo11
BANNED
Join Date: Dec 2013
Location: https://t.me/pump_upp
Old 02-18-2021 , 12:20   Re: banmenu reasons and custom time
Reply With Quote #2

Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Reasons Ban Menu"
#define VERSION "1.0"
#define AUTHOR "raizo"

#pragma tabsize 0
#pragma compress 1

#define MAX_REASONS 32

enum reasons
{
    Reason1 = 1,
    Reason2,
    Reason3,
    Reason4,
    Reason5
}

enum thetime
{
    maxtime1 = 1,
    maxtime2,
    maxtime3,
    maxtime4,
    maxtime5
}

enum reasons_config
{
    reasons:reason_menu,
    thetime:time_menu
}

new all_reasons[MAX_REASONS+1][reasons_config]

new szResult[64], szTime[64]
new szTmp[192]
new szArg[ 21 ];

new his_reason[33]

public plugin_init() 
{
    register_plugin(PLUGIN, VERSION, AUTHOR)

    register_clcmd("say /banmenu", "ban_menu_reasons");

    register_clcmd("Type_your_reason","set_reason"); 
}


public set_reason( id ) 
{ 
    read_argv(1, szArg, sizeof ( szArg ) -1 );

    if ( !strlen( szArg ) || strlen( szArg ) < 5 ) 
    { 
        client_cmd( id, "messagemode Type_your_reason" ); 
        return PLUGIN_HANDLED; 
    } 
    else if( strlen( szArg ) > 50 ) 
    { 
        client_cmd( id, "messagemode Type_your_reason" ); 
        return PLUGIN_HANDLED; 
    } 
    Search_Player(id)

    return PLUGIN_HANDLED; 
} 



public ban_menu_reasons(id)
{
    new flags = get_user_flags(id)
    if(!(flags & ADMIN_BAN))
    {
        client_print(id,print_chat,"You have no access to this command")
        return PLUGIN_HANDLED
    }

    new menu = menu_create("\y[\r Ban Menu \y ]\w By raizo","menu_handled")

    formatex(szTmp,charsmax(szTmp),"Choose Reason \r%s",reason_results(all_reasons[id][reason_menu]));
    menu_additem(menu,szTmp,"1")

    formatex(szTmp,charsmax(szTmp),"Type Reason");
    menu_additem(menu,szTmp,"2")

    formatex(szTmp,charsmax(szTmp),"Choose Time \r%s",times_results(all_reasons[id][time_menu]));
    menu_additem(menu,szTmp,"3")

    formatex(szTmp,charsmax(szTmp),"Choose Player");
    menu_additem(menu,szTmp,"4")


    menu_display(id,menu)

    return PLUGIN_HANDLED;
}

public menu_handled(id,menu,item)
{
    if(item == MENU_EXIT)
    {
        menu_destroy(menu);

        return PLUGIN_HANDLED;
    }

    new data[3], iName[64]
    new access, callback;
    menu_item_getinfo(menu, item, access, data,2, iName, 63, callback);
    new key = str_to_num(data)

    switch(key)
    {
    case 1:
    {
        all_reasons[id][reason_menu] = ( ++all_reasons[id][reason_menu] > (reasons:5) ) ? (reasons:1) :all_reasons[id][reason_menu]
        his_reason[id] = 1
    }
    case 2:
    {
        set_reason(id)
        his_reason[id] = 2
        return PLUGIN_HANDLED;
    }
    case 3:
    {
        all_reasons[id][time_menu] = ( ++all_reasons[id][time_menu] > (thetime:5) ) ? (thetime:1) :all_reasons[id][time_menu]
    }
    case 4:
    {
        Search_Player(id) 
        return PLUGIN_HANDLED;
    }
    }
        menu_destroy(menu);

        ban_menu_reasons(id)

        return PLUGIN_HANDLED;
}

public Search_Player( id )
{
    new menu = menu_create( "\rChoose Your Player!:", "menu_player_handler" );

    new players[32], pnum, tempid;

    new szName[32], szUserId[32];

    get_players( players, pnum, "a" ); 

    for ( new i; i<pnum; i++ )
    {
        tempid = players[i];

        get_user_name( tempid, szName, charsmax( szName ) );

        formatex( szUserId, charsmax( szUserId ), "%d", get_user_userid( tempid ) );

        menu_additem( menu, szName, szUserId, 0 );
    }

    menu_display( id, menu, 0 );
}



public menu_player_handler( id, menu, item )
{

    if ( item == MENU_EXIT )
    {
    menu_destroy( menu );
    return PLUGIN_HANDLED;
    }


    new szData[6], szName[64];
    new _access, item_callback;

    menu_item_getinfo( menu, item, _access, szData,charsmax( szData ), szName,charsmax( szName ), item_callback );

    new userid = str_to_num( szData );

    new player = find_player( "k", userid );

    new idname[33], playername[33]

    get_user_name(id,idname,charsmax(idname))
    get_user_name(player,playername,charsmax(playername))

    if ( player && is_user_connected( player ) )
    {
        new uIP[32]
        get_user_name(player, uIP, 31)

        if (his_reason[id] == 1)
        {
            server_cmd("amx_banip %s %s ^"%s^"", uIP,szTime,szResult)
        }
        else if (his_reason[id] == 2)
        { 
            server_cmd("amx_banip %s %s ^"%s^"", uIP,szTime,szArg)
        }
    }
    menu_destroy( menu );
    return PLUGIN_HANDLED;
}


reason_results(reasons:part)
{
    switch(part)
    {
        case Reason1:    copy(szResult, charsmax(szResult), "Hacker Detected");
        case Reason2:    copy(szResult, charsmax(szResult), "To more ping");
        case Reason3:    copy(szResult, charsmax(szResult), "You speak only boolshit");
        case Reason4:    copy(szResult, charsmax(szResult), "You can change reasons from here");
        case Reason5:    copy(szResult, charsmax(szResult), "Bye Bye");
			
        default:             copy(szResult, charsmax(szResult), "No Reason");
     }
    return szResult;
}

times_results(thetime:part)
{
    switch(part)
    {
        case maxtime1:    copy(szTime, charsmax(szTime), "15");
        case maxtime2:    copy(szTime, charsmax(szTime), "30");
        case maxtime3:    copy(szTime, charsmax(szTime), "60");
        case maxtime4:    copy(szTime, charsmax(szTime), "120");
        case maxtime5:    copy(szTime, charsmax(szTime), "36000");
			
        default:             copy(szTime, charsmax(szTime), "0");
    }
    return szTime;
}

Last edited by raizo11; 02-19-2021 at 11:05.
raizo11 is offline
Send a message via ICQ to raizo11 Send a message via AIM to raizo11 Send a message via MSN to raizo11 Send a message via Yahoo to raizo11 Send a message via Skype™ to raizo11
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 06:50.


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