Resource:Scoreboard: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
Line 5: Line 5:
When you add a column to the scoreboard, it's linked to the element data field of the same name, so if you add the "score" column, element data in the field "score" will be shown for all players and teams.
When you add a column to the scoreboard, it's linked to the element data field of the same name, so if you add the "score" column, element data in the field "score" will be shown for all players and teams.


==Exported serverside functions==
==Функции экспорта со стороны сервера==
You can call them from another resource using call():
Вы можете взять это и из другого ресурса используя call():
<syntaxhighlight lang="lua">call(getResourceFromName("scoreboard"), "addScoreboardColumn", "wanted level")</syntaxhighlight>
<syntaxhighlight lang="lua">call(getResourceFromName("scoreboard"), "addScoreboardColumn", "wanted level")</syntaxhighlight>


Line 17: Line 17:
</syntaxhighlight>
</syntaxhighlight>


You can set the scoreboard data with setElementData:
Вы можете установить данные на scoreboard при помощи setElementData:
<syntaxhighlight lang="lua">setElementData ( thePlayer, "wanted level", 3 ) --3 is inserted in the player's wanted level column</syntaxhighlight>
<syntaxhighlight lang="lua">setElementData ( thePlayer, "wanted level", 3 ) --3 вставляется в требуемую колонку игрока</syntaxhighlight>


==Issues/TODO==
==Issues/TODO==
*Columns name must be unique, you can't add a column with the same name to different elements yet
*Columns name must be unique, you can't add a column with the same name to different elements yet
*Scoreboard data for web listing is being sent all at once, should allow sending of separate chunks
*Scoreboard data for web listing is being sent all at once, should allow sending of separate chunks

Revision as of 17:05, 13 October 2009

The scoreboard displays connected players, teams, pings and other data in a gridlist for players ingame. It also has a javascript-enabled web interface, so it can be viewed from a browser.

When you add a column to the scoreboard, it's linked to the element data field of the same name, so if you add the "score" column, element data in the field "score" will be shown for all players and teams.

Функции экспорта со стороны сервера

Вы можете взять это и из другого ресурса используя call():

call(getResourceFromName("scoreboard"), "addScoreboardColumn", "wanted level")
bool addScoreboardColumn( string columnName, [ element visibleToElement = getRootElement(), int columnPosition = #columns - 1, float columnSize = 0.1 ] )
bool removeScoreboardColumn( string columnName )
bool setPlayerScoreboardForced( player thePlayer, bool forced )
table getScoreboardColumns( ) --returns an ordered array of {name=columnName,size=columnSize} entries
bool resetScoreboardColumns( ) --leaves only "name, ping"

Вы можете установить данные на scoreboard при помощи setElementData:

setElementData ( thePlayer, "wanted level", 3 ) --3 вставляется в требуемую колонку игрока

Issues/TODO

  • Columns name must be unique, you can't add a column with the same name to different elements yet
  • Scoreboard data for web listing is being sent all at once, should allow sending of separate chunks