Changed arg-less !spec to automatically forward to replay bot. (#574)

This commit is contained in:
shavit 2018-01-13 09:54:25 +02:00
parent 59b5664439
commit 03074283ab
2 changed files with 18 additions and 3 deletions

View File

@ -1178,19 +1178,29 @@ public Action Command_Spec(int client, int args)
CleanSwitchTeam(client, 1, false);
int target = -1;
if(args > 0)
{
char[] sArgs = new char[MAX_TARGET_LENGTH];
GetCmdArgString(sArgs, MAX_TARGET_LENGTH);
int iTarget = FindTarget(client, sArgs, false, false);
target = FindTarget(client, sArgs, false, false);
if(iTarget == -1)
if(target == -1)
{
return Plugin_Handled;
}
}
SetEntPropEnt(client, Prop_Send, "m_hObserverTarget", iTarget);
else if(gB_Replay)
{
target = Shavit_GetReplayBotIndex(0);
}
if(IsValidClient(target, true))
{
SetEntPropEnt(client, Prop_Send, "m_hObserverTarget", target);
}
return Plugin_Handled;

View File

@ -250,6 +250,11 @@ public int Native_GetReplayBotCurrentFrame(Handle handler, int numParams)
public int Native_GetReplayBotIndex(Handle handler, int numParams)
{
if(gB_CentralBot)
{
return gA_CentralCache[iCentralClient];
}
return gI_ReplayBotClient[GetNativeCell(1)];
}