Raised This Month: $51 Target: $400
 12% 

Kick Menu From Lang To Config


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Alber9091
Veteran Member
Join Date: Jun 2014
Location: Karachi, Pakistan
Old 03-04-2018 , 09:17   Kick Menu From Lang To Config
Reply With Quote #1

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;

Alber9091 is offline
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 03-04-2018 , 12:35   Re: Kick Menu From Lang To Config
Reply With Quote #2

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?
__________________
Relaxing is offline
Alber9091
Veteran Member
Join Date: Jun 2014
Location: Karachi, Pakistan
Old 03-04-2018 , 13:01   Re: Kick Menu From Lang To Config
Reply With Quote #3

Quote:
Originally Posted by Relaxing View Post
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? :/

Last edited by Alber9091; 03-04-2018 at 13:05.
Alber9091 is offline
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 03-04-2018 , 13:10   Re: Kick Menu From Lang To Config
Reply With Quote #4

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. ).
__________________
Relaxing is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-04-2018 , 13:42   Re: Kick Menu From Lang To Config
Reply With Quote #5

0) The entire file is MISSING.
__________________

Last edited by OciXCrom; 03-04-2018 at 13:42.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-04-2018 , 16:10   Re: Kick Menu From Lang To Config
Reply With Quote #6

Quote:
Originally Posted by OciXCrom View Post
0) The entire file is MISSING.
I think that gives "ML_NOT_FOUND" IIRC.
__________________
fysiks is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-04-2018 , 16:22   Re: Kick Menu From Lang To Config
Reply With Quote #7

Quote:
Originally Posted by fysiks View Post
I think that gives "ML_NOT_FOUND" IIRC.
That's exactly what I'm talking about. ML_ERROR doesn't even exist.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-04-2018 , 16:23   Re: Kick Menu From Lang To Config
Reply With Quote #8

Quote:
Originally Posted by OciXCrom View Post
That's exactly what I'm talking about. ML_ERROR doesn't even exist.
Ah, Ok.
__________________
fysiks is offline
Alber9091
Veteran Member
Join Date: Jun 2014
Location: Karachi, Pakistan
Old 03-05-2018 , 14:23   Re: Kick Menu From Lang To Config
Reply With Quote #9

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)

Last edited by Alber9091; 03-05-2018 at 14:24.
Alber9091 is offline
sanimare
Senior Member
Join Date: Sep 2010
Old 03-05-2018 , 19:00   Re: Kick Menu From Lang To Config
Reply With Quote #10

Quote:
Originally Posted by Alber9091 View Post
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
sanimare 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 09:09.


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