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

Color on the menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
james 007
Member
Join Date: Dec 2014
Location: Portugal
Old 07-12-2016 , 17:58   Color on the menu
Reply With Quote #1

Delete Post

Last edited by james 007; 09-20-2016 at 14:58.
james 007 is offline
james 007
Member
Join Date: Dec 2014
Location: Portugal
Old 07-21-2016 , 11:59   Re: Color on the menu
Reply With Quote #2

delete post

Last edited by james 007; 09-20-2016 at 14:58.
james 007 is offline
7thSense
Member
Join Date: Jul 2016
Old 07-24-2016 , 13:37   Re: Color on the menu
Reply With Quote #3

plmenu
PHP Code:
#include <amxmodx>
#include <amxmisc>

#define AMXMODX_NOAUTOLOAD
#include <cstrike>

new g_menuPosition[33]
new 
g_menuPlayers[33][32]
new 
g_menuPlayersNum[33]
new 
g_menuOption[33]
new 
g_menuSettings[33]

new 
g_menuSelect[33][64]
new 
g_menuSelectNum[33]

#define MAX_CLCMDS 24

new g_clcmdName[MAX_CLCMDS][32]
new 
g_clcmdCmd[MAX_CLCMDS][64]
new 
g_clcmdMisc[MAX_CLCMDS][2]
new 
g_clcmdNum

new g_coloredMenus
new g_cstrike 0

new Array:g_bantimes;
new Array:
g_slapsettings;

new 
g_CSTeamNames[3][] = {
    
"TERRORIST",
    
"CT",
    
"SPECTATOR"
}
new 
g_CSTeamNumbers[3][] = {
    
"1",
    
"2",
    
"6"
}
new 
g_CSTeamiNumbers[3] = {
    
1,
    
2,
    
6
}

#define NORMAL DontChange 
#define GREEN DontChange 
#define TEAM_COLOR DontChange 
#define RED Red 
#define BLUE Blue 
#define GREY Grey 
#define ColorChat client_print_color 

enum _:Colors 
    
DontChange
    
Red
    
Blue
    
Grey 


stock const g_szTeamName[Colors][] =  

    
"UNASSIGNED"
    
"TERRORIST"
    
"CT"
    
"SPECTATOR" 


public 
plugin_natives()
{
    
set_module_filter("module_filter")
    
set_native_filter("native_filter")
}

public 
plugin_init()
{
    
register_plugin("Players Menu"AMXX_VERSION_STR"AMXX Dev Team")
    
register_dictionary("common.txt")
    
register_dictionary_colored("admincmd.txt")
    
register_dictionary_colored("plmenu.txt")

    
register_clcmd("amx_kickmenu""cmdKickMenu"ADMIN_KICK"- displays kick menu")
    
register_clcmd("amx_banmenu""cmdBanMenu"ADMIN_BAN"- displays ban menu")
    
register_clcmd("amx_slapmenu""cmdSlapMenu"ADMIN_SLAY"- displays slap/slay menu")
    
register_clcmd("amx_teammenu""cmdTeamMenu"ADMIN_LEVEL_A"- displays team menu")
    
register_clcmd("amx_clcmdmenu""cmdClcmdMenu"ADMIN_LEVEL_A"- displays client cmds menu")

    
register_menucmd(register_menuid("Ban Menu"), 1023"actionBanMenu")
    
register_menucmd(register_menuid("Kick Menu"), 1023"actionKickMenu")
    
register_menucmd(register_menuid("Slap/Slay Menu"), 1023"actionSlapMenu")
    
register_menucmd(register_menuid("Team Menu"), 1023"actionTeamMenu")
    
register_menucmd(register_menuid("Client Cmds Menu"), 1023"actionClcmdMenu")
    
    
    
g_bantimes ArrayCreate();

    
ArrayPushCell(g_bantimes0);
    
ArrayPushCell(g_bantimes5);
    
ArrayPushCell(g_bantimes10);
    
ArrayPushCell(g_bantimes15);
    
ArrayPushCell(g_bantimes30);
    
ArrayPushCell(g_bantimes45);
    
ArrayPushCell(g_bantimes60);
    
    
    
g_slapsettings ArrayCreate();

    
ArrayPushCell(g_slapsettings0); 
    
ArrayPushCell(g_slapsettings0); 
    
ArrayPushCell(g_slapsettings1);
    
ArrayPushCell(g_slapsettings5);
    
    
    
register_srvcmd("amx_plmenu_bantimes""plmenu_setbantimes");
    
register_srvcmd("amx_plmenu_slapdmg""plmenu_setslapdmg");

    
g_coloredMenus colored_menus()

    new 
clcmds_ini_file[64]
    
get_configsdir(clcmds_ini_file63)
    
format(clcmds_ini_file63"%s/clcmds.ini"clcmds_ini_file)
    
load_settings(clcmds_ini_file)

    if (
module_exists("cstrike"))
        
g_cstrike 1
}
public 
plmenu_setbantimes()
{
    new 
buff[32];
    new 
args read_argc();
    
    if (
args <= 1)
    {
        
server_print("usage: amx_plmenu_bantimes <time1> [time2] [time3] ...");
        
server_print("   use time of 0 for permanent.");
        
        return;
    }
    
    
ArrayClear(g_bantimes);
    
    for (new 
1argsi++)
    {
        
read_argv(ibuffcharsmax(buff));
        
        
ArrayPushCell(g_bantimesstr_to_num(buff));
        
    }
    
}
public 
plmenu_setslapdmg()
{
    new 
buff[32];
    new 
args read_argc();
    
    if (
args <= 1)
    {
        
server_print("usage: amx_plmenu_slapdmg <dmg1> [dmg2] [dmg3] ...");
        
server_print("   slay is automatically set for the first value.");
        
        return;
    }
    
    
ArrayClear(g_slapsettings);
    
    
ArrayPushCell(g_slapsettings0); 
    
    for (new 
1argsi++)
    {
        
read_argv(ibuffcharsmax(buff));
        
        
ArrayPushCell(g_slapsettingsstr_to_num(buff));
    }
    
}
public 
module_filter(const module[])
{
    if (
equali(module"cstrike"))
        return 
PLUGIN_HANDLED
    
    
return PLUGIN_CONTINUE
}

