AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Kick Menu From Lang To Config (https://forums.alliedmods.net/showthread.php?t=305795)

Alber9091 03-04-2018 09:17

Kick Menu From Lang To Config
 
Can anyone make it use with configs/kickmenu.cfg? instead of lang/kickmenu.txt ?

PHP Code:

/* A plugin from http://www.csindia.tech */
#include <amxmodx>

new g_iPlayerMenuPage[33];

new 
g_apPlayerMenuPlayers[33][32];

new 
g_iTarget[33];

new 
amx_show_activity;

public 
plugin_init()
{
    
register_plugin("New KickMenu""2.0""Flash");
    
    
register_clcmd("amx_kickmenu""ClCmdKickMenu"ADMIN_KICK);
    
register_clcmd("kickreason""ClCmdCustomKickReason"ADMIN_KICK);
    
    
register_menucmd(register_menuid("PlayersMenu"), 1023"PlayersMenuHandler");
    
register_menucmd(register_menuid("ReasonsMenu"), 1023"ReasonsMenuHandler");
    
    
amx_show_activity get_cvar_pointer("amx_show_activity");
    
    
register_dictionary("admincmd.txt");
    
register_dictionary("common.txt");
    
register_dictionary("kickreasons.txt");
}

public 
ClCmdKickMenu(idbitsAccess)
{
    if(!(
get_user_flags(id) & bitsAccess))
    {
        
console_print(id"%L"id"NO_ACC_COM");
        
        return 
PLUGIN_HANDLED;
    }
    
    
PlayersMenuDisplay(idg_iPlayerMenuPage[id] = 0);
    
    return 
PLUGIN_HANDLED;
}

public 
ClCmdCustomKickReason(idbitsAccess)
{
    if(!(
get_user_flags(id) & bitsAccess))
    {
        
console_print(id"%L"id"NO_ACC_COM");
        
        return 
PLUGIN_HANDLED;
    }
    
    new 
iPlayer g_iTarget[id];
    
    if(!
iPlayer)
        return 
PLUGIN_HANDLED;
        
    new 
szReason[64];
    
read_argv(1szReason63);
    
    
remove_quotes(szReason);
    
    new 
szTargetName[32];
    
get_user_name(iPlayerszTargetName31);
    
    switch(
get_pcvar_num(amx_show_activity))
    {
        case 
1client_print(0print_chat"%L. %L: %s"id"ADMIN_KICK_1"szTargetNameid"CLIENT_PRINT_REASON"szReason);
        
        case 
2:
        {
            new 
szAdminName[32];
            
get_user_name(idszAdminName31);
            
            
client_print(0print_chat"%L. %L: %s"id"ADMIN_KICK_2"szAdminNameszTargetNameid"CLIENT_PRINT_REASON"szReason);
        }
    }

    
server_cmd("kick #%d ^"%s^""get_user_userid(iPlayer), szReason);
    
server_exec();
    
    return 
PLUGIN_HANDLED;
}

public 
PlayersMenuDisplay(idiPage)
{
    if(
iPage 0)
        return 
PLUGIN_CONTINUE;
    
    new 
apPlayers[32];
    new 
iPlayers;
    new 
szMenu[512], szName[32];
    new 
pPlayer;

    
get_players(apPlayersiPlayers);

    new 
min(iPage 8iPlayers);

    new 
iStart - (8);

    new 
iEnd min(iStart 8iPlayers);

    
iPage iStart 8;

    
g_apPlayerMenuPlayers[id] = apPlayers;
    
g_iPlayerMenuPage[id] = iPage;

    new 
iLen formatex(szMenucharsmax(szMenu), "\y%L\R%d/%d^n^n"id"KICK_MENU"iPage 1, ((iPlayers 1) / 8) + 1);

    new 
bitsKeys MENU_KEY_0;

    new 
iItem;

    new 
bitsFlags;


    for(
iStartiEndi++)
    {
        
pPlayer apPlayers[i];

        
get_user_name(pPlayerszName31);

        
bitsFlags get_user_flags(pPlayer);

        if(
bitsFlags ADMIN_IMMUNITY && id != pPlayer)
            
iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen"\d%d. %s^n", ++iItemszName);
        else if(
bitsFlags && !(bitsFlags ADMIN_USER))
        {
            
bitsKeys |= (<< iItem);

            
iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen"\w%d. %s \r*^n", ++iItemszName);
        }
        else
        {
            
bitsKeys |= (<< iItem);

            
iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen"\w%d. %s^n", ++iItemszName);
        }
    }

    if(
iEnd iPlayers)
    {
        
bitsKeys |= MENU_KEY_9;

        
formatex(szMenu[iLen], charsmax(szMenu) - iLen"^n\w9. %L...^n0. %L"id"MORE"idiPage "BACK" "EXIT");
    }
    else
        
