mr.Extreme Posted January 16, 2014 Share Posted January 16, 2014 hello i want help what the problem here local lowerBound,upperBound = unpack(get"color_range") g_Root = getRootElement () g_ResourceRoot = getResourceRootElement ( getThisResource () ) addEventHandler ( "onResourceStart", g_ResourceRoot, function() for i,player in ipairs(getElementsByType"player") do processPlayer ( player ) end end ) function processPlayer ( player ) if not isElement(blip) then blip = createBlipAttachedTo(source) end local theTeam = getPlayerTeam(source) if theTeam then local r, g, b = getTeamColor(theTeam) setPlayerNametagColor(source, r, g, b) setBlipColor(blip, r, g, b, 255) else --[[if not isElement(blip1[source]) then blip1[source] = createBlipAttachedTo(source) end]] player = player or source local rr, gg, bb = math.random(lowerBound, upperBound), math.random(lowerBound, upperBound), math.random(lowerBound, upperBound) setPlayerNametagColor(player, rr, gg, bb) --setBlipColor(blip1[source], rr, gg, bb, 255) --destroyElement(blip[source]) end end addEventHandler ( "onPlayerLogin", getRootElement(), processPlayer ) function setColorPlayer() if not isElement(blips) then blips = createBlipAttachedTo(source) end player = player or source local rr, gg, bb = math.random(lowerBound, upperBound), math.random(lowerBound, upperBound), math.random(lowerBound, upperBound) setPlayerNametagColor(player, rr, gg, bb) setBlipColor(blips, rr, gg, bb, 255) end addEventHandler("onPlayerJoin", getRootElement(), setColorPlayer) function ifnottheteam() local theTeams = getPlayerTeam(source) if not theTeams then destroyElement(blip) end if theTeams then destroyElement(blips) end end addEventHandler("onPlayerLogin", getRootElement(), ifnottheteam) addEventHandler("onPlayerQuit", root, function() if isElement(blip) then destroyElement(blip) destroyElement(blips) end end ) --[[ addEventHandler('onPlayerChat', g_Root, function(msg, type) if type == 0 then cancelEvent() local r, g, b = getPlayerColor(source) local name = getPlayerName(source) local msg = msg:gsub('#%x%x%x%x%x%x', '') outputChatBox( name.. ': #FFFFFF' .. msg, g_Root, r, g, b, true) outputServerLog( "CHAT: " .. name .. ": " .. msg ) end end ) ]] getPlayerColor = getPlayerNametagColor getPlayerColour = getPlayerNametagColor Link to comment
K4stic Posted January 16, 2014 Share Posted January 16, 2014 any error in /debugscript 3 ? Link to comment
mr.Extreme Posted January 16, 2014 Author Share Posted January 16, 2014 any error in /debugscript 3 ? i know but i don't know how to fix it . Link to comment
DNL291 Posted January 16, 2014 Share Posted January 16, 2014 local lowerBound,upperBound = unpack(get"color_range") (get"color_range") It's wrong. Link to comment
Bzz335 Posted January 17, 2014 Share Posted January 17, 2014 local lowerBound,upperBound = unpack(get"color_range") lol. Link to comment
Castillo Posted January 17, 2014 Share Posted January 17, 2014 local lowerBound,upperBound = unpack(get"color_range") (get"color_range") It's wrong. How exactly is it wrong? because he forgot about the parentheses before " and after "? if so, then you are wrong, because that'll work anyway. Link to comment
mr.Extreme Posted January 17, 2014 Author Share Posted January 17, 2014 local lowerBound,upperBound = unpack(get"color_range") (get"color_range") It's wrong. local lowerBound,upperBound = unpack(get"color_range") lol. what about meta.xml "color_range" value="[ [ 50, 255 ] ]" /> Link to comment
Anubhav Posted January 17, 2014 Share Posted January 17, 2014 meta? wrong it should be: : Link to comment
mr.Extreme Posted January 17, 2014 Author Share Posted January 17, 2014 meta? wrong it should be: : Link to comment
DNL291 Posted January 17, 2014 Share Posted January 17, 2014 local lowerBound,upperBound = unpack(get"color_range") (get"color_range") It's wrong. How exactly is it wrong? because he forgot about the parentheses before " and after "? if so, then you are wrong, because that'll work anyway. My bad, I never used the get function, thought it was needed parentheses. Link to comment
Castillo Posted January 18, 2014 Share Posted January 18, 2014 Is not about that function only, you can do it with other functions, example: for _, player in ipairs ( getElementsByType "player" ) do -- Code here end Link to comment
DNL291 Posted January 18, 2014 Share Posted January 18, 2014 (edited) Oh, and it work only for strings? I really didn't know that... Sorry for Offtopic. Edited January 19, 2014 by Guest Link to comment
Castillo Posted January 18, 2014 Share Posted January 18, 2014 Yes, I think it only works with strings. Link to comment
mr.Extreme Posted January 19, 2014 Author Share Posted January 19, 2014 color player has been fixed successfully 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