SetLeaguePerformance

Category: Network / League
Since engine version: 5.0 OC

Description

Sets the league score. This function can be used for custom scenario scoring in competition or adventure leagues.

Syntax

bool SetLeaguePerformance(int score, int player_id);

Parameters

score:
New player or scenario score
player_id:
[opt] ID of player whose score shall be set. If not given, global performance for all players is set.

Remark

Use GetPlayerID() to get the ID of a joined player.

Example

#appendto Rock
static g_rocks_collected;

func Entrance(clonk)
{
	var plr = clonk->GetController();
	if (clonk->GetID() == Clonk && plr != NO_OWNER)
	{
		++g_rocks_collected;
		Log("%s found a rock! Score: %d", GetTaggedPlayerName(plr), g_rocks_collected);
		SetLeaguePerformance(g_rocks_collected);
		return RemoveObject();
	}
	return _inherited(clonk, ...);
}
Rock script modification: Whenever a rock is collected by a Clonk, the score of all players is increased.
See also: GetLeagueScore, SetLeagueProgressData
Sven2, 2014-04