Jump to content

Scoreboard


TheIceman1

Recommended Posts

Posted

Why this dont put my vip stats to scoreboard?

call(getResourceFromName("scoreboard"), "addScoreboardColumn", "VIP", getRootElement(), 8, 0.07) 
  
function getvip() 
local playes = getElementsByType ( "player" ) 
for theKey,thePlayer in ipairs(playes) do 
local acc = getPlayerAccount ( thePlayer ) 
local goldvip = getAccountData ( acc, "goldvip" ) 
local nonevip = getAccountData ( acc, "nonevip" ) 
local silvervip = getAccountData ( acc, "silvervip" ) 
local bronzevip = getAccountData ( acc, "bronzevip" ) 
local none = "None" 
local bronze = "Bronze" 
local silver = "Silver" 
local gold = "Gold" 
    if nonevip == "None" then 
        setElementData ( thePlayer, "VIP", none ) 
    else if bronzevip == "Bronze" then 
        setElementData ( thePlayer, "VIP", bronze ) 
    else if silvervip == "Silver" then 
        setElementData ( thePlayer, "VIP", silver ) 
    else if goldvip == "Gold" then 
        setElementData ( thePlayer, "VIP", gold ) 
        end 
    end 
end 
end 
end 
end 
setTimer(getvip,100,0) 
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), getvip ) 
  

Posted

use type thePlayer and the function () ?

it's not defined

  
exports.scoreboard:scoreboardAddColumn ( "VIP" )  
function getvip() 
local playes = getElementsByType ( "player" ) 
for theKey,source in ipairs(playes) do 
local acc = getPlayerAccount ( source ) 
if acc then 
local goldvip = getAccountData ( acc, "goldvip" ) 
local nonevip = getAccountData ( acc, "nonevip" ) 
local silvervip = getAccountData ( acc, "silvervip" ) 
local bronzevip = getAccountData ( acc, "bronzevip" ) 
local none = "None" 
local bronze = "Bronze" 
local silver = "Silver" 
local gold = "Gold" 
    if nonevip == "None" then 
        setElementData ( source, "VIP", none ) 
    else if bronzevip == "Bronze" then 
        setElementData ( source, "VIP", bronze ) 
    else if silvervip == "Silver" then 
        setElementData ( source, "VIP", silver ) 
    else if goldvip == "Gold" then 
        setElementData ( source, "VIP", gold ) 
        end 
    end 
end 
end 
end 
end 
end 
setTimer(getvip,100,0) 
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), getvip ) 

Posted
use type thePlayer and the function () ?

it's not defined

  
exports.scoreboard:scoreboardAddColumn ( "VIP" )  
function getvip() 
local playes = getElementsByType ( "player" ) 
for theKey,source in ipairs(playes) do 
local acc = getPlayerAccount ( source ) 
if acc then 
local goldvip = getAccountData ( acc, "goldvip" ) 
local nonevip = getAccountData ( acc, "nonevip" ) 
local silvervip = getAccountData ( acc, "silvervip" ) 
local bronzevip = getAccountData ( acc, "bronzevip" ) 
local none = "None" 
local bronze = "Bronze" 
local silver = "Silver" 
local gold = "Gold" 
    if nonevip == "None" then 
        setElementData ( source, "VIP", none ) 
    else if bronzevip == "Bronze" then 
        setElementData ( source, "VIP", bronze ) 
    else if silvervip == "Silver" then 
        setElementData ( source, "VIP", silver ) 
    else if goldvip == "Gold" then 
        setElementData ( source, "VIP", gold ) 
        end 
    end 
end 
end 
end 
end 
end 
setTimer(getvip,100,0) 
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), getvip ) 

Nothing.

Posted

Your script doesn't look good with three account data, but this is your choice.

call(getResourceFromName("scoreboard"), "addScoreboardColumn", "VIP", getRootElement(), 8, 0.07) 
  
