Keeping the scoreboard up-to-date
Writing the client-side logic
//-----------------------------------------------------------------------------
// ScoreBoardGUI data handler methods
//-----------------------------------------------------------------------------
function ScoreBoardGUI::upsertPlayer(%this, %clientID, %name, %score, %kills, %deaths) {
%text = StripMLControlChars(%name);
if (%score !$= "null")
%text = setField(%text, 1, %score);
%text = setField(%text, 2, %kills);
%text = setField(%text, 3, %deaths);
// Update or add the player to the control
if (ScoreBoardGUIList.getRowNumById(%clientId) == -1)
ScoreBoardGUIList.addRow(%clientId, %text);
else ScoreBoardGUIList.setRowById(%clientId, %text);
// Sorts by score
ScoreBoardGUIList.sortNumerical(1, false);
ScoreBoardGUIList.clearSelection();
}
function ScoreBoardGUI::removePlayer(%this, %clientId) {
PlayerListGuiList.removeRowById(%clientId);
}Adding the hooks on the server
Last updated