formatex(szMenu[iLen], charsmax(szMenu) - iLen"^n\w0. %L"idiPage "BACK" "EXIT");

    
show_menu(idbitsKeysszMenu, -1"PlayersMenu");
    
    return 
PLUGIN_HANDLED;
}


public 
PlayersMenuHandler(idiKey)
{
    switch(
iKey)
    {
        case 
8PlayersMenuDisplay(id, ++g_iPlayerMenuPage[id]);

        case 
9PlayersMenuDisplay(id, --g_iPlayerMenuPage[id]);

        default:
        {
            new 
iPlayer g_apPlayerMenuPlayers[id][(g_iPlayerMenuPage[id] * 8) + iKey];

            if(!
is_user_connected(iPlayer))
            {
                
client_print(idprint_chat"* %L"id"PLAYER_HAS_LEFT_THE_SERVER");

                
PlayersMenuDisplay(idg_iPlayerMenuPage[id]);

                return 
PLUGIN_HANDLED;
            }


            if(
id != iPlayer && (get_user_flags(iPlayer) & ADMIN_IMMUNITY))
            {
                new 
szTargetName[32];
                
get_user_name(iPlayerszTargetName31);

                
client_print(idprint_chat"* %L"id"CLIENT_IMM"szTargetName);

                
PlayersMenuDisplay(idg_iPlayerMenuPage[id]);

                return 
PLUGIN_HANDLED;
            }

            
g_iTarget[id] = iPlayer;
            
            
ReasonsMenuDisplay(id);
        }
    }

    return 
PLUGIN_HANDLED;
}

public 
ReasonsMenuDisplay(id)
{
    new 
szMenu[512], szReason[64], szReasonName[16], iLenibitsKeys;
    
    
iLen formatex(szMenucharsmax(szMenu), "\y%L^n^n"id"REASON_MENU_TITLE");
    
iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen"\w1. %L^n"id"KNO_REASON");
    
    
bitsKeys |= MENU_KEY_1;
    
    for(
1<= 7i++)
    {
        
formatex(szReasonName15"KREASON_%d"i);
        
formatex(szReason63"%L"idszReasonName);
        
        if(!
strlen(szReason))
            break;

        
iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen"\w%d. %L^n"1idszReasonName);
        
        
bitsKeys |= (<< i);
    }
    
    
iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen"^n\w9. %L^n"id"KCUSTOM_REASON");
    
    
bitsKeys |= MENU_KEY_9;
    
    
formatex(szMenu[iLen], charsmax(szMenu) - iLen"^n\w0. %L"id"EXIT");
    
    
bitsKeys |= MENU_KEY_0;
    
    
show_menu(idbitsKeysszMenu, -1"ReasonsMenu");
}

public 
ReasonsMenuHandler(idiKey)
{
    if(
iKey == 9)
        return 
PLUGIN_HANDLED;
        
    if(
iKey == 8)
    {
        
client_cmd(id"messagemode kickreason");
        
        return 
PLUGIN_HANDLED;
    }
    
    new 
iPlayer g_iTarget[id];
    
    if(!
is_user_connected(iPlayer))
    {
        
client_print(idprint_chat"* %L"id"PLAYER_HAS_LEFT_THE_SERVER");

        
PlayersMenuDisplay(idg_iPlayerMenuPage[id]);

        return 
PLUGIN_HANDLED;
    }

    new 
szTargetName[32];
    
get_user_name(iPlayerszTargetName31);
    
    new 
szReasonName[16];
    
formatex(szReasonName15"KREASON_%d"iKey);
    
    switch(
get_pcvar_num(amx_show_activity))
    {
        case 
1:
        {
            if(!
iKey)
                
client_print(0print_chat"%L"id"ADMIN_KICK_1"szTargetName);
            else
                
client_print(0print_chat"%L. %L: %L"id"ADMIN_KICK_1"szTargetNameid"CLIENT_PRINT_REASON"idszReasonName);
        }
        
        case 
2:
        {
            new 
szAdminName[32];
            
get_user_name(idszAdminName31);
            
            if(!
iKey)
                
client_print(0print_chat"%L"id"ADMIN_KICK_2"szAdminNameszTargetName);
            else
                
client_print(0print_chat"%L. %L: %L"id"ADMIN_KICK_2"szAdminNameszTargetNameid"CLIENT_PRINT_REASON"idszReasonName);
        }
    }
    
    if(!
iKey)
        
server_cmd("kick #%d"get_user_userid(iPlayer));
    else
        
server_cmd("kick #%d ^"%L^""get_user_userid(iPlayer), idszReasonName);

    
server_exec();
    
    return 
PLUGIN_HANDLED;



Relaxing 03-04-2018 12:35

Re: Kick Menu From Lang To Config
 
Dictionary default foder is lang folder.
The definition of cfg is configuration, which I don't see any meet-up lines with dictionary files. Can you reply why you want to do this major change?

Alber9091 03-04-2018 13:01

Re: Kick Menu From Lang To Config
 
Quote:

Originally Posted by Relaxing (Post 2581335)
Dictionary default foder is lang folder.
The definition of cfg is configuration, which I don't see any meet-up lines with dictionary files. Can you reply why you want to do this major change?

umm bcz of ML_ERRORS? If I don't fill reasons in data/lang/kickmenu.txt ..!!
Or It won't happen? :/

Relaxing 03-04-2018 13:10

Re: Kick Menu From Lang To Config
 
ML_ERRORS... they even aren't a thing compared to how you customize the directory file. ML_ERROR will show up when a value doesn't contain any data.
ML_ERROR will show up in these two cases, which are more likely equal.
1) Value is empty (example: DEATH_MSG = ).
2) Value is declared on plugin but doesn't exists in directory file (ex. ).

