TheIceman1 Posted March 10, 2013 Share Posted March 10, 2013 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 ) Link to comment
Sasu Posted March 10, 2013 Share Posted March 10, 2013 Use export. exports.scoreboard:scoreboardAddColumn ( "VIP" ) Link to comment
X-SHADOW Posted March 10, 2013 Share Posted March 10, 2013 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 ) Link to comment
TheIceman1 Posted March 10, 2013 Author Share Posted March 10, 2013 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. Link to comment
X-SHADOW Posted March 10, 2013 Share Posted March 10, 2013 the problem is the dam wiki dont work i could not read any **** Link to comment
TAPL Posted March 10, 2013 Share Posted March 10, 2013 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) Link to comment
TheIceman1 Posted March 10, 2013 Author Share Posted March 10, 2013 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? Link to comment
TheIceman1 Posted March 10, 2013 Author Share Posted March 10, 2013 (edited) Edited Edited March 10, 2013 by Guest Link to comment
TAPL Posted March 10, 2013 Share Posted March 10, 2013 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? Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now