It appears round_start is still too early as L4D_GetVersusMaxCompletionScore() reveals the score at that point is still 0 before I try to change it, which means it hasn't been set yet. And so it undoes anything I do at that stage.
I tried to rig L4D_SetVersusMaxCompletionScore() to a command as shown below:
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <left4dhooks>
#define PLUGIN_VERSION "0.0.1"
int vscore;
int vinput;
public Plugin:myinfo =
{
name = "L4D2 Versus Scoring Fixer",
author = "DannBo",
description = "Fixes Broken Scoring on Select Custom Maps",
version = PLUGIN_VERSION,
url = "http://therocinante.clanservers.com/motd.html"
}
public void OnPluginStart()
{
CreateConVar("sm_vscore_fixer_version", PLUGIN_VERSION, "Get Plugin Version", FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
RegConsoleCmd("sm_vscore_set", cmdScoreSet, "Set Score Completion");
}
public Action:cmdScoreSet(client, args)
{
L4D_NotifyNetworkStateChanged();
new String:buffer[32];
GetCmdArg(1, buffer, sizeof(buffer));
vinput = StringToInt(buffer);
L4D_SetVersusMaxCompletionScore(vinput);
vscore = L4D_GetVersusMaxCompletionScore();
PrintToChat(client, "Versus Completion Score is now %d", vscore);
return Plugin_Handled;
}
And it sort of works. If I use the command once I am connected to the server, it sets the scores appropriately for both teams, however, the UI still shows the maximum as what it was set to before. So if the default is 400, and I set it to 500, at the end it shows 500 / 400 for full completion, rather than updating the UI to show 500 / 500.
While this works functionally, it would be nice to have an event to hook it too that's after round_start, rather than having to call the command each time I want to do it after I'm connected. Is there an event I could hook it too where it would also reflect fully in the UI?