#Honda-R Posted April 29, 2013 Posted April 29, 2013 Hey im testing it in race. It only change nick color at scoreboard not on chatbox Look: Client local r, g, b = getPlayerNametagColor (getLocalPlayer()) nameTagColorWindow = guiCreateWindow(328,570,425,240,"Name Color",false) guiSetVisible(nameTagColorWindow,false) nameLabel = guiCreateLabel(175,30,110,17,"" ..getPlayerName(getLocalPlayer()) .. "", false, nameTagColorWindow) redNameLabel = guiCreateLabel(25,49,108,17,"Red",false,nameTagColorWindow) greenNameLabel = guiCreateLabel(22,97,108,17,"Green",false,nameTagColorWindow) blueNameLabel = guiCreateLabel(25,146,108,17,"Blue",false,nameTagColorWindow) guiLabelSetColor(redNameLabel,255,0,0) guiLabelSetColor(greenNameLabel,0,255,0) guiLabelSetColor(blueNameLabel,0,0,255) redBar = guiCreateScrollBar( 0.2, 0.2, 0.65, 0.1, true, true, nameTagColorWindow) greenBar = guiCreateScrollBar( 0.2, 0.4, 0.65, 0.1, true, true, nameTagColorWindow) blueBar = guiCreateScrollBar( 0.2, 0.6, 0.65, 0.1, true, true, nameTagColorWindow) local red = guiScrollBarGetScrollPosition(redBar) local green = guiScrollBarGetScrollPosition(greenBar) local blue = guiScrollBarGetScrollPosition(blueBar) guiScrollBarSetScrollPosition(redBar, math.floor(r / 2.55)) guiScrollBarSetScrollPosition(greenBar, math.floor(g / 2.55)) guiScrollBarSetScrollPosition(blueBar, math.floor(b / 2.55)) closeNametagWin = guiCreateButton(15,202,90,20, "Close", false, nameTagColorWindow) setcolorbutton = guiCreateButton(355,202,50,20, "Set", false, nameTagColorWindow) redAmount = guiCreateLabel(0.90, 0.21, 0.08, 0.07, "0", true, nameTagColorWindow) greenAmount = guiCreateLabel(0.90, 0.41, 0.08, 0.07, "0", true, nameTagColorWindow) blueAmount = guiCreateLabel(0.90, 0.61, 0.08, 0.07, "0", true, nameTagColorWindow) guiSetText(redAmount, tostring(red)) guiSetText(greenAmount, tostring(green)) guiSetText(blueAmount, tostring(blue)) function nameColor() if source == redBar or source == greenBar or source == blueBar then guiLabelSetColor(nameLabel,(guiScrollBarGetScrollPosition(redBar)*2.55),(guiScrollBarGetScrollPosition(greenBar)*2.55),(guiScrollBarGetScrollPosition(blueBar)*2.55)) local red = guiScrollBarGetScrollPosition(redBar) local green = guiScrollBarGetScrollPosition(greenBar) local blue = guiScrollBarGetScrollPosition(blueBar) guiSetText(redAmount, math.floor(red * 2.55)) guiSetText(greenAmount, math.floor(green * 2.55)) guiSetText(blueAmount, math.floor(blue * 2.55)) end end addEventHandler("onClientGUIScroll",getRootElement(),nameColor) function setthecolor() triggerServerEvent("nameTagColorChange",getLocalPlayer(),(guiScrollBarGetScrollPosition(redBar)*2.55),(guiScrollBarGetScrollPosition(greenBar)*2.55),(guiScrollBarGetScrollPosition(blueBar)*2.55)) end addEventHandler("onClientGUIClick",setcolorbutton,setthecolor,false) function closewindow() vis = guiGetVisible (nameTagColorWindow) if vis == true then showCursor(false) guiSetVisible(nameTagColorWindow,false) end end addEventHandler("onClientGUIClick",closeNametagWin,closewindow,false) function showwindow() vis = guiGetVisible(nameTagColorWindow) if vis == false then guiSetVisible(nameTagColorWindow,true) showCursor(true) else guiSetVisible(nameTagColorWindow,false) showCursor(false) end end addCommandHandler("nc", showwindow) addCommandHandler("namecolor", showwindow) addEventHandler ( "onClientPlayerChangeNick", getLocalPlayer(), function ( oldNick, newNick ) guiSetText( nameLabel, newNick ) end )
#Honda-R Posted April 29, 2013 Author Posted April 29, 2013 How to say This script , opens a gui to change nick color then mix with rbg color and press "set" it have to change nick color Lets say i mix color to red , okai i press set. then press "T" and write someting , and my nick white, not red at it should be, but in scoreboard its red.
iPrestege Posted April 29, 2013 Posted April 29, 2013 You have to show us the server side then to test it or see if there's any problem .
#Honda-R Posted April 29, 2013 Author Posted April 29, 2013 You have to show us the server side then to test it or see if there's any problem . function nameTagColor ( redBar,greenBar,blueBar, r, g, b ) setPlayerNametagColor ( source, redBar,greenBar,blueBar ) destroyBlipsAttachedTo(source) setTimer ( createBlipAttachedTo, 100, 1, source, 0, 2, redBar, greenBar, blueBar ) end addEvent( "nameTagColorChange", true ) addEventHandler ( "nameTagColorChange", getRootElement(), nameTagColor) function destroyBlipsAttachedTo(player) local attached = getAttachedElements ( player ) if ( attached ) then for k,element in ipairs(attached) do if getElementType ( element ) == "blip" then destroyElement ( element ) end end end end function left() destroyBlipsAttachedTo(source) end addEventHandler("onPlayerQuit", getRootElement(), left )
#Honda-R Posted April 29, 2013 Author Posted April 29, 2013 It works fine here !! Maybe its bec im using in race ?
iPrestege Posted April 29, 2013 Posted April 29, 2013 I Test it with play 'Game Mode' And works great .
iPrestege Posted April 29, 2013 Posted April 29, 2013 Hmm... Yes that's true but i don't know why this happened with race i don't know much about the race 'Game Mode ' Sorry .
#Honda-R Posted April 29, 2013 Author Posted April 29, 2013 maybe yuo can add smt like this ? onPlayerChat nameTagColor
iPrestege Posted April 29, 2013 Posted April 29, 2013 No i try it but nothing -.- there's something on the race gamemode set the player name tag to white .
#Honda-R Posted April 29, 2013 Author Posted April 29, 2013 No i try it but nothing -.- there's something on the race gamemode set the player name tag to white . Thanks for your help.
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