local none = "None" 
local bronze = "Bronze" 
local silver = "Silver" 
local gold = "Gold" 
     
addEventHandler("onResourceStart", resourceRoot, 
function() 
    for _, thePlayer in ipairs(getElementsByType("player")) do 
        local acc = getPlayerAccount(thePlayer) 
        if acc and not isGuestAccount(acc) then 
            local goldvip = getAccountData(acc, "goldvip") 
            local nonevip = getAccountData(acc, "nonevip") 
            local silvervip = getAccountData(acc, "silvervip") 
            local bronzevip = getAccountData(acc, "bronzevip") 
            if nonevip == "None" then 
                setElementData(thePlayer, "VIP", none) 
            elseif bronzevip == "Bronze" then 
                setElementData(thePlayer, "VIP", bronze) 
            elseif silvervip == "Silver" then 
                setElementData(thePlayer, "VIP", silver) 
            elseif goldvip == "Gold" then 
                setElementData(thePlayer, "VIP", gold) 
            end 
        end 
    end 
end) 
  
addEventHandler("onPlayerLogin", root, 
function(_, acc) 
    local goldvip = getAccountData(acc, "goldvip") 
    local nonevip = getAccountData(acc, "nonevip") 
    local silvervip = getAccountData(acc, "silvervip") 
    local bronzevip = getAccountData(acc, "bronzevip") 
    if nonevip == "None" then 
        setElementData(source, "VIP", none) 
    elseif bronzevip == "Bronze" then 
        setElementData(source, "VIP", bronze) 
    elseif silvervip == "Silver" then 
        setElementData(source, "VIP", silver) 
    elseif goldvip == "Gold" then 
        setElementData(source, "VIP", gold) 
    end 
end) 

Posted
Your script doesn't look good with three account data, but this is your choice.
call(getResourceFromName("scoreboard"), "addScoreboardColumn", "VIP", getRootElement(), 8, 0.07) 
  
local none = "None" 
local bronze = "Bronze" 
local silver = "Silver" 
local gold = "Gold" 
     
addEventHandler("onResourceStart", resourceRoot, 
function() 
    for _, thePlayer in ipairs(getElementsByType("player")) do 
        local acc = getPlayerAccount(thePlayer) 
        if acc and not isGuestAccount(acc) then 
            local goldvip = getAccountData(acc, "goldvip") 
            local nonevip = getAccountData(acc, "nonevip") 
            local silvervip = getAccountData(acc, "silvervip") 
            local bronzevip = getAccountData(acc, "bronzevip") 
            if nonevip == "None" then 
                setElementData(thePlayer, "VIP", none) 
            elseif bronzevip == "Bronze" then 
                setElementData(thePlayer, "VIP", bronze) 
            elseif silvervip == "Silver" then 
                setElementData(thePlayer, "VIP", silver) 
            elseif goldvip == "Gold" then 
                setElementData(thePlayer, "VIP", gold) 
            end 
        end 
    end 
end) 
  
addEventHandler("onPlayerLogin", root, 
function(_, acc) 
    local goldvip = getAccountData(acc, "goldvip") 
    local nonevip = getAccountData(acc, "nonevip") 
    local silvervip = getAccountData(acc, "silvervip") 
    local bronzevip = getAccountData(acc, "bronzevip") 
    if nonevip == "None" then 
        setElementData(source, "VIP", none) 
    elseif bronzevip == "Bronze" then 
        setElementData(source, "VIP", bronze) 
    elseif silvervip == "Silver" then 
        setElementData(source, "VIP", silver) 
    elseif goldvip == "Gold" then 
        setElementData(source, "VIP", gold) 
    end 
end) 

Nothing.Maybe is problem in script where is account data(silvervip,goldvip...) appointed?

Posted

You set the data to "true", while in the code that i post it was "Bronze".

Also the text not used anywhere.

Do you have three command for these thing? :mrgreen:

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