add sm_b%d for bonuses and sm_s%d for stages

This commit is contained in:
rtldg 2021-03-11 02:02:56 +00:00
parent 16a8ba33d1
commit ad9581ce2e
2 changed files with 37 additions and 7 deletions

View File

@ -319,7 +319,6 @@ public void OnPluginStart()
gH_StyleCookie = RegClientCookie("shavit_style", "Style cookie", CookieAccess_Protected);
// timer start
RegConsoleCmd("sm_s", Command_StartTimer, "Start your timer.");
RegConsoleCmd("sm_start", Command_StartTimer, "Start your timer.");
RegConsoleCmd("sm_r", Command_StartTimer, "Start your timer.");
RegConsoleCmd("sm_restart", Command_StartTimer, "Start your timer.");
@ -327,6 +326,14 @@ public void OnPluginStart()
RegConsoleCmd("sm_b", Command_StartTimer, "Start your timer on the bonus track.");
RegConsoleCmd("sm_bonus", Command_StartTimer, "Start your timer on the bonus track.");
for (int i = Track_Bonus; i <= Track_Bonus_Last; i++)
{
char cmd[10], helptext[50];
FormatEx(cmd, sizeof(cmd), "sm_b%d", i);
FormatEx(helptext, sizeof(helptext), "Start your timer on the bonus %d track.", i);
RegConsoleCmd(cmd, Command_StartTimer, helptext);
}
// teleport to end
RegConsoleCmd("sm_end", Command_TeleportEnd, "Teleport to endzone.");
@ -608,7 +615,12 @@ public Action Command_StartTimer(int client, int args)
if(StrContains(sCommand, "sm_b", false) == 0)
{
if (args < 1)
// Pull out bonus number for commands like sm_b1 and sm_b2.
if ('1' <= sCommand[4] <= ('0' + Track_Bonus_Last))
{
track = sCommand[4] - '0';
}
else if (args < 1)
{
track = Shavit_GetClientTrack(client);
}

View File

@ -228,6 +228,15 @@ public void OnPluginStart()
RegConsoleCmd("sm_stages", Command_Stages, "Opens the stage menu. Usage: sm_stages [stage #]");
RegConsoleCmd("sm_stage", Command_Stages, "Opens the stage menu. Usage: sm_stage [stage #]");
RegConsoleCmd("sm_s", Command_Stages, "Opens the stage menu. Usage: sm_s [stage #]");
for (int i = 0; i <= 9; i++)
{
char cmd[10], helptext[50];
FormatEx(cmd, sizeof(cmd), "sm_s%d", i);
FormatEx(helptext, sizeof(helptext), "Go to stage %d", i);
RegConsoleCmd(cmd, Command_Stages, helptext);
}
// events
if(gEV_Type == Engine_TF2)
@ -1341,16 +1350,26 @@ public Action Command_Stages(int client, int args)
return Plugin_Handled;
}
if(args > 0)
int iStage = -1;
char sCommand[16];
GetCmdArg(0, sCommand, 16);
if ('0' <= sCommand[4] <= '9')
{
iStage = sCommand[4] - '0';
}
else if (args > 0)
{
char arg1[8];
GetCmdArg(1, arg1, 8);
iStage = StringToInt(arg1);
}
int iStage = StringToInt(arg1);
if (iStage > -1)
{
for(int i = 0; i < gI_MapZones; i++)
{
if(gA_ZoneCache[i].bZoneInitialized && gA_ZoneCache[i].iZoneData == iStage)
if(gA_ZoneCache[i].bZoneInitialized && gA_ZoneCache[i].iZoneType == Zone_Stage && gA_ZoneCache[i].iZoneData == iStage)
{
Shavit_StopTimer(client);
if(!EmptyVector(gV_Destinations[i]))
@ -1365,7 +1384,6 @@ public Action Command_Stages(int client, int args)
}
}
}
else
{
Menu menu = new Menu(MenuHandler_SelectStage);