OciXCrom 03-04-2018 13:42

Re: Kick Menu From Lang To Config
 
0) The entire file is MISSING.

fysiks 03-04-2018 16:10

Re: Kick Menu From Lang To Config
 
Quote:

Originally Posted by OciXCrom (Post 2581348)
0) The entire file is MISSING.

I think that gives "ML_NOT_FOUND" IIRC.

OciXCrom 03-04-2018 16:22

Re: Kick Menu From Lang To Config
 
Quote:

Originally Posted by fysiks (Post 2581362)
I think that gives "ML_NOT_FOUND" IIRC.

That's exactly what I'm talking about. ML_ERROR doesn't even exist.

fysiks 03-04-2018 16:23

Re: Kick Menu From Lang To Config
 
Quote:

Originally Posted by OciXCrom (Post 2581366)
That's exactly what I'm talking about. ML_ERROR doesn't even exist.

Ah, Ok.

Alber9091 03-05-2018 14:23

Re: Kick Menu From Lang To Config
 
data/lang/Kickreasons.txt
Code:

[en]
PLAYER_HAS_LEFT_THE_SERVER = Player has left the server
REASON_MENU_TITLE = Select Reason For Kick :
CLIENT_PRINT_REASON = Reason
KNO_REASON = No reason
KREASON_1 = AFK
KREASON_2 = Don't Spam
KREASON_3 = Camping Even After Warnings       
KREASON_4 = Abusing Even After Warnings
KREASON_5 = High Ping
KREASON_6 = Respect Admin
KREASON_7 = Respect Religions
KCUSTOM_REASON = Custom Reason

Now, Will anyone, please convert it?

Like, it forces me to Add 7 Reasons.
P.S: Last Reason, Should Always Be Custom (Constant)

sanimare 03-05-2018 19:00

Re: Kick Menu From Lang To Config
 
Quote:

Originally Posted by Alber9091 (Post 2581506)
data/lang/Kickreasons.txt
Code:

[en]
PLAYER_HAS_LEFT_THE_SERVER = Player has left the server
REASON_MENU_TITLE = Select Reason For Kick :
CLIENT_PRINT_REASON = Reason
KNO_REASON = No reason
KREASON_1 = AFK
KREASON_2 = Don't Spam
KREASON_3 = Camping Even After Warnings       
KREASON_4 = Abusing Even After Warnings
KREASON_5 = High Ping
KREASON_6 = Respect Admin
KREASON_7 = Respect Religions
KCUSTOM_REASON = Custom Reason

Now, Will anyone, please convert it?

Like, it forces me to Add 7 Reasons.
P.S: Last Reason, Should Always Be Custom (Constant)

Here you go

Code:

[en]
KICK_MENU = Kick Menu
PLAYER_HAS_LEFT_THE_SERVER = Player has left the server
REASON_MENU_TITLE = Select Reason For Kick :
CLIENT_PRINT_REASON = Reason
KNO_REASON = No reason
KREASON_1 = AFK
KREASON_2 = Don't Spam
KREASON_3 = Camping Even After Warnings       
KREASON_4 = Abusing Even After Warnings
KREASON_5 = High Ping
KREASON_6 = Respect Admin
KREASON_7 =
KCUSTOM_REASON = Custom Reason



All times are GMT -4. The time now is 00:50.

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