public 
native_filter(const name[], indextrap)
{
    if (!
trap)
        return 
PLUGIN_HANDLED
        
    
return PLUGIN_CONTINUE
}

public 
actionBanMenu(idkey)
{
    switch (
key)
    {
        case 
7:
        {
            ++
g_menuOption[id]
            
g_menuOption[id] %= ArraySize(g_bantimes);

            
g_menuSettings[id] = ArrayGetCell(g_bantimesg_menuOption[id]);

            
displayBanMenu(idg_menuPosition[id])
        }
        case 
8displayBanMenu(id, ++g_menuPosition[id])
        case 
9displayBanMenu(id, --g_menuPosition[id])
        default:
        {
            new 
player g_menuPlayers[id][g_menuPosition[id] * key]
            new 
name[32], name2[32], authid[32], authid2[32]
        
            
get_user_name(playername231)
            
get_user_authid(idauthid31)
            
get_user_authid(playerauthid231)
            
get_user_name(idname31)
            
            new 
userid2 get_user_userid(player)

            
log_amx("Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%d^")"nameget_user_userid(id), authidname2userid2authid2g_menuSettings[id])

            if (
g_menuSettings[id]==0
            {
                new 
maxpl get_maxplayers();
                for (new 
1<= maxpli++)
                {
                    
show_activity_id(iidname"%L %s %L"i"BAN"name2i"PERM");
                }
            }
            else
            {
                new 
tempTime[32];
                
formatex(tempTime,sizeof(tempTime)-1,"%d",g_menuSettings[id]);
                new 
maxpl get_maxplayers();
                for (new 
1<= maxpli++)
                {
                    
show_activity_id(iidname"%L %s %L"i"BAN"name2i"FOR_MIN"tempTime);
                }
            }
            
/* ---------- check for Steam ID added by MistaGee -------------------- 
            IF AUTHID == 4294967295 OR VALVE_ID_LAN OR HLTV, BAN PER IP TO NOT BAN EVERYONE */
            
            
if (equal("4294967295"authid2)
                || 
equal("HLTV"authid2)
                || 
equal("STEAM_ID_LAN"authid2)
                || 
equali("VALVE_ID_LAN"authid2))
            {
                new 
ipa[32]
                
get_user_ip(playeripa311)
                
                
server_cmd("addip %d %s;writeip"g_menuSettings[id], ipa)
            }
            else
            {
                
server_cmd("banid %d #%d kick;writeid"g_menuSettings[id], userid2)
            }

            
server_exec()

            
displayBanMenu(idg_menuPosition[id])
        }
    }
    
    return 
PLUGIN_HANDLED
}

displayBanMenu(idpos)
{
    if (
pos 0)
        return

    
get_players(g_menuPlayers[id], g_menuPlayersNum[id])

    new 
menuBody[512]
    new 
0
    
new i
    
new name[32]
    new 
start pos 7

    
if (start >= g_menuPlayersNum[id])
        
start pos g_menuPosition[id] = 0

    
new len format(menuBody511g_coloredMenus "\y%L\R%d/%d^n\w^n" "%L %d/%d^n^n"id"BAN_MENU"pos 1, (g_menuPlayersNum[id] / + ((g_menuPlayersNum[id] % 7) ? 0)))
    new 
end start 7
    
new keys MENU_KEY_0|MENU_KEY_8

    
if (end g_menuPlayersNum[id])
        
end g_menuPlayersNum[id]

    for (new 
startend; ++a)
    {
        
g_menuPlayers[id][a]
        
get_user_name(iname31)

        if (
is_user_bot(i) || (access(iADMIN_IMMUNITY) && != id))
        {
            ++
b
            
            
if (g_coloredMenus)
                
len += format(menuBody[len], 511-len"\d%d. %s^n\w"bname)
            else
                
len += format(menuBody[len], 511-len"#. %s^n"name)
        } else {
            
keys |= (1<<b)
                
            if (
is_user_admin(i))
                
len += format(menuBody[len], 511-leng_coloredMenus "%d. %s \r*^n\w" "%d. %s *^n", ++bname)
            else
                
len += format(menuBody[len], 511-len"%d. %s^n", ++bname)
        }
    }

    if (
g_menuSettings[id])
        
len += format(menuBody[len], 511-len"^n8. %L^n"id"BAN_FOR_MIN"g_menuSettings[id])
    else
        
len += format(menuBody[len], 511-len"^n8. %L^n"id"BAN_PERM")

    if (
end != g_menuPlayersNum[id])
    {
        
format(menuBody[len], 511-len"^n9. %L...^n0. %L"id"MORE"idpos "BACK" "EXIT")
        
keys |= MENU_KEY_9
    
}
    else
        
format(menuBody[len], 511-len"^n0. %L"idpos "BACK" "EXIT")

    
show_menu(idkeysmenuBody, -1"Ban Menu")
}

public 
cmdBanMenu(idlevelcid)
{
    if (!
cmd_access(idlevelcid1))
        return 
PLUGIN_HANDLED

    g_menuOption
[id] = 0
    
    
if (ArraySize(g_bantimes) > 0)
    {
        
g_menuSettings[id] = ArrayGetCell(g_bantimesg_menuOption[id]);
    }
    else
    {
        
// should never happen, but failsafe
        
g_menuSettings[id] = 0
    
}
    
displayBanMenu(idg_menuPosition[id] = 0)

    return 
PLUGIN_HANDLED
}

public 
actionSlapMenu(idkey)
{
    switch (
key)
    {
        case 
7:
        {
            ++
g_menuOption[id]
            
            
g_menuOption[id] %= ArraySize(g_slapsettings);
            
            
g_menuSettings[id] = ArrayGetCell(g_slapsettingsg_menuOption[id]);
            
            
displaySlapMenu(idg_menuPosition[id]);
        }
        case 
8displaySlapMenu(id, ++g_menuPosition[id])
        case 
9displaySlapMenu(id, --g_menuPosition[id])
        default:
        {
            new 
player g_menuPlayers[id][g_menuPosition[id] * key]
            new 
name2[32]
            
            
get_user_name(playername231)

            if (!
is_user_alive(player))
            {
                
client_print(idprint_chat"%L"id"CANT_PERF_DEAD"name2)
                
displaySlapMenu(idg_menuPosition[id])
                return 
PLUGIN_HANDLED
            
}

            new 
authid[32], authid2[32], name[32]

            
get_user_authid(idauthid31)
            
get_user_authid(playerauthid231)
            
get_user_name(idname31)

            if (
g_menuOption[id])
            {
                
log_amx("Cmd: ^"%s<%d><%s><>^" slap with %d damage ^"%s<%d><%s><>^""nameget_user_userid(id), authidg_menuSettings[id], name2get_user_userid(player), authid2)

                switch (
get_cvar_num("amx_show_activity"))
                {
                    case 
2client_print_color(0DontChange"%L"LANG_PLAYER"ADMIN_SLAP_2"namename2g_menuSettings[id])
                    case 
1client_print_color(0DontChange"%L"LANG_PLAYER"ADMIN_SLAP_1"name2g_menuSettings[id])
                }

            } else {
                
log_amx("Cmd: ^"%s<%d><%s><>^" slay ^"%s<%d><%s><>^""nameget_user_userid(id), authidname2get_user_userid(player), authid2)
                
                switch (
get_cvar_num("amx_show_activity"))
                {
                    case 
2client_print_color(0DontChange"%L"LANG_PLAYER"ADMIN_SLAY_2"namename2)
                    case 
1client_print_color(0DontChange"%L"LANG_PLAYER"ADMIN_SLAY_1"name2)
                }

            }

            if (
g_menuOption[id])
                
user_slap(player, (get_user_health(player) > g_menuSettings[id]) ? g_menuSettings[id] : 0)
            else
                
user_kill(player)

            
displaySlapMenu(idg_menuPosition[id])
        }
    }
    
    return 
PLUGIN_HANDLED
}

displaySlapMenu(idpos)
{
    if (
pos 0)
        return

    
get_players(g_menuPlayers[id], g_menuPlayersNum[id])

    new 
menuBody[512]
    new 
0
    
new i
    
new name[32], team[4]
    new 
start pos 7

    
if (start >= g_menuPlayersNum[id])
        
start pos g_menuPosition[id] = 0

    
new len format(menuBody511g_coloredMenus "\y%L\R%d/%d^n\w^n" "%L %d/%d^n^n"id"SLAP_SLAY_MENU"pos 1, (g_menuPlayersNum[id] / + ((g_menuPlayersNum[id] % 7) ? 0)))
    new 
end start 7
    
new keys MENU_KEY_0|MENU_KEY_8

    
if (end g_menuPlayersNum[id])
        
end g_menuPlayersNum[id]

    for (new 
startend; ++a)
    {
        
g_menuPlayers[id][a]
        
get_user_name(iname31)
        
        if (
g_cstrike)
        {
            if (
cs_get_user_team(i) == CS_TEAM_T)
            {
                
copy(team3"TE")
            }
            else if (
cs_get_user_team(i) == CS_TEAM_CT)
            {
                
copy(team3"CT")
            } else {
                
get_user_team(iteam3)
            }
        } else {
            
get_user_team(iteam3)
        }

        if (!
is_user_alive(i) || (access(iADMIN_IMMUNITY) && != id))
        {
            ++
b
        
            
if (g_coloredMenus)
                
len += format(menuBody[len], 511-len"\d%d. %s\R%s^n\w"bnameteam)
            else
                
len += format(menuBody[len], 511-len"#. %s   %s^n"nameteam)        
        } else {
            
keys |= (1<<b)
                
            if (
is_user_admin(i))
                
len += format(menuBody[len], 511-leng_coloredMenus "%d. %s \r*\y\R%s^n\w" "%d. %s *   %s^n", ++bnameteam)
            else
                
len += format(menuBody[len], 511-leng_coloredMenus "%d. %s\y\R%s^n\w" "%d. %s   %s^n", ++bnameteam)
        }
    }

    if (
g_menuOption[id])
        
len += format(menuBody[len], 511-len"^n8. %L^n"id"SLAP_WITH_DMG"g_menuSettings[id])
    else
        
len += format(menuBody[len], 511-len"^n8. %L^n"id"SLAY")

    if (
end != g_menuPlayersNum[id])
    {
        
format(menuBody[len], 511-len"^n9. %L...^n0. %L"id"MORE"idpos "BACK" "EXIT")
        
keys |= MENU_KEY_9
    
}
    else
        
format(menuBody[len], 511-len"^n0. %L"idpos "BACK" "EXIT")

    
show_menu(idkeysmenuBody, -1"Slap/Slay Menu")
}

public 
cmdSlapMenu(idlevelcid)
{
    if (!
cmd_access(idlevelcid1))
        return 
PLUGIN_HANDLED

    g_menuOption
[id] = 0
    
if (ArraySize(g_slapsettings) > 0)
    {
        
g_menuSettings[id] = ArrayGetCell(g_slapsettingsg_menuOption[id]);
    }
    else
    {
        
g_menuSettings[id] = 0
    
}

    
displaySlapMenu(idg_menuPosition[id] = 0)

    return 
PLUGIN_HANDLED
}

public 
actionKickMenu(idkey)
{
    switch (
key)
    {
        case 
8displayKickMenu(id, ++g_menuPosition[id])
        case 
9displayKickMenu(id, --g_menuPosition[id])
        default:
        {
            new 
player g_menuPlayers[id][g_menuPosition[id] * key]
            new 
authid[32], authid2[32], name[32], name2[32]
            
            
get_user_authid(idauthid31)
            
get_user_authid(playerauthid231)
            
get_user_name(idname31)
            
get_user_name(playername231)
            
            new 
userid2 get_user_userid(player)

            
log_amx("Kick: ^"%s<%d><%s><>^" kick ^"%s<%d><%s><>^""nameget_user_userid(id), authidname2userid2authid2)

            switch (
get_cvar_num("amx_show_activity"))
            {
                case 
2client_print_color(0DontChange"%L"LANG_PLAYER"ADMIN_KICK_2"namename2)
                case 
1client_print_color(0DontChange"%L"LANG_PLAYER"ADMIN_KICK_1"name2)
            }
    
            
server_cmd("kick #%d"userid2)
            
server_exec()

            
displayKickMenu(idg_menuPosition[id])
        }
    }

    return 
PLUGIN_HANDLED
}

displayKickMenu(idpos)
{
    if (
pos 0)
        return

    
get_players(g_menuPlayers[id], g_menuPlayersNum[id])

    new 
menuBody[512]
    new 
0
    
new i
    
new name[32]
    new 
start pos 8

    
if (start >= g_menuPlayersNum[id])
        
start pos g_menuPosition[id] = 0

    
new len format(menuBody511g_coloredMenus "\y%L\R%d/%d^n\w^n" "%L %d/%d^n^n"id"KICK_MENU"pos 1, (g_menuPlayersNum[id] / + ((g_menuPlayersNum[id] % 8) ? 0)))
    new 
end start 8
    
new keys MENU_KEY_0

    
if (end g_menuPlayersNum[id])
        
end g_menuPlayersNum[id]

    for (new 
startend; ++a)
    {
        
g_menuPlayers[id][a]
        
get_user_name(iname31)

        if (
access(iADMIN_IMMUNITY) && != id)
        {
            ++
b
        
            
if (g_coloredMenus)
                
len += format(menuBody[len], 511-len"\d%d. %s^n\w"bname)
            else
                
len += format(menuBody[len], 511-len"#. %s^n"name)
        } else {
            
keys |= (1<<b)
                
            if (
is_user_admin(i))
                
len += format(menuBody[len], 511-leng_coloredMenus "%d. %s \r*^n\w" "%d. %s *^n", ++bname)
            else
                
len += format(menuBody[len], 511-len"%d. %s^n", ++bname)
        }
    }

    if (
end != g_menuPlayersNum[id])
    {
        
format(menuBody[len], 511-len"^n9. %L...^n0. %L"id"MORE"idpos "BACK" "EXIT")
        
keys |= MENU_KEY_9
    
}
    else
        
format(menuBody[len], 511-len"^n0. %L"idpos "BACK" "EXIT")

    
show_menu(idkeysmenuBody, -1"Kick Menu")
}

public 
cmdKickMenu(idlevelcid)
{
    if (
cmd_access(idlevelcid1))
        
displayKickMenu(idg_menuPosition[id] = 0)

    return 
PLUGIN_HANDLED
}

public 
actionTeamMenu(idkey)
{
    switch (
key)
    {
        case 
7:
        {
            
g_menuOption[id] = (g_menuOption[id] + 1) % (g_cstrike 2);
            
displayTeamMenu(idg_menuPosition[id])
        }
        case 
8displayTeamMenu(id, ++g_menuPosition[id])
        case 
9displayTeamMenu(id, --g_menuPosition[id])
        default:
        {
            new 
player g_menuPlayers[id][g_menuPosition[id] * key]
            new 
authid[32], authid2[32], name[32], name2[32]

            
get_user_name(playername231)
            
get_user_authid(idauthid31)
            
get_user_authid(playerauthid231)
            
get_user_name(idname31)
                
            
log_amx("Cmd: ^"%s<%d><%s><>^" transfer ^"%s<%d><%s><>^" (team ^"%s^")"nameget_user_userid(id), authidname2get_user_userid(player), authid2g_menuOption[id] ? "TERRORIST" "CT")

            switch (
get_cvar_num("amx_show_activity"))
            {
                case 
2client_print_color(0DontChange"%L"LANG_PLAYER"ADMIN_TRANSF_2"namename2g_CSTeamNames[g_menuOption[id] % 3])
                case 
1client_print_color(0DontChange"%L"LANG_PLAYER"ADMIN_TRANSF_1"name2g_CSTeamNames[g_menuOption[id] % 3])
            }

            if (
g_cstrike)
            {
                if (
is_user_alive(player))
                {
                    new 
deaths cs_get_user_deaths(player)
                    
user_kill(player1)
                    
cs_set_user_deaths(playerdeaths)
                }

                
cs_set_user_team(player, (g_menuOption[id] % 3) + 1)
                
cs_reset_user_model(player)
            } else {
                new 
limit_setting get_cvar_num("mp_limitteams")
                
                
set_cvar_num("mp_limitteams"0)
                
engclient_cmd(player"jointeam"g_CSTeamNumbers[g_menuOption[id] % 2])
                
engclient_cmd(player"joinclass""1")
                
set_cvar_num("mp_limitteams"limit_setting)
            }

            
displayTeamMenu(idg_menuPosition[id])
        }
    }
    return 
PLUGIN_HANDLED
}

displayTeamMenu(idpos)
{
    if (
pos 0)
        return

    
get_players(g_menuPlayers[id], g_menuPlayersNum[id])

    new 
menuBody[512]
    new 
0
    
new iiteam
    
new name[32], team[4]
    new 
start pos 7

    
if (start >= g_menuPlayersNum[id])
        
start pos g_menuPosition[id] = 0

    
new len format(menuBody511g_coloredMenus "\y%L\R%d/%d^n\w^n" "%L %d/%d^n^n"id"TEAM_MENU"pos 1, (g_menuPlayersNum[id] / + ((g_menuPlayersNum[id] % 7) ? 0)))
    new 
end start 7
    
new keys MENU_KEY_0|MENU_KEY_8

    
if (end g_menuPlayersNum[id])
        
end g_menuPlayersNum[id]

    for (new 
startend; ++a)
    {
        
g_menuPlayers[id][a]
        
get_user_name(iname31)
        
        if (
g_cstrike)
        {
            
iteam _:cs_get_user_team(i)
            
            if (
iteam == 1)
            {
                
copy(team3"TE")
            }
            else if (
iteam == 2)
            {
                
copy(team3"CT")
            }
            else if (
iteam == 3)
            {
                
copy(team3"SPE");
                
iteam 6;
            } else {
                
iteam get_user_team(iteam3)
            }
        } else {
            
iteam get_user_team(iteam3)
        }

        if ((
iteam == g_CSTeamiNumbers[g_menuOption[id] % (g_cstrike 2)]) || (access(iADMIN_IMMUNITY) && != id))
        {
            ++
b
            
            
if (g_coloredMenus)
                
len += format(menuBody[len], 511-len"\d%d. %s\R%s^n\w"bnameteam)
            else
                
len += format(menuBody[len], 511-len"#. %s   %s^n"nameteam)        
        } else {
            
keys |= (1<<b)
                
            if (
is_user_admin(i))
                
len += format(menuBody[len], 511-leng_coloredMenus "%d. %s \r*\y\R%s^n\w" "%d. %s *   %s^n", ++bnameteam)
            else
                
len += format(menuBody[len], 511-leng_coloredMenus "%d. %s\y\R%s^n\w" "%d. %s   %s^n", ++bnameteam)
        }
    }

    
len += format(menuBody[len], 511-len"^n8. %L^n"id"TRANSF_TO"g_CSTeamNames[g_menuOption[id] % (g_cstrike 2)])

    if (
end != g_menuPlayersNum[id])
    {
        
format(menuBody[len], 511-len"^n9. %L...^n0. %L"id"MORE"idpos "BACK" "EXIT")
        
keys |= MENU_KEY_9
    
}
    else
        
format(menuBody[len], 511-len"^n0. %L"idpos "BACK" "EXIT")

    
show_menu(idkeysmenuBody, -1"Team Menu")
}

public 
cmdTeamMenu(idlevelcid)
{
    if (!
cmd_access(idlevelcid1))
        return 
PLUGIN_HANDLED

    g_menuOption
[id] = 0

    displayTeamMenu
(idg_menuPosition[id] = 0)

    return 
PLUGIN_HANDLED
}

public 
actionClcmdMenu(idkey)
{
    switch (
key)
    {
        case 
7:
        {
            ++
g_menuOption[id]
            
g_menuOption[id] %= g_menuSelectNum[id]
            
displayClcmdMenu(idg_menuPosition[id])
        }
        case 
8displayClcmdMenu(id, ++g_menuPosition[id])
        case 
9displayClcmdMenu(id, --g_menuPosition[id])
        default:
        {
            new 
player g_menuPlayers[id][g_menuPosition[id] * key]
            new 
flags g_clcmdMisc[g_menuSelect[id][g_menuOption[id]]][1]
            
            if (
is_user_connected(player))
            {
                new 
command[512], authid[32], name[32], userid[32]
                
                
copy(commandcharsmax(command), g_clcmdCmd[g_menuSelect[id][g_menuOption[id]]])
                
get_user_authid(playerauthid31)
                
get_user_name(playername31)
                
num_to_str(get_user_userid(player), userid31)
                
                
replace(commandcharsmax(command), "%userid%"userid)
                
replace(commandcharsmax(command), "%authid%"authid)
                
replace(commandcharsmax(command), "%name%"name)
                
                if (
flags 1)
                {
                    
server_cmd("%s"command)
                    
server_exec()
                } else if (
flags 2)
                    
client_cmd(id"%s"command)
                else if (
flags 4)
                    
client_cmd(player"%s"command)
            }
            
            if (
flags 8)
                
displayClcmdMenu(idg_menuPosition[id])
        }
    }
    
    return 
PLUGIN_HANDLED
}

displayClcmdMenu(idpos)
{
    if (
pos 0)
        return

    
get_players(g_menuPlayers[id], g_menuPlayersNum[id])

    new 
menuBody[512]
    new 
0
    
new i
    
new name[32]
    new 
start pos 7

    
if (start >= g_menuPlayersNum[id])
        
start pos g_menuPosition[id] = 0

    
new len format(menuBody511g_coloredMenus "\y%L\R%d/%d^n\w^n" "%L %d/%d^n^n"id"CL_CMD_MENU"pos 1, (g_menuPlayersNum[id] / + ((g_menuPlayersNum[id] % 7) ? 0)))
    new 
end start 7
    
new keys MENU_KEY_0|MENU_KEY_8

    
if (end g_menuPlayersNum[id])
        
end g_menuPlayersNum[id]

    for (new 
startend; ++a)
    {
        
g_menuPlayers[id][a]
        
get_user_name(iname31)

        if (!
g_menuSelectNum[id] || (access(iADMIN_IMMUNITY) && != id))
        {
            ++
b
            
            
if (g_coloredMenus)
                
len += format(menuBody[len], 511-len"\d%d. %s^n\w"bname)
            else
                
len += format(menuBody[len], 511-len"#. %s^n"name)        
        } else {
            
keys |= (1<<b)
                
            if (
is_user_admin(i))
                
len += format(menuBody[len], 511-leng_coloredMenus "%d. %s \r*^n\w" "%d. %s *^n", ++bname)
            else
                
len += format(menuBody[len], 511-len"%d. %s^n", ++bname)
        }
    }

    if (
g_menuSelectNum[id])
        
len += format(menuBody[len], 511-len"^n8. %s^n"g_clcmdName[g_menuSelect[id][g_menuOption[id]]])
    else
        
len += format(menuBody[len], 511-len"^n8. %L^n"id"NO_CMDS")

    if (
end != g_menuPlayersNum[id])
    {
        
format(menuBody[len], 511-len"^n9. %L...^n0. %L"id"MORE"idpos "BACK" "EXIT")
        
keys |= MENU_KEY_9
    
}
    else
        
format(menuBody[len], 511-len"^n0. %L"idpos "BACK" "EXIT")

    
show_menu(idkeysmenuBody, -1"Client Cmds Menu")
}

public 
cmdClcmdMenu(idlevelcid)
{
    if (!
cmd_access(idlevelcid1))
        return 
PLUGIN_HANDLED

    g_menuSelectNum
[id] = 0

    
for (new 0g_clcmdNum; ++a)
        if (
access(idg_clcmdMisc[a][0]))
            
g_menuSelect[id][g_menuSelectNum[id]++] = a

    g_menuOption
[id] = 0

    displayClcmdMenu
(idg_menuPosition[id] = 0)

    return 
PLUGIN_HANDLED
}

load_settings(szFilename[])
{
    if (!
file_exists(szFilename))
        return 
0

    
new text[256], szFlags[32], szAccess[32]
    new 
apos 0

    
while (g_clcmdNum MAX_CLCMDS && read_file(szFilenamepos++, text255a))
    {
        if (
text[0] == ';') continue

        if (
parse(textg_clcmdName[g_clcmdNum], 31g_clcmdCmd[g_clcmdNum], 63szFlags31szAccess31) > 3)
        {
            while (
replace(g_clcmdCmd[g_clcmdNum], 63"\'""^""))
            {

            }

            g_clcmdMisc[g_clcmdNum][1] = read_flags(szFlags)
            g_clcmdMisc[g_clcmdNum][0] = read_flags(szAccess)
            g_clcmdNum++
        }
    }
        return 1
}

stock client_print_color(id, iColor=DontChange, const szMsg[], any:...) 

    if( id && !is_user_connected(id) ) 
    { 
        return 0; 
    } 

    if( iColor > Grey ) 
    { 
        iColor = DontChange; 
    } 

    new szMessage[192]; 
    if( iColor == DontChange ) 
    { 
        szMessage[0] = 0x04; 
    } 
    else 
    { 
        szMessage[0] = 0x03; 
    } 

    new iParams = numargs(); 

    if(id) 
    { 
        if( iParams == 3 ) 
        { 
            copy(szMessage[1], charsmax(szMessage)-1, szMsg); 
        } 
        else 
        { 
            vformat(szMessage[1], charsmax(szMessage)-1, szMsg, 4); 
        } 

        if( iColor ) 
        { 
            new szTeam[11]; 
            get_user_team(id, szTeam, charsmax(szTeam)); 

            Send_TeamInfo(id, id, g_szTeamName[iColor]); 

            Send_SayText(id, id, szMessage); 

            Send_TeamInfo(id, id, szTeam); 
        } 
        else 
        { 
            Send_SayText(id, id, szMessage); 
        } 
    }  

    else 
    { 
        new iPlayers[32], iNum; 
        get_players(iPlayers, iNum, "
ch"); 
        if( !iNum ) 
        { 
            return 0; 
        } 

        new iFool = iPlayers[0]; 

        new iMlNumber, i, j; 
        new Array:aStoreML = ArrayCreate(); 
        if( iParams >= 5 ) 
        { 
            for(j=4; j<iParams; j++) 
            { 
                if( getarg(j) == LANG_PLAYER ) 
                { 
                    i=0; 
                    while( ( szMessage[ i ] = getarg( j + 1, i++ ) ) ) {} 
                    if( GetLangTransKey(szMessage) != TransKey_Bad ) 
                    { 
                        ArrayPushCell(aStoreML, j++); 

                        iMlNumber++; 
                    } 
                } 
            } 
        } 
        if( !iMlNumber ) 
        { 
            if( iParams == 3 ) 
            { 
                copy(szMessage[1], charsmax(szMessage)-1, szMsg); 
            } 
            else 
            { 
                vformat(szMessage[1], charsmax(szMessage)-1, szMsg, 4); 
            } 

            if( iColor ) 
            { 
                new szTeam[11]; 
                get_user_team(iFool, szTeam, charsmax(szTeam)); 
                Send_TeamInfo(0, iFool, g_szTeamName[iColor]); 
                Send_SayText(0, iFool, szMessage); 
                Send_TeamInfo(0, iFool, szTeam); 
            } 
            else 
            { 
                Send_SayText(0, iFool, szMessage); 
            } 
        } 
        else 
        { 
            new szTeam[11], szFakeTeam[10]; 
             
            if( iColor ) 
            { 
                get_user_team(iFool, szTeam, charsmax(szTeam)); 
                copy(szFakeTeam, charsmax(szFakeTeam), g_szTeamName[iColor]); 
            } 

            for( i = 0; i < iNum; i++ ) 
            { 
                id = iPlayers[i]; 

                for(j=0; j<iMlNumber; j++) 
                { 
                    setarg(ArrayGetCell(aStoreML, j), _, id); 
                } 

                vformat(szMessage[1], charsmax(szMessage)-1, szMsg, 4); 

                if( iColor ) 
                { 
                    Send_TeamInfo(id, iFool, szFakeTeam); 
                    Send_SayText(id, iFool, szMessage); 
                    Send_TeamInfo(id, iFool, szTeam); 
                } 
                else 
                { 
                    Send_SayText(id, iFool, szMessage); 
                } 
            } 
            ArrayDestroy(aStoreML); 
        } 
    } 
    return 1; 


stock Send_TeamInfo(iReceiver, iPlayerId, szTeam[]) 

    static iTeamInfo = 0; 
    if( !iTeamInfo ) 
    { 
        iTeamInfo = get_user_msgid("
TeamInfo"); 
    } 
    message_begin(iReceiver ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, iTeamInfo, .player=iReceiver); 
    write_byte(iPlayerId); 
    write_string(szTeam); 
    message_end(); 


stock Send_SayText(iReceiver, iPlayerId, szMessage[]) 

    static iSayText = 0; 
    if( !iSayText ) 
    { 
        iSayText = get_user_msgid("
SayText"); 
    } 
    message_begin(iReceiver ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, iSayText, .player=iReceiver); 
    write_byte(iPlayerId); 
    write_string(szMessage); 
    message_end(); 


stock register_dictionary_colored(const filename[]) 

    if( !register_dictionary(filename) ) 
    { 
        return 0; 
    } 

    new szFileName[256]; 
    get_localinfo("
amxx_datadir", szFileName, charsmax(szFileName)); 
    format(szFileName, charsmax(szFileName), "
%s/lang/%s", szFileName, filename); 
    new fp = fopen(szFileName, "
rt"); 
    if( !fp ) 
    { 
        log_amx("
Failed to open %s", szFileName); 
        return 0; 
    } 

    new szBuffer[512], szLang[3], szKey[64], szTranslation[256], TransKey:iKey; 

    while( !feof(fp) ) 
    { 
        fgets(fp, szBuffer, charsmax(szBuffer)); 
        trim(szBuffer); 

        if( szBuffer[0] == '[' ) 
        { 
            strtok(szBuffer[1], szLang, charsmax(szLang), szBuffer, 1, ']'); 
        } 
        else if( szBuffer[0] ) 
        { 
            strbreak(szBuffer, szKey, charsmax(szKey), szTranslation, charsmax(szTranslation)); 
            iKey = GetLangTransKey(szKey); 
            if( iKey != TransKey_Bad ) 
            { 
                while( replace(szTranslation, charsmax(szTranslation), "
!g", "^4") ){} 
                while( replace(szTranslation, charsmax(szTranslation), "
!t", "^3") ){} 
                while( replace(szTranslation, charsmax(szTranslation), "
!n", "^1") ){} 
                AddTranslation(szLang, iKey, szTranslation[2]); 
            } 
        } 
    } 
     
    fclose(fp); 
    return 1; 

plmenu.txt
PHP Code:
[en]
ADMIN_BAN_1 = !n[!gADMIN!!t%s!n]: ban !t%s
ADMIN_BAN_2 
= !n[!gADMIN!!t%s!n]: ban !t%s
BAN_MENU 
Ban Menu
BAN_FOR_MIN 
Ban for %d minutes
BAN_PERM 
Ban permanently
SLAP_SLAY_MENU 
Slap/Slay Menu
SLAP_WITH_DMG 
Slap with %d damage
SLAY 
Slay
KICK_MENU 
Kick Menu
ADMIN_TRANSF_1 
= !n[!gADMIN!!t%s!n]: !ntransfer !t%!nto %s
ADMIN_TRANSF_2 
= !n[!gADMIN!!t%s!n]: !ntransfer !t%!nto %s
TEAM_MENU 
Team Menu
TRANSF_TO 
Transfer to %s
CL_CMD_MENU 
Client Cmds Menu
NO_CMDS 
No cmds available
ADMIN_BAN_PERM_1 
= !n[!gADMIN!!t%s!n]: !nban !t%!npermanently
ADMIN_BAN_PERM_2 
= !n[!gADMIN!!t%s!n]: !nban !t%!npermanently
ADMIN_BAN_FOR_MIN_1 
= !n[!gADMIN!!t%s!n]: !nban !t%!nfor %s min
ADMIN_BAN_FOR_MIN_2 
= !n[!gADMIN!!t%s!n]: !nban !t%!nfor %s min 
7thSense is offline
james 007
Member
Join Date: Dec 2014
Location: Portugal
Old 07-25-2016 , 08:10   Re: Color on the menu
Reply With Quote #4

delete post

Last edited by james 007; 09-20-2016 at 14:59.
james 007 is offline
7thSense
Member
Join Date: Jul 2016
Old 07-25-2016 , 08:41   Re: Color on the menu
Reply With Quote #5

Quote:
Originally Posted by james 007 View Post
no work
what does not work?
7thSense is offline
Old 07-27-2016, 19:18
james 007
This message has been deleted by james 007.
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 07-28-2016 , 05:20   Re: Color on the menu
Reply With Quote #6

7thSense, how do you even try to understand what he says?
siriusmd99 is offline
Old 10-07-2016, 10:11
james 007
This message has been deleted by james 007.
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 13:49.


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