Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ if(CMAKE_BUILD_TYPE STREQUAL Release)
)
endif()

set(CMAKE_BUILD_TYPE RelWithDebInfo)

if(UNIX)
target_compile_definitions(TFTrue PRIVATE
GNUC
Expand Down
22 changes: 21 additions & 1 deletion TFTrue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
CTFTrue g_Plugin;
EXPOSE_SINGLE_INTERFACE_GLOBALVAR(CTFTrue, IServerPluginCallbacks, INTERFACEVERSION_ISERVERPLUGINCALLBACKS, g_Plugin )

ConVar tftrue_version("tftrue_version", "4.86", FCVAR_NOTIFY|FCVAR_CHEAT,
ConVar tftrue_version("tftrue_version", "4.88", FCVAR_NOTIFY|FCVAR_CHEAT,
"Version of the plugin.",
&CTFTrue::Version_Callback);
ConVar tftrue_gamedesc("tftrue_gamedesc", "", FCVAR_NONE,
Expand Down Expand Up @@ -303,7 +303,27 @@ void CTFTrue::GameFrame( bool simulating )

PLUGIN_RESULT CTFTrue::ClientCommand( edict_t *pEntity, const CCommand &args )
{
if (!pEntity)
{
return PLUGIN_CONTINUE;
}
int icl = IndexOfEdict(pEntity);
if (!icl)
{
return PLUGIN_CONTINUE;
}

IClient* pClient = g_pServer->GetClient(icl-1);
if (!pClient || !pClient->IsActive())
{
return PLUGIN_CONTINUE;
}

const char *cmd = args.Arg(0);
if (!cmd || strlen(cmd) < 1)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should you not be checking args.ArgC() instead?

{
return PLUGIN_CONTINUE;
}

if( Q_stricmp(cmd, "tftrue") == 0 )
{
Expand Down
34 changes: 25 additions & 9 deletions tournament.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ void CTournament::Status_Callback(ConCommand *pCmd, EDX const CCommand &args)
static ConVarRef mp_tournament("mp_tournament");
static ConVarRef tf_gamemode_mvm("tf_gamemode_mvm");

if(cmd_source && *cmd_source == 1)
if (cmd_source && *cmd_source == 1)
{
static ConCommand* plugin_print = g_pCVar->FindCommand("plugin_print");
plugin_print->Dispatch(CCommand());
Expand Down Expand Up @@ -566,17 +566,33 @@ void CTournament::Pause_Callback(ConCommand *pCmd, EDX const CCommand &args)
{
static ConVarRef sv_pausable("sv_pausable");

if(sv_pausable.GetBool() && *cmd_source == 0)
// *cmd_source = 0 when it's a client calling it
if (cmd_source && cmd_clientslot && sv_pausable.GetBool() && *cmd_source == 0)
{
// a little hacky but it works.
// client index
int icl = *cmd_clientslot + 1;

// client index = client slot + 1
int icl = *cmd_clientslot+1;
// let the engine handle the rest
IClient* pClient = g_pServer->GetClient(*cmd_clientslot);
edict_t* pEdict = EdictFromIndex(icl);
IPlayerInfo* pInfo = playerinfomanager->GetPlayerInfo(pEdict);
int iTeamNum = pInfo->GetTeamIndex();

// null or not active client
if (!pClient || !pClient->IsActive())
{
return;
}

edict_t* pEntity = EdictFromIndex(icl);
if (!pEntity)
{
return;
}

IPlayerInfo* pInfo = playerinfomanager->GetPlayerInfo(pEntity);
if (!pInfo)
{
return;
}

int iTeamNum = pInfo->GetTeamIndex();

char szTeamName[5];

Expand Down