AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Plmenu [teammenu] (https://forums.alliedmods.net/showthread.php?t=295907)

ish12321 04-08-2017 05:31

Plmenu [teammenu]
 
PHP Code:

    switch (key)
    {
        case 
6
        {
            
g_silent[id] = !g_silent[id];
            
displayTeamMenu(idg_menuPosition[id]);
        }
        case 
7:
        {
            
g_menuOption[id] = (g_menuOption[id] + 1) % 3;
            
displayTeamMenu(idg_menuPosition[id]);
        }
        case 
8:
        {
            
displayTeamMenu(id, ++g_menuPosition[id]);
        }
        case 
9:
        {
            
displayTeamMenu(id, --g_menuPosition[id]);
        }
        default:
        {
            new 
player g_menuPlayers[id][g_menuPosition[id] * key];
            if (!
is_user_connected(player)) // dunno why this check hasn't be implemented in the past
            
{
                
displayTeamMenu(idg_menuPosition[id]);
                return 
PLUGIN_HANDLED;
            }

            
g_transferingAdmin id;

            new 
authid[32], authid2[32], name[MAX_NAME_LENGTH], name2[MAX_NAME_LENGTH];

            
get_user_name(playername2charsmax(name2));
            
get_user_authid(idauthidcharsmax(authid));
            
get_user_authid(playerauthid2charsmax(authid2));
            
get_user_name(idnamecharsmax(name));

            
// This modulo math just aligns the option to the CsTeams-corresponding number
            
new destTeamSlot = (g_menuOption[id] % 3);

            
log_amx("Cmd: ^"%s<%d><%s><>^" transfer ^"%s<%d><%s><>^" (team ^"%s^")"nameget_user_userid(id), authidname2get_user_userid(player), authid2g_CSTeamNames[destTeamSlot]);

            
show_activity_key("ADMIN_TRANSF_1""ADMIN_TRANSF_2"namename2g_CSTeamNames[destTeamSlot]);

            if (
destTeamSlot == 2)
            {
                if (
g_fakemeta)
                {
                    if (
get_pdata_int(playerm_iMenu) == Menu_ChooseAppearance)
                    {
                        
// works for both vgui and old style menus, and send menuselect could close other menus (and since get_user_menu fails to return VGUI and old style classes menus...)
                        
engclient_cmd(player"joinclass""6");
                    }
                }
                else 
// force
                
{
                    
engclient_cmd(player"joinclass""6");
                }
            }

            if (
g_CSPlayerCanSwitchFromSpec[player] && g_cstrike && (CS_TEAM_T <= cs_get_user_team(player) <= CS_TEAM_CT))
            {
                if (
is_user_alive(player) && (!g_silent[id] || destTeamSlot == 2))
                {
                    new 
deaths cs_get_user_deaths(player);
                    
user_kill(player1);
                    
cs_set_user_deaths(playerdeaths);
                }

                
cs_set_user_team(playerdestTeamSlot 1);

            }
            else
            {
                if (
is_user_alive(player) && (!g_silent[id] || destTeamSlot == 2))
                {
                    
user_kill(player1);
                }
                if (
g_fakemeta)
                {
                    
set_pdata_bool(playerm_bTeamChangedtrue);
                }
                new 
limit_setting;
                if (
mp_limitteams)
                {
                    
limit_setting get_pcvar_num(mp_limitteams);

                    
set_pcvar_num(mp_limitteams0);
                }

                if (
destTeamSlot == 2)
                {
                    new 
Float:allow_spectators_setting;
                    if (
allow_spectators)
                    {
                        
allow_spectators_setting get_pcvar_float(allow_spectators);
                        if (
allow_spectators_setting != 1.0)
                        {
                            
set_pcvar_float(allow_spectators1.0);
                        }
                    }
                    
engclient_cmd(player"jointeam"g_CSTeamNumbers[destTeamSlot]);
                    if (
allow_spectators && allow_spectators_setting != 1.0)
                    {
                        
set_pcvar_float(allow_spectatorsallow_spectators_setting);
                    }
                }
                else
                {
                    
engclient_cmd(player"jointeam"g_CSTeamNumbers[destTeamSlot]);
                    
engclient_cmd(player"joinclass""1");
                }
                if (
mp_limitteams && limit_setting != 0)
                {
                    
set_pcvar_num(mp_limitteamslimit_setting);
                }
            }
            if (
g_cstrike)
            {
                
cs_reset_user_model(player);
            }
            if (
g_fakemeta)
            {
                
set_pdata_bool(playerm_bTeamChangedtrue);
            }

            
g_transferingAdmin 0;
            
displayTeamMenu(idg_menuPosition[id]);
        }
    }

    return 
PLUGIN_HANDLED

This is the action teammenu part of plmenu of reamxmodx
In this on trasnferring to spec is going well (player kills and transferred) , transfer to ct and t is not going like this
please someone edit it to work like that

redivcram 04-08-2017 12:06

Re: Plmenu [teammenu]
 
Why complicate things? Why not just use a simple menu system and natives for transferring?

ish12321 04-08-2017 12:35

Re: Plmenu [teammenu]
 
This is default AMXX plugin ..
If I use a simple menu since this has all other menu's i will have to make all others too
Hence, that would be complicating and just modifying a single thing wouldn't be complicating things

redivcram 04-08-2017 12:50

Re: Plmenu [teammenu]
 
In that case... making a new plugin for managing the menu with the new menu system would be another solution, but you'd have to make and call natives in plmenu from the menu manager and vice versa.

ish12321 04-09-2017 06:54

Re: Plmenu [teammenu]
 
Quote:

Originally Posted by redivcram (Post 2510383)
In that case... making a new plugin for managing the menu with the new menu system would be another solution, but you'd have to make and call natives in plmenu from the menu manager and vice versa.

Yes, that would be an option but would be a long time work ?
Please could you if possible help me with me issue :)

ish12321 04-11-2017 15:31

Re: Plmenu [teammenu]
 
BUMP

Arkshine 04-11-2017 16:17

Re: Plmenu [teammenu]
 
If you mean the "silent" mode, yes, it's not going to do what you expect (It's just a straight team change and doing nothing else). Not sure why we have this because it's quite specific. It's planned to add an option to fully and properly transfer an alive player in AMXX.

ish12321 04-11-2017 17:49

Re: Plmenu [teammenu]
 
Edit : Solved


All times are GMT -4. The time now is 18:03.

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