View Single Post
LenHard
Senior Member
Join Date: Jan 2016
Old 05-24-2018 , 21:47   Re: Plugin to re-enable "changeteam" command in TF2.
Reply With Quote #4

Quote:
Originally Posted by StrikerMan780 View Post
I'll give it a shot. If you (or someone else) could extend that so the "changeteam" command pops up a radio menu allowing you to pick a team, that'd be great too.
PHP Code:
#include <sourcemod>

#pragma newdecls required
#pragma semicolon 1

public void OnPluginStart()
{
    
RegConsoleCmd("sm_team"Cmd_TeamMenu"Displays the team menu.");
}

public 
Action Cmd_TeamMenu(int clientint args)
{
    if (
client <= MaxClients && IsClientInGame(client))
    {
        
int iTeam GetClientTeam(client);
        
        
Menu hMenu = new Menu(Menu_Teams);
        
hMenu.SetTitle("Team Menu\n ");
        
hMenu.AddItem("""Spectator", (iTeam == 1)? ITEMDRAW_DISABLED:ITEMDRAW_DEFAULT);
        
hMenu.AddItem("""Red Team", (iTeam == 2)? ITEMDRAW_DISABLED:ITEMDRAW_DEFAULT);
        
hMenu.AddItem("""Blue Team", (iTeam == 3)? ITEMDRAW_DISABLED:ITEMDRAW_DEFAULT);
        
hMenu.Display(clientMENU_TIME_FOREVER);
    }
    return 
Plugin_Handled;
}

public 
int Menu_Teams(Menu hMenuMenuAction hActionint clientint iParam)
{
    switch (
hAction)
    {
        case 
MenuAction_Select:
        {
            if (
client <= MaxClients && IsClientInGame(client))
            {
                if (
GetClientTeam(client) != iParam 1)
                    
ChangeClientTeam(clientiParam 1);    
                else 
                    
PrintToChat(client"[SM] Why would you join your own team? (ノಠ益ಠ)ノ彡┻━┻");
            }
        }
        case 
MenuAction_Enddelete hMenu;
    }

__________________

Last edited by LenHard; 05-24-2018 at 21:58.
LenHard is offline