Jump to content

addScoreboardColumn


LucasBaker

Recommended Posts

  
exports.scoreboard:addScoreboardColumn("id",getRootElement(),1) 
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 

why not appear on the scoreboard id?

Link to comment
exports.scoreboard:addScoreboardColumn("id", root, 1) 
  
addEventHandler("onResourceStart", root, 
    function() 
        for id,player in ipairs(getElementsByType("player")) do 
            setElementData(player , "id", id) 
        end 
    end 
) 
  
function getIDFromPlayer(player) 
        return getElementData(player , "id") 
end 
  
function getPlayerFromID(theID) 
    if theID then 
        local players = getElementsByType("player") 
        for i,p in ipairs(players) do 
            local id = getElementData(p, "id") 
            if theID == id then 
                return p 
            end 
        end 
    end 
    return false 
end 

Link to comment
exports.scoreboard:addScoreboardColumn("id", root, 1) 
  
addEventHandler("onResourceStart", root, 
    function() 
        for id,player in ipairs(getElementsByType("player")) do 
            setElementData(player , "id", id) 
        end 
    end 
) 
  
function getIDFromPlayer(player) 
        return getElementData(player , "id") 
end 
  
function getPlayerFromID(theID) 
    if theID then 
        local players = getElementsByType("player") 
        for i,p in ipairs(players) do 
            local id = getElementData(p, "id") 
            if theID == id then 
                return p 
            end 
        end 
    end 
    return false 
end 

Not to create another topic How does the marker back to dps than 2 seconds ? I thought about using SetTimer but I do not do the slightest idea of how to use could help me ?

lixo1 = createMarker(1516.41675, -1847.13733, 13.54688, 'cylinder', 2.0, 255, 0, 0, 150) 
function aLixeiro (source) 
if getPlayerTeam (source, Lixeiros) then 
outputChatBox("Você pegou o lixo na casa!", source, 255, 0, 0) 
givePlayerMoney ( source, 50 ) 
destroyElement(lixo1) 
else 
outputChatBox("Você não é lixeiro!", source, 255, 0, 0) 
end 
end 
addEventHandler( "onMarkerHit", lixo1, aLixeiro ) 

Link to comment
local x, y, z = 1516.41675, -1847.13733, 13.54688 
local lixo1 = createMarker(x, y, z, 'cylinder', 2.0, 255, 0, 0, 150) 
  
function aLixeiro (source) 
    if getPlayerTeam (source, Lixeiros) then 
        outputChatBox("Você pegou o lixo na casa!", source, 255, 0, 0) 
        givePlayerMoney ( source, 50 ) 
        destroyElement(lixo1) 
        setTimer(function() 
            lixo1 = createMarker(x, y, z, 'cylinder', 2.0, 255, 0, 0, 150) 
        end, 2000, 1) 
    else 
        outputChatBox("Você não é lixeiro!", source, 255, 0, 0) 
    end 
end 
addEventHandler( "onMarkerHit", lixo1, aLixeiro ) 

Link to comment
local x, y, z = 1516.41675, -1847.13733, 13.54688 
local lixo1 = createMarker(x, y, z, 'cylinder', 2.0, 255, 0, 0, 150) 
  
function aLixeiro (source) 
    if getPlayerTeam (source, Lixeiros) then 
        outputChatBox("Você pegou o lixo na casa!", source, 255, 0, 0) 
        givePlayerMoney ( source, 50 ) 
        destroyElement(lixo1) 
        setTimer(function() 
            lixo1 = createMarker(x, y, z, 'cylinder', 2.0, 255, 0, 0, 150) 
        end, 2000, 1) 
    else 
        outputChatBox("Você não é lixeiro!", source, 255, 0, 0) 
    end 
end 
addEventHandler( "onMarkerHit", lixo1, aLixeiro ) 

marker appears again after the function is not repeated

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...