Quote:
Originally Posted by StrikerMan780
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 client, int args)
{
if (0 < 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(client, MENU_TIME_FOREVER);
}
return Plugin_Handled;
}
public int Menu_Teams(Menu hMenu, MenuAction hAction, int client, int iParam)
{
switch (hAction)
{
case MenuAction_Select:
{
if (0 < client <= MaxClients && IsClientInGame(client))
{
if (GetClientTeam(client) != iParam + 1)
ChangeClientTeam(client, iParam + 1);
else
PrintToChat(client, "[SM] Why would you join your own team? (ノಠ益ಠ)ノ彡┻━┻");
}
}
case MenuAction_End: delete hMenu;
}
}
__________________