mr.Extreme Posted November 3, 2013 Posted November 3, 2013 اسلام عليكم شباب انا عندي مشكلة اذا كان لاعب مو من فريق blip بيكون احمر ليش ؟؟ function color () if not isElement(blip[source]) then blip[source] = createBlipAttachedTo(source) end local theTeam = getPlayerTeam(source) if theTeam then local r, g, b = getTeamColor(theTeam) setPlayerNametagColor(source, r, g, b) setBlipColor(blip[source], r, g, b, 255) setPlayerName(source,getPlayerName(source):gsub('#%x%x%x%x%x%x',RGBToHex(r,g,b))) else if isElement(blip[source]) then blip[source] = createBlipAttachedTo(source) end local thePlayeer = getPlayerNameTagColor(source) if thePlayeer then player = player or source local r, g, b = math.random(lowerBound, upperBound), math.random(lowerBound, upperBound), math.random(lowerBound, upperBound) setPlayerNametagColor(player, r, g, b) end end end addEventHandler("onPlayerLogin", root, color) وهذا صورة يوضح شرح اكثر! وشكرا
3NAD Posted November 3, 2013 Posted November 3, 2013 سطر 12 خل الشرط .. [إذا لم يتحقق] يعني كذا if not .... then
mr.Extreme Posted November 3, 2013 Author Posted November 3, 2013 هذا الكود كامل function RGBToHex(red, green, blue, alpha) if((red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255) or (alpha and (alpha < 0 or alpha > 255))) then return nil end if(alpha) then return string.format("#%.2X%.2X%.2X%.2X", red,green,blue,alpha) else return string.format("#%.2X%.2X%.2X", red,green,blue) end end local blip = {} function color () if not isElement(blip[source]) then blip[source] = createBlipAttachedTo(source) end local theTeam = getPlayerTeam(source) if theTeam then local r, g, b = getTeamColor(theTeam) setPlayerNametagColor(source, r, g, b) setBlipColor(blip[source], r, g, b, 255) setPlayerName(source,getPlayerName(source):gsub('#%x%x%x%x%x%x',RGBToHex(r,g,b))) else if not isElement(blip[source]) then blip[source] = createBlipAttachedTo(source) end local thePlayeer = getPlayerNameTagColor(source) if thePlayeer then player = player or source local r, g, b = math.random(lowerBound, upperBound), math.random(lowerBound, upperBound), math.random(lowerBound, upperBound) setPlayerNametagColor(player, r, g, b) end end end addEventHandler("onPlayerLogin", root, color) addEventHandler("onPlayerQuit", root, function() if isElement(blip[source]) then destroyElement(blip[source]) end end )
3NAD Posted November 3, 2013 Posted November 3, 2013 جرب function color () if not isElement(blip[source]) then blip[source] = createBlipAttachedTo(source) end local theTeam = getPlayerTeam(source) if theTeam then local r, g, b = getTeamColor(theTeam) setPlayerNametagColor(source, r, g, b) setBlipColor(blip[source], r, g, b, 255) setPlayerName(source,getPlayerName(source):gsub('#%x%x%x%x%x%x',RGBToHex(r,g,b))) else if not isElement(blip[source]) then blip[source] = createBlipAttachedTo(source) end local r, g, b = math.random(200), math.random(200), math.random(200) setPlayerNametagColor(source, r, g, b) setBlipColor(blip[source], r, g, b, 255) end end addEventHandler ( "onPlayerLogin", root, color )
mr.Extreme Posted November 3, 2013 Author Posted November 3, 2013 جرب function color () if not isElement(blip[source]) then blip[source] = createBlipAttachedTo(source) end local theTeam = getPlayerTeam(source) if theTeam then local r, g, b = getTeamColor(theTeam) setPlayerNametagColor(source, r, g, b) setBlipColor(blip[source], r, g, b, 255) setPlayerName(source,getPlayerName(source):gsub('#%x%x%x%x%x%x',RGBToHex(r,g,b))) else if not isElement(blip[source]) then blip[source] = createBlipAttachedTo(source) end local r, g, b = math.random(200), math.random(200), math.random(200) setPlayerNametagColor(source, r, g, b) setBlipColor(blip[source], r, g, b, 255) end end addEventHandler ( "onPlayerLogin", root, color ) ما زبط
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