Jump to content

ID System | Помогите добавить в scoreboard


Recommended Posts

Привет всем)

Скатал ID System с комюнити ( Как в сампе дает ИД каждому игроку ). Никак не получается прикрепить видимость ид в scoreboard. Получилось только добавить сам столбик с названием..как на скрине! :roll::roll::roll:

А сам ресурс работает! только там просмотреть можно ид с помощью команды /ids ( и выдает в чате все номера игроков ), а надо чтоб именно в scoreboard отображались номера игроков ( ID`ы ) Помогите пожалуйста! :?

39b60666baf9c1e76ff45f2c2a5112d6.jpg

===

Вот код

===

exports.scoreboard:addScoreboardColumn("id",getRootElement(),1) 
  
addCommandHandler("ids", 
function(player, command) 
    players = getElementsByType("player") 
    for id,p in ipairs(players) do 
        outputChatBox(getPlayerName(p) .. ": " .. tostring(id), player) 
    end 
end) 
  
function getIDFromPlayer(player) 
    if player then 
        local theid 
        players = getElementsByType("player") 
        for id,p in ipairs(players) do 
            if player == p then 
                theid = i 
            end 
        end 
        return theid 
    else return false end 
end 
  
function getPlayerFromID(theID) 
    if theID then 
        theID = tonumber(theID) 
        local theplayer 
        players = getElementsByType("player") 
        for id,p in ipairs(players) do 
            if theID == id then 
                theplayer = p 
            end 
        end 
        return theplayer 
    else return false end 
end 

Edited by Guest
Link to comment

Ну чтобы колонку добавить ты функцию нашел, осталось найти ту, что добавляет строку, и прогнать ее через такой же почти цикл как в команде ids, только с учетом того что порядок id не будет совпадать с уже существующим порядком сортировки игроков в скорборде. Я вообще не знаю как устроен скорборд, поэтому тебе нужно в нем покопаться и понять это.

P.S. Код обрамляй в теги [lua] [ /lua]

Link to comment
  • Scripting Moderators

Нужно элемент дату использовать.

В ресурсе IDs как раз она есть. Единственное, придется отредактировать пару строчек.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...