Edit: https://forums.alliedmods.net/showthread.php?t=183257
The
SetTeamScore native (m_iScore) allows you to change the score visually, but it doesn't get saved by the engine (as of OB) and will reset to its 'real' value after a round has ended.
Here is one method to change the real value:
Code:
/* Change a team's score by +/- amount of points. */
stock bool:Team_ApplyScore(team, points)
{
// A player must exist on the team to modify its score.
new target;
for (new i = 1; i <= MaxClients; i++)
{
if (IsClientInGame(i) && GetClientTeam(i) == team)
{
target = i;
break;
}
}
if (!target)
return false;
// Create entity to modify score.
new entity = CreateEntityByName("game_score");
if (entity == -1)
return false;
decl String:sPoints[12];
IntToString(points, sPoints, sizeof(sPoints));
DispatchKeyValue(entity, "points", sPoints);
DispatchKeyValue(entity, "spawnflags", "3");
if (!DispatchSpawn(entity))
return false;
AcceptEntityInput(entity, "ApplyScore", target);
AcceptEntityInput(entity, "Kill");
return true;
}
stock bool:Team_SetScore(team, points)
{
return Team_ApplyScore(team, points - GetTeamScore(team));
}
I'm sure there is a function that can be called that works better, but this will do for now.
__________________